mosty-common/common-core-starter/target/classes/mapper/SysUserMapper.xml
2024-07-17 21:04:17 +08:00

208 lines
8.9 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.mosty.common.core.business.mapper.SysUserMapper">
<resultMap id="BaseResultMap" type="com.mosty.common.core.business.entity.SysUser">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="managerOrgId" column="manager_org_id" jdbcType="BIGINT"/>
<result property="managerOrgName" column="manager_org_name" jdbcType="VARCHAR"/>
<result property="positionId" column="position_id" jdbcType="BIGINT"/>
<result property="positionName" column="position_name" jdbcType="VARCHAR"/>
<result property="isVirtualUser" column="is_virtual_user" jdbcType="VARCHAR"/>
<result property="loginName" column="login_name" jdbcType="VARCHAR"/>
<result property="password" column="password" jdbcType="VARCHAR"/>
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
<result property="userType" column="user_type" jdbcType="VARCHAR"/>
<result property="email" column="email" jdbcType="VARCHAR"/>
<result property="mobile" column="mobile" jdbcType="VARCHAR"/>
<result property="telePhone" column="tele_phone" jdbcType="VARCHAR"/>
<result property="idEntityCard" column="id_entity_card" jdbcType="VARCHAR"/>
<result property="inDustRialId" column="in_dust_rial_id" jdbcType="VARCHAR"/>
<result property="sex" column="sex" jdbcType="VARCHAR"/>
<result property="nation" column="nation" jdbcType="INTEGER"/>
<result property="politic" column="politic" jdbcType="VARCHAR"/>
<result property="marital" column="marital" jdbcType="VARCHAR"/>
<result property="type" column="type" jdbcType="VARCHAR"/>
<result property="whcd" column="whcd" jdbcType="VARCHAR"/>
<result property="bz" column="bz" jdbcType="VARCHAR"/>
<result property="birthday" column="birthday" jdbcType="VARCHAR"/>
<result property="beginTime" column="begin_time" jdbcType="TIMESTAMP"/>
<result property="endTime" column="end_time" jdbcType="TIMESTAMP"/>
<result property="salt" column="salt" jdbcType="VARCHAR"/>
<result property="xtZxbz" column="xt_zxbz" jdbcType="INTEGER"/>
<result property="xtZxyz" column="xt_zxyz" jdbcType="VARCHAR"/>
<result property="xtCjsj" column="xt_cjsj" jdbcType="TIMESTAMP"/>
<result property="xtLrsj" column="xt_lrsj" jdbcType="TIMESTAMP"/>
<result property="xtLrrxm" column="xt_lrrxm" jdbcType="VARCHAR"/>
<result property="xtLrrid" column="xt_lrrid" jdbcType="BIGINT"/>
<result property="xtLrrbm" column="xt_lrrbm" jdbcType="VARCHAR"/>
<result property="xtLrrbmid" column="xt_lrrbmid" jdbcType="VARCHAR"/>
<result property="xtLrip" column="xt_lrip" jdbcType="VARCHAR"/>
<result property="xtZhxgsj" column="xt_zhxgsj" jdbcType="TIMESTAMP"/>
<result property="xtZhxgrxm" column="xt_zhxgrxm" jdbcType="VARCHAR"/>
<result property="xtZhxgid" column="xt_zhxgid" jdbcType="BIGINT"/>
<result property="xtZhxgrbm" column="xt_zhxgrbm" jdbcType="VARCHAR"/>
<result property="xtZhxgrbmid" column="xt_zhxgrbmid" jdbcType="BIGINT"/>
<result property="xtZhxgrip" column="xt_zhxgrip" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id,manager_org_id,manager_org_name,
position_id,position_name,is_virtual_user,login_name,
password,user_name,user_type,
email,mobile,tele_phone,
id_entity_card,in_dust_rial_id,sex,
nation,politic, marital, type, whcd,bz,
birthday,begin_time,end_time,
salt,xt_zxbz,xt_zxyz,
xt_cjsj,xt_lrsj,xt_lrrxm,
xt_lrrid,xt_lrrbm,xt_lrrbmid,
xt_lrip,xt_zhxgsj,xt_zhxgrxm,
xt_zhxgid,xt_zhxgrbm,xt_zhxgrbmid,
xt_zhxgrip
</sql>
<select id="selectByCount" resultType="int">
SELECT
count(DISTINCT a.id)
FROM
sys_user a
INNER JOIN sys_user_dept b ON a.id = b.user_id
INNER JOIN sys_dept c ON b.dept_id = c.id
where
a.xt_zxbz = 0
<if test="userPage.deptId != null and userPage.deptId != '' ">
and b.dept_id in (${userPage.deptId})
</if>
<if test="userPage.phone != null and userPage.phone != '' ">
and a.mobile = #{userPage.phone}
</if>
<if test="userPage.loginName != null and userPage.loginName != '' ">
and (
a.login_name like concat('%', #{userPage.loginName}, '%')
or a.user_name like concat('%', #{userPage.loginName}, '%')
)
</if>
</select>
<select id="selectByPage" resultType="com.mosty.common.core.business.entity.vo.SysUserVO">
SELECT
DISTINCT
a.id,
a.position_id,
a.position_name,
a.login_name,
a.user_name,
a.mobile,
a.tele_phone,
a.sex,
a.xt_lrsj,
a.in_dust_rial_id,
a.id_entity_card,
a.politic,
a.marital,
a.type,
c.id as deptId,
c.org_code as deptCode,
c.org_name as deptName
FROM
sys_user a
INNER JOIN sys_user_dept b ON a.id = b.user_id
INNER JOIN sys_dept c ON b.dept_id = c.id
where
a.xt_zxbz = 0
<if test="userPage.orgcode != null and userPage.orgcode != '' ">
and c.org_code like concat(#{userPage.orgcode},'%')
</if>
<if test="userPage.phone != null and userPage.phone != '' ">
and a.mobile = #{userPage.phone}
</if>
<if test="userPage.loginName != null and userPage.loginName != '' ">
and (
a.login_name like concat('%', #{userPage.loginName}, '%')
or a.user_name like concat('%', #{userPage.loginName}, '%')
)
</if>
<if test="userPage.idEntityCard != null and userPage.idEntityCard !=''">
and a.id_entity_card like concat('%',#{userPage.idEntityCard},'%')
</if>
<if test="userPage.inDustRialId != null and userPage.inDustRialId !=''">
and a.in_dust_rial_id like concat('%',#{userPage.inDustRialId},'%')
</if>
</select>
<select id="selectUserDeptPage" resultType="com.mosty.common.core.business.entity.vo.SysUserDeptVO"
parameterType="com.mosty.common.core.business.entity.vo.UserDeptPage">
SELECT
a.id,
a.position_id as positionId,
a.position_name as positionName,
a.login_name as loginName,
a.user_name as userName,
a.mobile as mobile,
a.whcd as whcd,
a.in_dust_rial_id as inDustRialId,
a.tele_phone as telePhone,
a.sex as sex,
a.nation as nation,
a.id_entity_card as idEntityCard,
a.xt_lrsj as xtLrsj,
a.politic as politic,
a.marital as marital,
a.type as type,
c.id as deptId,
c.org_name as deptName
FROM
sys_user a
INNER JOIN sys_user_dept b ON a.id = b.user_id
inner join sys_dept c on b.dept_id = c.id
where
a.xt_zxbz = 0
<if test="userDeptPage.orgcode != null and userDeptPage.orgcode != '' ">
and c.org_code like concat(#{userDeptPage.orgcode},'%')
</if>
<if test="userDeptPage.deptName != null and userDeptPage.deptName != '' ">
and c.org_name like concat('%', #{userDeptPage.deptName}, '%')
</if>
<if test="userDeptPage.phone != null and userDeptPage.phone != '' ">
and a.mobile like concat('%',#{userDeptPage.phone}, '%')
</if>
<if test="userDeptPage.loginName != null and userDeptPage.loginName != '' ">
and a.login_name like concat('%', #{userDeptPage.loginName}, '%')
</if>
</select>
<select id="getUserListByDeptId" resultMap="BaseResultMap">
select a.* from sys_user a ,sys_dept b,sys_user_dept c where a.id = c.user_id
and a.xt_zxbz = '0' and b.xt_zxbz = '0'
<if test="keyword != null and keyword != ''">
and (a.user_name like concat('%',#{keyword},'%')
or a.login_name like concat('%',#{keyword},'%'))
</if>
and c.dept_id = b.id and a.is_virtual_user = '02' and b.id in
<foreach collection="deptIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="getUserListByDeptIdOne" resultMap="BaseResultMap">
select a.*
from sys_user a,
sys_dept b,
sys_user_dept c
where a.id = c.user_id
and a.xt_zxbz = '0'
and b.xt_zxbz = '0'
and c.dept_id = b.id
and a.is_virtual_user = '02'
and b.id = #{id}
</select>
<delete id="delById">
delete from sys_user where id = #{id}
</delete>
</mapper>