|
@@ -1,60 +1,173 @@
|
|
-<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
-<mapper namespace="com.diagbot.mapper.UserMapper">
|
|
|
|
-
|
|
|
|
- <!-- 通用查询映射结果 -->
|
|
|
|
- <resultMap id="BaseResultMap" type="com.diagbot.entity.User">
|
|
|
|
- <id column="id" property="id" />
|
|
|
|
- <result column="is_deleted" property="isDeleted" />
|
|
|
|
- <result column="gmt_create" property="gmtCreate" />
|
|
|
|
- <result column="gmt_modified" property="gmtModified" />
|
|
|
|
- <result column="creator" property="creator" />
|
|
|
|
- <result column="modifier" property="modifier" />
|
|
|
|
- <result column="password" property="password" />
|
|
|
|
- <result column="username" property="username" />
|
|
|
|
- <result column="linkman" property="linkman" />
|
|
|
|
- <result column="email" property="email" />
|
|
|
|
- <result column="type" property="type" />
|
|
|
|
- </resultMap>
|
|
|
|
-
|
|
|
|
- <select id="findByName" resultMap="BaseResultMap" parameterType="java.lang.String">
|
|
|
|
- select * from sys_user
|
|
|
|
- where username = #{username} and is_deleted = 'N'
|
|
|
|
- </select>
|
|
|
|
-
|
|
|
|
- <select id="selectUserListPage" resultMap="BaseResultMap">
|
|
|
|
- select u.*
|
|
|
|
- from sys_user u
|
|
|
|
- LEFT JOIN sys_user_role ur on u.id= ur.user_id
|
|
|
|
- LEFT JOIN sys_role r on ur.role_id=r.id
|
|
|
|
- where u.is_deleted = 'N'
|
|
|
|
- <if test="user.id != null">
|
|
|
|
- and u.id = #{user.id}
|
|
|
|
- </if>
|
|
|
|
- </select>
|
|
|
|
-
|
|
|
|
-<!-- <select id="selectUserInfoListPage" resultMap="BaseResultMap">
|
|
|
|
- select u.*
|
|
|
|
- LEFT JOIN sys_user_role ur on u.id= ur.user_id
|
|
|
|
- LEFT JOIN
|
|
|
|
- sys_role r on ur.role_id=r.id
|
|
|
|
- where u.is_deleted = 'N' and type = "0"
|
|
|
|
- ORDER BY gmt_create DESC
|
|
|
|
- </select> -->
|
|
|
|
-
|
|
|
|
- <select id="selectUserInfoListPage" resultType="com.diagbot.entity.UserInfo">
|
|
|
|
- SELECT
|
|
|
|
- u.id AS userId,
|
|
|
|
- u.gmt_create as userGmtCreate,
|
|
|
|
- u.username as userName,
|
|
|
|
- u.linkman as linKman,
|
|
|
|
- u.email as email,
|
|
|
|
- org.id AS orgId,
|
|
|
|
- org.gmt_create as orgGmtCreate,
|
|
|
|
- org.name as orgName
|
|
|
|
- FROM sys_user u
|
|
|
|
- LEFT JOIN sys_user_organization uorg ON u.id = uorg.user_id
|
|
|
|
- LEFT JOIN sys_organization org ON uorg.organization_id = org.id
|
|
|
|
- WHERE u.is_deleted = 'N' AND u.TYPE = "0" ORDER BY u.gmt_create DESC
|
|
|
|
- </select>
|
|
|
|
-</mapper>
|
|
|
|
|
|
+<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
+<mapper namespace="com.diagbot.mapper.UserMapper">
|
|
|
|
+
|
|
|
|
+ <!-- 通用查询映射结果 -->
|
|
|
|
+ <resultMap id="BaseResultMap" type="com.diagbot.entity.User">
|
|
|
|
+ <id column="id" property="id" />
|
|
|
|
+ <result column="is_deleted" property="isDeleted" />
|
|
|
|
+ <result column="gmt_create" property="gmtCreate" />
|
|
|
|
+ <result column="gmt_modified" property="gmtModified" />
|
|
|
|
+ <result column="creator" property="creator" />
|
|
|
|
+ <result column="modifier" property="modifier" />
|
|
|
|
+ <result column="password" property="password" />
|
|
|
|
+ <result column="username" property="username" />
|
|
|
|
+ <result column="linkman" property="linkman" />
|
|
|
|
+ <result column="email" property="email" />
|
|
|
|
+ <result column="type" property="type" />
|
|
|
|
+ </resultMap>
|
|
|
|
+
|
|
|
|
+ <select id="findByName" resultMap="BaseResultMap" parameterType="java.lang.String">
|
|
|
|
+ select * from sys_user
|
|
|
|
+ where username = #{username} and is_deleted = 'N'
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="selectUserListPage" resultMap="BaseResultMap">
|
|
|
|
+ select u.*
|
|
|
|
+ from sys_user u
|
|
|
|
+ LEFT JOIN sys_user_role ur on u.id= ur.user_id
|
|
|
|
+ LEFT JOIN sys_role r on ur.role_id=r.id
|
|
|
|
+ where u.is_deleted = 'N'
|
|
|
|
+ <if test="user.id != null">
|
|
|
|
+ and u.id = #{user.id}
|
|
|
|
+ </if>
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+<!-- <select id="selectUserInfoListPage" resultMap="BaseResultMap">
|
|
|
|
+ select u.*
|
|
|
|
+ LEFT JOIN sys_user_role ur on u.id= ur.user_id
|
|
|
|
+ LEFT JOIN
|
|
|
|
+ sys_role r on ur.role_id=r.id
|
|
|
|
+ where u.is_deleted = 'N' and type = "0"
|
|
|
|
+ ORDER BY gmt_create DESC
|
|
|
|
+ </select> -->
|
|
|
|
+
|
|
|
|
+ <!-- <select id="selectUserInfoPage" parameterType="com.diagbot.dto.UserInfoDTO" resultType="com.diagbot.dto.UserInfoDTO">
|
|
|
|
+ SELECT
|
|
|
|
+ u.id AS userId,
|
|
|
|
+ u.gmt_create as userGmtCreate,
|
|
|
|
+ u.username as userName,
|
|
|
|
+ u.linkman as linKman,
|
|
|
|
+ u.email as email,
|
|
|
|
+ org.id AS orgId,
|
|
|
|
+ org.gmt_create as orgGmtCreate,
|
|
|
|
+ org.name as orgName
|
|
|
|
+ FROM sys_user u
|
|
|
|
+ LEFT JOIN sys_user_organization uorg ON u.id = uorg.user_id
|
|
|
|
+ LEFT JOIN sys_organization org ON uorg.organization_id = org.id
|
|
|
|
+ WHERE u.is_deleted = 'N' AND u.TYPE = 0 ORDER BY u.gmt_create DESC
|
|
|
|
+ </select> -->
|
|
|
|
+ <select id="selectUserInfoListPage" resultType="com.diagbot.dto.UserInfoDTO">
|
|
|
|
+ SELECT
|
|
|
|
+ u.id AS userId,
|
|
|
|
+ u.gmt_create AS userGmtCreate,
|
|
|
|
+ u.username AS userName,
|
|
|
|
+ u.linkman AS linKman,
|
|
|
|
+ u.email AS email,
|
|
|
|
+ org.id AS orgId,
|
|
|
|
+ org.gmt_create AS orgGmtCreate,
|
|
|
|
+ org.name AS orgName,
|
|
|
|
+ org.type as orgType,
|
|
|
|
+ org.principal AS orgPrincipal,
|
|
|
|
+ org.address as orgAddress,
|
|
|
|
+ org.parent_id as orgParent_id,
|
|
|
|
+ org.sub_num as orgSub_num,
|
|
|
|
+ aut.position as autPosition,
|
|
|
|
+ aut.is_reject as autIsReject,
|
|
|
|
+ aut.status as autStatus
|
|
|
|
+ FROM sys_user u
|
|
|
|
+ LEFT JOIN sys_user_organization uorg ON u.id = uorg.user_id
|
|
|
|
+ LEFT JOIN sys_organization org ON uorg.organization_id = org.id
|
|
|
|
+ LEFT JOIN sys_user_authentication aut ON u.id = aut.user_id
|
|
|
|
+ WHERE u.is_deleted = 'N' AND u.TYPE = 0
|
|
|
|
+ <if test="userInfo.orgName != null">
|
|
|
|
+ AND org.name LIKE CONCAT('%', #{userInfo.orgName}, '%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="userInfo.autStatus != null">
|
|
|
|
+ AND aut.status = #{userInfo.autStatus}
|
|
|
|
+ </if>
|
|
|
|
+ ORDER BY u.gmt_create DESC
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <update id="updateUserInfoAll" parameterType="com.diagbot.vo.UserInfoOrganizationsVO" >
|
|
|
|
+ UPDATE sys_user u ,sys_user_organization a ,
|
|
|
|
+ sys_organization b ,sys_user_authentication c
|
|
|
|
+ SET u.remark = "0"
|
|
|
|
+ <if test="email != null">
|
|
|
|
+ <if test="gmtModified !=null">
|
|
|
|
+ ,u.gmt_modified=#{gmtModified}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="modifier != modifier">
|
|
|
|
+ ,u.modifier=#{modifier}
|
|
|
|
+ </if>
|
|
|
|
+ ,u.email=#{email}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="principal != null || address != null || type != null">
|
|
|
|
+ <if test="gmtModified !=null">
|
|
|
|
+ ,b.gmt_modified=#{gmtModified}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="modifier != null">
|
|
|
|
+ ,b.modifier=#{modifier}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="principal != null">
|
|
|
|
+ ,b.principal=#{principal}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="address != null">
|
|
|
|
+ ,b.address=#{address}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="type != null">
|
|
|
|
+ ,b.type=#{type}
|
|
|
|
+ </if>
|
|
|
|
+ </if>
|
|
|
|
+
|
|
|
|
+ <if test="position != null || isReject != null || rejectType !=null || rejectComment !=null || status != null">
|
|
|
|
+ <if test="gmtModified !=null">
|
|
|
|
+ ,c.gmt_modified=#{gmtModified}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="modifier != null">
|
|
|
|
+ ,c.modifier=#{modifier}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="position != null">
|
|
|
|
+ ,c.position=#{position}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="isReject != null">
|
|
|
|
+ ,c.is_reject=#{isReject}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="rejectType !=null">
|
|
|
|
+ ,c.reject_type=#{rejectType}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="rejectComment !=null">
|
|
|
|
+ ,c.reject_comment=#{rejectComment}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="status != null">
|
|
|
|
+ ,c.status = #{status}
|
|
|
|
+ </if>
|
|
|
|
+ </if>
|
|
|
|
+ WHERE u.id = #{userId}
|
|
|
|
+ AND c.user_id= #{userId}
|
|
|
|
+ AND a.user_id = #{userId}
|
|
|
|
+ AND a.organization_id =b.id
|
|
|
|
+</update>
|
|
|
|
+
|
|
|
|
+ <update id="updateDeleted" parameterType="java.util.Map">
|
|
|
|
+ UPDATE sys_user u ,sys_user_organization a ,
|
|
|
|
+ sys_organization b,sys_user_authentication c
|
|
|
|
+ SET u.is_deleted = "Y",a.is_deleted= "Y",b.is_deleted= "Y",c.is_deleted="Y"
|
|
|
|
+ <if test="map.gmtModified !=null">
|
|
|
|
+ ,u.gmt_modified=#{map.gmtModified}
|
|
|
|
+ ,b.gmt_modified=#{map.gmtModified}
|
|
|
|
+ ,c.gmt_modified=#{map.gmtModified}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="map.modifier != null">
|
|
|
|
+ ,u.modifier=#{map.modifier}
|
|
|
|
+ ,b.modifier=#{map.modifier}
|
|
|
|
+ ,c.modifier=#{map.modifier}
|
|
|
|
+ </if>
|
|
|
|
+ WHERE u.id = #{map.userId}
|
|
|
|
+ AND c.user_id= #{map.userId}
|
|
|
|
+ AND a.user_id = #{map.userId}
|
|
|
|
+ AND a.organization_id =b.id
|
|
|
|
+</update>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+</mapper>
|