123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626 |
- <?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="username" property="username" />
- <result column="password" property="password" />
- <result column="linkman" property="linkman" />
- <result column="phone" property="phone" />
- <result column="position" property="position" />
- <result column="dept" property="dept" />
- <result column="email" property="email" />
- <result column="auth_status" property="authStatus" />
- <result column="passauth_time" property="passauthTime" />
- <result column="type" property="type" />
- <result column="remark" property="remark" />
- </resultMap>
- <resultMap id="UserOrgDTO" type="com.diagbot.dto.UserOrgDTO">
- <id column="user_id" property="userId"/>
- <result column="username" property="username"/>
- <result column="linkman" property="linkman"/>
- <result column="email" property="email"/>
- <result column="org_id" property="orgId"/>
- <result column="org_name" property="orgName"/>
- <result column="is_reject" property="isReject"/>
- <result column="au_status" property="auStatus"/>
- <result column="sub_num" property="subNum"/>
- </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="indexPage" resultMap="BaseResultMap">
- select u.* from sys_user u where u.is_deleted = 'N'
- <if test="user.id != null">
- and u.id = #{user.id}
- </if>
- <if test="user.username != null and user.username != '' ">
- and u.username like concat('%',#{user.username},'%')
- </if>
- </select>
- <select id="getByIds" resultMap="BaseResultMap">
- select u.* from sys_user u where u.is_deleted = 'N'
- and u.id in
- <foreach collection="list" item="ids" open="(" close=")" separator=",">
- #{ids}
- </foreach>
- </select>
- <select id="getUserOrgDTOByIds" resultMap="UserOrgDTO">
- select u.id user_id ,u.username username, u.email email, u.linkman linkman , org.id org_id,
- org.name org_name, u.auth_status is_reject, u.auth_status au_status,org.sub_num
- from sys_user u, sys_user_organization uo, sys_organization org
- where u.is_deleted = 'N' and uo.is_deleted = 'N' and org.is_deleted = 'N'
- and u.id = uo.user_id and uo.organization_id = org.id
- and u.id in
- <foreach collection="list" item="ids" open="(" close=")" separator=",">
- #{ids}
- </foreach>
- </select>
- <select id="getUserByOrgName" resultMap="BaseResultMap">
- select a.* from sys_user a, sys_organization org, sys_user_organization uo
- where a.is_deleted = 'N' and org.is_deleted = 'N' and uo.is_deleted = 'N'
- and a.id = uo.user_id and uo.organization_id = org.id and org.`name` like concat('%' ,#{orgName}, '%')
- </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 orgParentId,
- org.sub_num as orgSub_num,
- u.position as position,
- aut.is_reject as autIsReject,
- u.auth_status as authStatus
- 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.authStatus != null">
- AND u.auth_status = #{userInfo.authStatus}
- </if>
- ORDER BY u.gmt_create DESC
- </select>
- <update id="updateUserInfoAll" parameterType="java.util.Map">
- UPDATE sys_user u ,sys_user_organization a ,
- sys_organization b ,sys_user_authentication c
- SET u.remark = "0"
- <if test="userMap.email != null">
- <if test="userMap.gmtModified !=null">
- ,u.gmt_modified=#{userMap.gmtModified}
- </if>
- <if test="userMap.modifier != null">
- ,u.modifier=#{userMap.modifier}
- </if>
- ,u.email=#{userMap.email}
- </if>
- <if test="userMap.principal != null || userMap.address != null || userMap.type != null">
- <if test="userMap.gmtModified !=null">
- ,b.gmt_modified=#{userMap.gmtModified}
- </if>
- <if test="userMap.modifier != null">
- ,b.modifier=#{userMap.modifier}
- </if>
- <if test="userMap.principal != null">
- ,b.principal=#{userMap.principal}
- </if>
- <if test="userMap.address != null">
- ,b.address=#{userMap.address}
- </if>
- <if test="userMap.type != null">
- ,b.type=#{userMap.type}
- </if>
- </if>
- <!-- <if test="position != null || isReject != null || rejectType !=null || rejectComment !=null || status != null"> -->
- <if test="userMap.position != null">
- <if test="userMap.gmtModified !=null">
- ,c.gmt_modified=#{userMap.gmtModified}
- </if>
- <if test="userMap.modifier != null">
- ,c.modifier=#{userMap.modifier}
- </if>
- ,c.position=#{userMap.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.is_deleted = "N"
- AND u.id = #{userMap.userId}
- AND c.user_id= #{userMap.userId}
- AND a.user_id = #{userMap.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, sys_user_role r
- SET u.is_deleted = "Y",a.is_deleted= "Y",b.is_deleted= "Y",c.is_deleted="Y", r.is_deleted="Y"
- <if test="map.gmtModified !=null">
- ,u.gmt_modified=#{map.gmtModified}
- ,a.gmt_modified=#{map.gmtModified}
- ,b.gmt_modified=#{map.gmtModified}
- ,c.gmt_modified=#{map.gmtModified}
- ,r.gmt_modified=#{map.gmtModified}
- </if>
- <if test="map.modifier != null">
- ,u.modifier=#{map.modifier}
- ,a.modifier=#{map.modifier}
- ,b.modifier=#{map.modifier}
- ,c.modifier=#{map.modifier}
- ,r.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
- AND r.user_id= #{map.userId}
- </update>
- <update id="auditUserInfoAll" parameterType="java.util.Map">
- UPDATE sys_user_authentication a, sys_user u
- <trim prefix="set" suffixOverrides=",">
- <if test="auditMap.gmtModified !=null">a.gmt_modified=#{auditMap.gmtModified},</if>
- <if test="auditMap.modifier != null">a.modifier=#{auditMap.modifier},</if>
- <if test="auditMap.isReject != null">a.is_reject = #{auditMap.isReject} ,</if>
- <if test="auditMap.certificationDate != null">a.certification_date = #{auditMap.certificationDate},</if>
- <if test="auditMap.rejectType != null">a.reject_type =#{auditMap.rejectType},</if>
- <if test="auditMap.rejectComment != null">a.reject_comment= #{auditMap.rejectComment},</if>
- <if test="auditMap.status != null">a.STATUS= #{auditMap.status},</if>
- <if test="auditMap.authStatus != null">u.auth_status = #{auditMap.authStatus},</if>
- <if test="auditMap.certificationDate != null">u.passauth_time = #{auditMap.certificationDate},</if>
- <if test="auditMap.gmtModified !=null">u.gmt_modified=#{auditMap.gmtModified},</if>
- <if test="auditMap.modifier != null">u.modifier=#{auditMap.modifier}</if>
- </trim>
- WHERE
- a.is_deleted = "N"
- AND a.user_id = #{auditMap.userId}
- AND a.order_num = #{auditMap.orderNum}
- AND u.id = #{auditMap.userId}
- </update>
- <select id="dependentuserInfoByTime" parameterType="java.util.Map"
- resultType="com.diagbot.dto.UserInfoDTO">
- SELECT
- u.id AS userId,
- u.gmt_create AS userGmtCreate,
- u.passauth_time AS passauthTime,
- 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 orgParentId,
- org.sub_num as orgSub_num,
- u.position as position,
- u.auth_status as authStatus
- 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"
- <if test="userExport.orgName != null">
- AND org.name LIKE CONCAT('%', #{userExport.orgName}, '%')
- </if>
- <if test="userExport.userName != null">
- AND u.username LIKE CONCAT('%', #{userExport.userName}, '%')
- </if>
- <if test="userExport.authStatus != null">
- AND u.auth_status = #{userExport.authStatus}
- </if>
- <if test="userExport.startTime != null and userExport.endTime != null">
- AND u.gmt_create BETWEEN #{userExport.startTime} and #{userExport.endTime}
- </if>
- ORDER BY u.gmt_create DESC
- </select>
- <select id="queryUserInformation" resultType="com.diagbot.dto.UserAllDTO">
- 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.name AS orgName,
- u.auth_status AS authStatus
- 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
- <if test="userInformation.userName != null">
- AND u.username LIKE CONCAT('%', #{userInformation.userName}, '%')
- </if>
- <if test="userInformation.authStatus != null">
- AND u.auth_status = #{userInformation.authStatus}
- </if>
- <if test="userInformation.startTime != null and userInformation.endTime != null">
- AND u.gmt_create BETWEEN #{userInformation.startTime} and #{userInformation.endTime}
- </if>
- ORDER BY u.gmt_create DESC
- </select>
-
- <!-- <select id="queryMechanismInformation(jiude)" resultType="com.diagbot.dto.OrganizationDTO">
- SELECT
- u.id AS userId,
- u.linkman AS linkman,
- 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 orgParentId,
- org.sub_num AS orgSub_num
- 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="mechanism.orgName != null">
- AND org.name LIKE CONCAT('%', #{mechanism.orgName}, '%')
- </if>
- <if test="mechanism.authStatus != null">
- AND u.auth_status = #{mechanism.authStatus}
- </if>
- <if test="mechanism.startTime != null and mechanism.endTime != null">
- AND u.gmt_create BETWEEN #{mechanism.startTime} and #{mechanism.endTime}
- </if>
- ORDER BY u.gmt_create DESC
- </select> -->
- <select id="queryMechanismInformation" resultType="com.diagbot.dto.OrganizationDTO">
- SELECT
- u.id AS userId,
- org.id AS orgId,
- org.gmt_create AS orgGmtCreate,
- org.name AS orgName,
- org.principal AS orgPrincipal,
- org.type AS orgType,
- org.address AS orgAddress,
- u.linkman AS linkman,
- u.auth_status AS authStatus,
- org.parent_id AS orgParentId,
- org.sub_num AS orgSubNum
- FROM
- sys_organization org
- LEFT JOIN sys_user_organization uorg ON org.id = uorg.organization_id
- LEFT JOIN sys_user u ON uorg.user_id = u.id
- WHERE org.is_deleted = 'N'
- <if test="mechanism.orgName != null">
- AND org.name LIKE CONCAT('%', #{mechanism.orgName}, '%')
- </if>
- <if test="mechanism.authStatus != null">
- AND u.auth_status = #{mechanism.authStatus}
- </if>
- <if test="mechanism.startTime != null and mechanism.endTime != null">
- AND org.gmt_create BETWEEN #{mechanism.startTime} and #{mechanism.endTime}
- </if>
- ORDER BY org.gmt_create DESC
- </select>
-
- <select id="queryVerifiedUserOrganizationProduct" resultType="com.diagbot.dto.UserOrgizationProductDTO">
- 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 orgParentId,
- org.sub_num AS orgSubNum,
- u.passauth_time AS passauthTime,
- u.position AS position,
- u.auth_status AS authStatus
- 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
- <if test="userOrg.orgName != null">
- AND org.name LIKE CONCAT('%', #{userOrg.orgName}, '%')
- </if>
- <if test="userOrg.userName != null">
- AND u.username LIKE CONCAT('%', #{userOrg.userName}, '%')
- </if>
- <if test="userOrg.startTime != null and userOrg.endTime != null">
- AND u.gmt_create BETWEEN #{userOrg.startTime} and #{userOrg.endTime}
- </if>
- AND u.auth_status = 1
- ORDER BY u.passauth_time DESC
- </select>
- <select id="queryAuthentication" resultType="com.diagbot.dto.AuthenticationDTO">
- SELECT
- u.id AS userId,
- aut.gmt_create AS autGmtCreate,
- 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 orgParentId,
- org.sub_num AS orgSubNum,
- u.position AS position,
- u.auth_status AS authStatus,
- aut.order_num AS orderNum,
- aut.status AS status
- FROM sys_user_authentication aut
- JOIN sys_user u ON u.id = aut.user_id
- JOIN sys_user_organization uorg ON u.id = uorg.user_id
- JOIN sys_organization org ON uorg.organization_id = org.id
- WHERE u.is_deleted = 'N' AND aut.is_deleted = 'N' AND u.TYPE = 0
- <if test="authen.status != null">
- AND aut.status = #{authen.status}
- </if>
- <if test="authen.authStatus != null">
- AND u.auth_status= #{authen.authStatus}
- </if>
- <if test="authen.orgName != null">
- AND org.name LIKE CONCAT('%', #{authen.orgName}, '%')
- </if>
- <if test="authen.userName != null">
- AND u.username LIKE CONCAT('%', #{authen.userName}, '%')
- </if>
- <if test="authen.startTime != null and authen.endTime != null">
- AND aut.gmt_create BETWEEN #{authen.startTime} and #{authen.endTime}
- </if>
- ORDER BY aut.gmt_create DESC
- <!-- 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 orgParentId,
- org.sub_num AS orgSub_num, u.position AS autPosition, u.auth_status AS authStatus
- 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 <if test="authen.orgName != null"> AND org.name LIKE
- CONCAT('%', #{authen.orgName}, '%') </if> <if test="authen.userName != null">
- AND u.username LIKE CONCAT('%', #{authen.userName}, '%') </if> <if test="authen.startTime
- != null and authen.endTime != null"> AND u.gmt_create BETWEEN #{authen.startTime}
- and #{authen.endTime} </if> AND u.auth_status = 2 ORDER BY u.gmt_create DESC -->
- </select>
- <update id="updateUserInfo" parameterType="java.util.Map">
- UPDATE
- sys_user a
- <trim prefix="set" suffixOverrides=",">
- <if test="amendUserInfo.linkman != null">
- a.linkman = #{amendUserInfo.linkman},
- </if>
- <if test="amendUserInfo.email != null">
- a.email = #{amendUserInfo.email},
- </if>
- <if test="amendUserInfo.position != null">
- a.position = #{amendUserInfo.position},
- </if>
- <if test="amendUserInfo.gmtModified != null">
- a.gmt_modified =#{amendUserInfo.gmtModified},
- </if>
- <if test="amendUserInfo.modifier != null">
- a.modifier = #{amendUserInfo.modifier},
- </if>
- </trim>
- WHERE
- a.is_deleted = "N"
- AND a.id = #{amendUserInfo.userId}
- </update>
- <update id="updateOrganizations" parameterType="java.util.Map">
- UPDATE sys_organization a
- <trim prefix="set" suffixOverrides=",">
- <if test="amendOrg.address != null">
- a.address = #{amendOrg.address},
- </if>
- <if test="amendOrg.type != null">
- a.type = #{amendOrg.type},
- </if>
- <if test="amendOrg.orgSubNum != null">
- a.sub_num = #{amendOrg.orgSubNum},
- </if>
- <if test="amendOrg.gmtModified != null">
- a.gmt_modified =#{amendOrg.gmtModified},
- </if>
- <if test="amendOrg.modifier != null">
- a.modifier =#{amendOrg.modifier}
- </if>
- </trim>
- WHERE
- a.is_deleted = "N"
- AND a.id = #{amendOrg.orgId}
- </update>
- <select id="exportOrganizations" parameterType="java.util.Map"
- resultType="com.diagbot.dto.UserInfoDTO">
- SELECT
- u.id AS userId,
- org.id AS orgId,
- org.gmt_create AS orgGmtCreate,
- org.name AS orgName,
- org.principal AS orgPrincipal,
- org.type AS orgType,
- org.address AS orgAddress,
- u.linkman AS linkman,
- u.auth_status AS authStatus,
- org.parent_id AS orgParentId,
- org.sub_num AS orgSubNum
- FROM
- sys_organization org
- LEFT JOIN sys_user_organization uorg ON org.id = uorg.organization_id
- LEFT JOIN sys_user u ON uorg.user_id = u.id
- WHERE org.is_deleted = 'N'
- <if test="exportOrg.orgName != null">
- AND org.name LIKE CONCAT('%', #{exportOrg.orgName}, '%')
- </if>
- <if test="exportOrg.startTime != null and exportOrg.endTime != null">
- AND org.gmt_create BETWEEN #{exportOrg.startTime} and #{exportOrg.endTime}
- </if>
- ORDER BY org.gmt_create DESC
- </select>
- <select id="exportKema" resultType="com.diagbot.dto.AuthenticationDTO">
- SELECT
- u.id AS userId,
- aut.gmt_create AS autGmtCreate,
- 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 orgParentId,
- org.sub_num AS orgSubNum,
- u.position AS position,
- u.auth_status AS authStatus,
- aut.order_num AS orderNum,
- aut.status AS status
- FROM sys_user_authentication aut
- JOIN sys_user u ON u.id = aut.user_id
- JOIN sys_user_organization uorg ON u.id = uorg.user_id
- JOIN sys_organization org ON uorg.organization_id = org.id
- WHERE u.is_deleted = 'N' AND aut.is_deleted = 'N' AND u.TYPE = 0
- <if test="exportKema.status != null">
- AND aut.status = #{exportKema.status}
- </if>
- <if test="exportKema.authStatus != null">
- AND u.auth_status= #{exportKema.authStatus}
- </if>
- <if test="exportKema.orgName != null">
- AND org.name LIKE CONCAT('%', #{exportKema.orgName}, '%')
- </if>
- <if test="exportKema.userName != null">
- AND u.username LIKE CONCAT('%', #{exportKema.userName}, '%')
- </if>
- <if test="exportKema.startTime != null and exportKema.endTime != null">
- AND aut.gmt_create BETWEEN #{exportKema.startTime} and #{exportKema.endTime}
- </if>
- ORDER BY aut.gmt_create DESC
- </select>
- <select id="exportVerified" 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 orgParentId,
- org.sub_num AS orgSubNum,
- u.passauth_time AS passauthTime,
- u.position AS position,
- u.auth_status AS authStatus
- 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
- <if test="Verified.orgName != null">
- AND org.name LIKE CONCAT('%', #{Verified.orgName}, '%')
- </if>
- <if test="Verified.userName != null">
- AND u.username LIKE CONCAT('%', #{Verified.userName}, '%')
- </if>
- <if test="Verified.startTime != null and Verified.endTime != null">
- AND u.gmt_create BETWEEN #{Verified.startTime} and #{Verified.endTime}
- </if>
- AND u.auth_status = 1
- ORDER BY u.passauth_time DESC
- </select>
- </mapper>
|