196 lines
9.0 KiB
XML
196 lines
9.0 KiB
XML
<?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.adc.da.slrs.sarUser.dao.TsUserDao">
|
|
<resultMap id="UserPosition" type="com.adc.da.slrs.sarUser.entity.TsUser">
|
|
<id property="userId" column="usid"/>
|
|
<result property="account" column="account"/>
|
|
<result property="uname" column="uname"/>
|
|
<result property="sex" column="sex"/>
|
|
<result property="userSource" column="user_source"/>
|
|
<result property="phone" column="phone"/>
|
|
<result property="state" column="state"/>
|
|
<result property="email" column="email"/>
|
|
<result property="institutionName" column="institution_name"/>
|
|
<result property="institutionId" column="institution_id"/>
|
|
<result property="workNum" column="work_num"/>
|
|
<result property="extInfo" column="ext_info"/>
|
|
<result property="operUser" column="oper_user"/>
|
|
<result property="creationTime" column="creation_time"/>
|
|
<result property="modifyTime" column="modify_time"/>
|
|
<result property="validFlag" column="valid_flag"/>
|
|
<result property="disableFlag" column="disable_flag"/>
|
|
<result property="unlockFlag" column="unlock_flag"/>
|
|
<result property="userType" column="user_type"/>
|
|
<result property="ssoId" column="sso_id"/>
|
|
<result property="sysPositionIds" column="sys_position_ids"/>
|
|
<collection property="positions" ofType="com.adc.da.slrs.sarPosition.entity.TsPosition">
|
|
<result property="id" column="p_id"/>
|
|
<result property="name" column="p_name"/>
|
|
</collection>
|
|
</resultMap>
|
|
|
|
<select id="getUserAndPositionPage" parameterType="com.adc.da.slrs.sarUser.entity.TsUser" resultMap="UserPosition">
|
|
select u.*,p.id p_id,p.name p_name from ts_user u
|
|
left join ts_user_position up
|
|
on u.usid=up.user_id
|
|
left join ts_position p
|
|
on up.position_id=p.id
|
|
where 1=1
|
|
<if test="TsUser.institutionId !=null and TsUser.institutionId!=''">
|
|
and u.institution_id=#{TsUser.institutionId}
|
|
</if>
|
|
|
|
<if test="TsUser.uname != null and TsUser.uname != '' ">
|
|
and u.uname like concat('%',#{TsUser.uname},'%')
|
|
</if>
|
|
<if test="TsUser.email != null and TsUser.email != '' ">
|
|
and u.email like concat('%',#{TsUser.email},'%')
|
|
</if>
|
|
limit #{start},#{end}
|
|
</select>
|
|
|
|
<select id="getUserUnderInstitutionAll" resultMap="UserPosition">
|
|
select u.USID,u.ACCOUNT,u.PASSWORD,u.OPER_USER,u.UNAME,u.SEX,u.USER_SOURCE,u.PHONE,u.EMAIL,u.INSTITUTION_NAME,u.INSTITUTION_ID
|
|
,u.POSITION_NAME,u.STATE,u.POSITION_ID,u.WORK_NUM,u.EXT_INFO,u.CREATION_TIME,u.MODIFY_TIME,u.VALID_FLAG
|
|
,u.DISABLE_FLAG,u.UNLOCK_FLAG,u.USER_TYPE,u.SSO_ID,u.SYS_POSITION_IDS
|
|
from ts_user u
|
|
where 1=1
|
|
<if test=" null != ids and ids.size()> 0">
|
|
and INSTITUTION_ID in
|
|
<foreach item="id" collection="ids" open="(" separator="," close=")" index="index">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
<if test=" null != ids and ids.size()> 0">
|
|
order by field(INSTITUTION_ID,
|
|
<foreach item="id" collection="ids" open="" separator="," close="" index="index">
|
|
#{id}
|
|
</foreach>)
|
|
</if>
|
|
</select>
|
|
|
|
|
|
<select id="userUnderInstitution" parameterType="com.adc.da.slrs.sarUser.entity.TsUser" resultMap="UserPosition">
|
|
select u.USID,u.ACCOUNT,u.PASSWORD,u.OPER_USER,u.UNAME,u.SEX,u.USER_SOURCE,u.PHONE,u.EMAIL,u.INSTITUTION_NAME,u.INSTITUTION_ID
|
|
,u.POSITION_NAME,u.STATE,u.POSITION_ID,u.WORK_NUM,u.EXT_INFO,u.CREATION_TIME,u.MODIFY_TIME,u.VALID_FLAG
|
|
,u.DISABLE_FLAG,u.UNLOCK_FLAG,u.USER_TYPE,u.SSO_ID,u.SYS_POSITION_IDS from ts_user u
|
|
where 1=1
|
|
<if test="TsUser.uname != null and TsUser.uname != '' ">
|
|
and (u.uname like concat('%',#{TsUser.uname},'%') or u.ACCOUNT like concat(#{TsUser.uname},'%'))
|
|
</if>
|
|
<if test="TsUser.email != null and TsUser.email != '' ">
|
|
and u.email like concat('%',#{TsUser.email},'%')
|
|
</if>
|
|
<if test=" null != ids and ids.size()> 0">
|
|
and u.INSTITUTION_ID in
|
|
<foreach item="id" collection="ids" open="(" separator="," close=")" index="index">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
ORDER BY u.SYS_POSITION_IDS is null,u.USID
|
|
limit #{start},#{end}
|
|
</select>
|
|
|
|
<select id="userUnderInstitutionCount" resultType="java.lang.Integer">
|
|
select count(u.USID) from ts_user u
|
|
where 1=1
|
|
<if test="TsUser.uname != null and TsUser.uname != '' ">
|
|
and u.uname like concat('%',#{TsUser.uname},'%')
|
|
</if>
|
|
<if test="TsUser.email != null and TsUser.email != '' ">
|
|
and u.email like concat('%',#{TsUser.email},'%')
|
|
</if>
|
|
<if test=" null != ids and ids.size()> 0">
|
|
and u.INSTITUTION_ID in
|
|
<foreach item="id" collection="ids" open="(" separator="," close=")" index="index">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getUserAndPositionCount" parameterType="com.adc.da.slrs.sarUser.entity.TsUser" resultType="java.lang.Integer">
|
|
select count(u.USID) from ts_user u
|
|
where 1=1
|
|
<if test="TsUser.institutionId != null and TsUser.institutionId != '' ">
|
|
and u.institution_id=#{TsUser.institutionId}
|
|
</if>
|
|
<if test="TsUser.uname != null and TsUser.uname != '' ">
|
|
and u.uname like concat('%',#{TsUser.uname},'%')
|
|
</if>
|
|
<if test="TsUser.email != null and TsUser.email != '' ">
|
|
and u.email like concat('%',#{TsUser.email},'%')
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getUserIdsByPositionIds" resultType="String">
|
|
select user_id from ts_user_position
|
|
where position_id in
|
|
(
|
|
<foreach collection="list" item="positionId" separator=",">
|
|
#{positionId}
|
|
</foreach>
|
|
)
|
|
</select>
|
|
|
|
<select id="selectDeptByDY" resultMap="UserPosition">
|
|
select ts_user.USID,ts_user.INSTITUTION_ID,
|
|
concat(
|
|
t3.`name`,
|
|
concat(
|
|
'_',
|
|
concat(
|
|
t2.`name`,
|
|
concat( '_', t1.`name` )))) as institution_name from ts_user
|
|
left join ts_institution t1 on t1.id=ts_user.INSTITUTION_ID
|
|
LEFT JOIN ts_institution t2 ON t1.parent_id = t2.id
|
|
LEFT JOIN ts_institution t3 ON t2.parent_id = t3.id
|
|
where ts_user.USID in
|
|
<foreach item="msgId" collection="list" open="(" separator="," close=")" index="index">
|
|
#{msgId}
|
|
</foreach>
|
|
</select>
|
|
<select id="selectUserByRole" resultType="java.lang.Integer">
|
|
SELECT count(ts_user.USID) from ts_user
|
|
left join ts_institution on ts_institution.id=ts_user.INSTITUTION_ID
|
|
LEFT JOIN ts_user_role on ts_user.USID = ts_user_role.user_id
|
|
WHERE ts_user_role.role_id in (
|
|
SELECT ts_user_role.role_id from ts_user_role
|
|
WHERE ts_user_role.role_id = #{role.roleId} ) and ts_user.DISABLE_FLAG = '0'
|
|
<if test="null != role.userId and role.userId != ''">
|
|
and ts_user.USID like concat(concat('%',#{role.userId}),'%')
|
|
</if>
|
|
<if test="null != role.userName and role.userName != ''">
|
|
and ts_user.UNAME like concat(concat('%',#{role.userName}),'%')
|
|
</if>
|
|
<if test="null != role.institutionName and role.institutionName != ''">
|
|
and ts_institution.name like concat(concat('%',#{role.institutionName}),'%')
|
|
</if>
|
|
<if test="null != role.institutionId and role.institutionId != ''">
|
|
and ts_user.INSTITUTION_ID = #{role.institutionId}
|
|
</if>
|
|
|
|
</select>
|
|
|
|
<select id="selectUserByRoleByPage" resultMap="UserPosition">
|
|
SELECT ts_user.UNAME,ts_user.USID,ts_user.INSTITUTION_ID , ts_institution.name as institution_name from ts_user
|
|
left join ts_institution on ts_institution.id=ts_user.INSTITUTION_ID
|
|
LEFT JOIN ts_user_role on ts_user.USID = ts_user_role.user_id
|
|
WHERE ts_user_role.role_id in (
|
|
SELECT ts_user_role.role_id from ts_user_role
|
|
WHERE ts_user_role.role_id = #{role.roleId} ) and ts_user.DISABLE_FLAG = '0'
|
|
<if test="null != role.userId and role.userId != ''">
|
|
and ts_user.USID like concat(concat('%',#{role.userId}),'%')
|
|
</if>
|
|
<if test="null != role.userName and role.userName != ''">
|
|
and ts_user.UNAME like concat(concat('%',#{role.userName}),'%')
|
|
</if>
|
|
<if test="null != role.institutionName and role.institutionName != ''">
|
|
and ts_institution.name like concat(concat('%',#{role.institutionName}),'%')
|
|
</if>
|
|
<if test="null != role.institutionId and role.institutionId != ''">
|
|
and ts_user.INSTITUTION_ID = #{role.institutionId}
|
|
</if>
|
|
limit ${(role.pageNumber - 1) * role.pageSize},${role.pageSize}
|
|
</select>
|
|
</mapper>
|