cjl
2023-12-14 6992aaf0587c09f7c511c1afd12e1519d91363d3
screen-api/src/main/resources/mapper/UserMapper.xml
@@ -17,34 +17,37 @@
        <result column="update_time" property="updateTime"/>
        <result column="expire_time" property="expireTime"/>
        <result column="is_delete" property="isDelete"/>
        <result column="unit_id" property="unitId"/>
    </resultMap>
    <resultMap id="userInfoMap" type="com.moral.api.pojo.UserBO" extends="BaseResultMap">
    <resultMap id="userInfoMap" type="com.moral.api.pojo.bo.UserBO" extends="BaseResultMap">
        <!--用户组织-->
        <association property="organization" javaType="com.moral.api.entity.Organization">
            <result column="id" property="id" jdbcType="INTEGER"/>
            <result column="name" property="name" jdbcType="VARCHAR"/>
            <result column="location_level" property="locationLevel"/>
            <result column="location_level_code" property="locationLevelCode"/>
            <result column="org_expire_time" property="expireTime"/>
        </association>
        <!--用户组-->
        <collection property="groups" ofType="com.moral.api.entity.Group" javaType="java.util.ArrayList">
            <id column="groupId" property="id" jdbcType="INTEGER"/>
        <association property="group" javaType="com.moral.api.entity.Group">
            <id column="group_id" property="id" jdbcType="INTEGER"/>
            <result column="group_name" property="groupName" jdbcType="VARCHAR"/>
        </collection>
        </association>
    </resultMap>
    <!--查询用户信息,包含组织,角色-->
    <select id="selectUserInfo" resultMap="userInfoMap">
      SELECT u.id, u.account, u.password, u.user_name, u.organization_id, u.expire_time, u.is_delete,u.is_Admin,
      o.name, o.location_level,
      a.id groupId , a.group_name
      SELECT u.id, u.account, u.password, u.user_name, u.email, u.mobile, u.wechat ,u.organization_id, u.expire_time, u.is_delete,u.is_Admin,
      o.name, o.location_level_code, o.expire_time org_expire_time,
      a.id group_id , a.group_name,u.unit_id
      FROM `user` u
      LEFT JOIN
            (SELECT ug.user_id,g.id,g.group_name FROM `user_group` ug ,`group` g WHERE ug.group_id=g.id   AND g.is_delete = 0
            AND ug.is_delete = 0) a
            AND ug.is_delete = '0') a
        ON a.user_id=u.id
      LEFT JOIN `organization` o ON o.id=u.organization_id
      WHERE u.account = #{account}
        AND u.is_delete = '0'
    </select>
</mapper>