1448 lines
40 KiB
XML
1448 lines
40 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.zcloud.mapper.datasource.system.UsersMapper">
|
||
|
||
<resultMap type="User" id="userAndRoleResultMap">
|
||
<id column="USER_ID" property="USER_ID"/>
|
||
<result column="USERNAME" property="USERNAME"/>
|
||
<result column="PASSWORD" property="PASSWORD"/>
|
||
<result column="NAME" property="NAME"/>
|
||
<result column="LAST_LOGIN" property="LAST_LOGIN"/>
|
||
<result column="IP" property="IP"/>
|
||
<result column="STATUS" property="STATUS"/>
|
||
<result column="SKIN" property="SKIN"/>
|
||
<result column="ROLE_IDS" property="ROLE_IDS"/>
|
||
<result column="PERSON_TYPE" property="PERSON_TYPE" />
|
||
<association property="role" column="ROLE_ID" javaType="Role">
|
||
<id column="ROLE_ID" property="ROLE_ID"/>
|
||
<result column="ROLE_NAME" property="ROLE_NAME"/>
|
||
<result column="ROLE_RIGHTS" property="RIGHTS"/>
|
||
<result column="ADD_QX" property="ADD_QX"/>
|
||
<result column="DEL_QX" property="DEL_QX"/>
|
||
<result column="EDIT_QX" property="EDIT_QX"/>
|
||
<result column="CHA_QX" property="CHA_QX"/>
|
||
</association>
|
||
</resultMap>
|
||
<resultMap type="User" id="userResultMap">
|
||
<id column="USER_ID" property="USER_ID"/>
|
||
<result column="USERNAME" property="USERNAME"/>
|
||
<result column="PASSWORD" property="PASSWORD"/>
|
||
<result column="NAME" property="NAME"/>
|
||
<result column="LAST_LOGIN" property="LAST_LOGIN"/>
|
||
<result column="IP" property="IP"/>
|
||
<result column="STATUS" property="STATUS"/>
|
||
<result column="ROLE_ID" property="ROLE_ID"/>
|
||
<result column="PERSON_TYPE" property="PERSON_TYPE" />
|
||
<result column="SKIN" property="SKIN"/>
|
||
<result column="ROLE_IDS" property="ROLE_IDS"/>
|
||
</resultMap>
|
||
|
||
<resultMap type="Role" id="roleResultMap">
|
||
<id column="ROLE_ID" property="ROLE_ID" />
|
||
<result column="ROLE_NAME" property="ROLE_NAME" />
|
||
<result column="RIGHTS" property="RIGHTS" />
|
||
</resultMap>
|
||
<!--用户表名 -->
|
||
<sql id="tableName">
|
||
SYS_USER
|
||
</sql>
|
||
|
||
<!--角色表名 -->
|
||
<sql id="roleTableName">
|
||
SYS_ROLE
|
||
</sql>
|
||
|
||
<!-- 字段 -->
|
||
<sql id="Field">
|
||
USER_ID,
|
||
USERNAME,
|
||
PASSWORD,
|
||
NAME,
|
||
ROLE_ID,
|
||
LAST_LOGIN,
|
||
IP,
|
||
STATUS,
|
||
BZ,
|
||
SKIN,
|
||
EMAIL,
|
||
NUMBER,
|
||
PHONE,
|
||
ROLE_IDS,
|
||
DEPARTMENT_ID,
|
||
POST_ID,
|
||
ISMAIN,
|
||
<!-- CORPINFO_ID, -->
|
||
<!-- BASICINFO_ID, -->
|
||
FUN_IDS,
|
||
SORT,
|
||
PERSON_TYPE,
|
||
IS_HAZARDCONFIRMER,
|
||
IS_ONLINELEARNING,
|
||
LEARNERCATEGORY,
|
||
USERAVATARPREFIX,
|
||
USERAVATARURL,
|
||
SHIFTDUTYONE,
|
||
SHIFTDUTYTWO,
|
||
DURATION,
|
||
WORKSTATUS,
|
||
WORKPERIOD,
|
||
JCR,
|
||
CORPINFO_ID,
|
||
CARDNO,
|
||
MKMJCARD,
|
||
ISDELETE
|
||
</sql>
|
||
<!-- 字段 -->
|
||
<sql id="Fieldf">
|
||
f.USER_ID,
|
||
f.USERNAME,
|
||
f.PASSWORD,
|
||
f.NAME,
|
||
f.ROLE_ID,
|
||
f.LAST_LOGIN,
|
||
f.ERROR_COUNT,
|
||
f.IP,
|
||
f.STATUS,
|
||
f.BZ,
|
||
f.SKIN,
|
||
f.EMAIL,
|
||
f.NUMBER,
|
||
f.PHONE,
|
||
f.ROLE_IDS,
|
||
f.DEPARTMENT_ID,
|
||
f.POST_ID,
|
||
f.ISMAIN,
|
||
<!-- CORPINFO_ID, -->
|
||
<!-- BASICINFO_ID, -->
|
||
f.FUN_IDS,
|
||
f.SORT,
|
||
f.PERSON_TYPE,
|
||
f.IS_HAZARDCONFIRMER,
|
||
f.IS_ONLINELEARNING,
|
||
f.LEARNERCATEGORY,
|
||
f.USERAVATARPREFIX,
|
||
f.USERAVATARURL,
|
||
f.SHIFTDUTYONE,
|
||
f.SHIFTDUTYTWO,
|
||
f.DURATION,
|
||
f.WORKSTATUS,
|
||
f.WORKPERIOD,
|
||
f.JCR,
|
||
f.CORPINFO_ID,
|
||
f.CARDNO,
|
||
f.MKMJCARD,
|
||
f.ISDELETE
|
||
</sql>
|
||
<!-- 字段值 -->
|
||
<sql id="FieldValue">
|
||
#{USER_ID},
|
||
#{USERNAME},
|
||
#{PASSWORD},
|
||
#{NAME},
|
||
#{ROLE_ID},
|
||
#{LAST_LOGIN},
|
||
#{IP},
|
||
#{STATUS},
|
||
#{BZ},
|
||
#{SKIN},
|
||
#{EMAIL},
|
||
#{NUMBER},
|
||
#{PHONE},
|
||
#{ROLE_IDS},
|
||
#{DEPARTMENT_ID},
|
||
#{POST_ID},
|
||
#{ISMAIN},
|
||
#{FUN_IDS},
|
||
#{SORT},
|
||
#{PERSON_TYPE},
|
||
#{IS_HAZARDCONFIRMER},
|
||
#{IS_ONLINELEARNING},
|
||
#{LEARNERCATEGORY},
|
||
#{USERAVATARPREFIX},
|
||
#{USERAVATARURL},
|
||
#{SHIFTDUTYONE},
|
||
#{SHIFTDUTYTWO},
|
||
#{DURATION},
|
||
#{WORKSTATUS},
|
||
#{WORKPERIOD},
|
||
#{JCR},
|
||
#{CORPINFO_ID},
|
||
#{CARDNO},
|
||
#{MKMJCARD},
|
||
#{ISDELETE}
|
||
</sql>
|
||
|
||
<!-- 用户列表(全部) -->
|
||
<select id="listUserAndDept" parameterType="pd" resultType="pd">
|
||
select u.USER_ID,
|
||
u.USERNAME,
|
||
u.PASSWORD,
|
||
u.LAST_LOGIN,
|
||
u.NAME,
|
||
u.IP,
|
||
u.EMAIL,
|
||
u.NUMBER,
|
||
u.PHONE,
|
||
u.DEPARTMENT_ID,
|
||
d.NAME as deptName
|
||
from <include refid="tableName"></include> u
|
||
left join oa_department d on d.DEPARTMENT_ID=u.DEPARTMENT_ID
|
||
where 1=1
|
||
and u.DEPARTMENT_ID is not null and u.DEPARTMENT_ID !='0'
|
||
<if test="userIds != null">
|
||
and u.USER_ID in
|
||
<foreach item="item" index="index" collection="userIds" open="(" separator="," close=")">
|
||
#{item}
|
||
</foreach>
|
||
</if>
|
||
<if test="corpinfoId != null and corpinfoId != ''"><!-- -->
|
||
AND u.CORPINFO_ID = #{corpinfoId}
|
||
</if>
|
||
|
||
<if test="userName!= null and userName != ''"><!-- 关键词检索 -->
|
||
and
|
||
(
|
||
u.USERNAME LIKE CONCAT(CONCAT('%', #{userName}),'%')
|
||
or
|
||
u.NUMBER LIKE CONCAT(CONCAT('%', #{userName}),'%')
|
||
or
|
||
u.NAME LIKE CONCAT(CONCAT('%', #{userName}),'%')
|
||
or
|
||
u.PHONE LIKE CONCAT(CONCAT('%', #{userName}),'%')
|
||
)
|
||
</if>
|
||
<if test="deptId != null and deptId != ''"><!-- -->
|
||
AND u.DEPARTMENT_ID = #{deptId}
|
||
</if>
|
||
order by u.LAST_LOGIN desc
|
||
</select>
|
||
<!-- 通过角色ID数组获取角色列表 -->
|
||
<select id="listAllRolesByArryROLE_ID" parameterType="String" resultType="Role" >
|
||
select
|
||
RNUMBER
|
||
from
|
||
SYS_ROLE
|
||
where
|
||
ROLE_ID in
|
||
<foreach item="item" index="index" collection="array" open="(" separator="," close=")">
|
||
#{item}
|
||
</foreach>
|
||
</select>
|
||
|
||
<select id="findLevelByUserId" parameterType="String" resultType="pd">
|
||
select LEVEL from
|
||
<include refid="tableName"></include> su
|
||
left join `sys_role` sr on sr.ROLE_ID = su.ROLE_ID
|
||
where USER_ID=#{USER_ID}
|
||
</select>
|
||
|
||
<!-- 列出此组下的角色 -->
|
||
<select id="listAllRolesByPId" resultMap="roleResultMap">
|
||
select
|
||
*
|
||
from
|
||
SYS_ROLE
|
||
where
|
||
PARENT_ID = #{ROLE_ID}
|
||
ORDER BY RNUMBER
|
||
</select>
|
||
|
||
<!-- 通过USERNAME获取数据 -->
|
||
<select id="findByUsername" parameterType="pd" resultType="pd" >
|
||
select
|
||
<include refid="Fieldf"></include> ,f.USER_IDENTITY,dept.name as deptName
|
||
from
|
||
<include refid="tableName"></include> f
|
||
LEFT JOIN OA_DEPARTMENT dept on f.DEPARTMENT_ID = dept.DEPARTMENT_ID
|
||
where
|
||
USERNAME = #{USERNAME} and ISDELETE='0'
|
||
<if test="VERIFYUSER_ID != null and VERIFYUSER_ID != ''">
|
||
and USER_ID != #{VERIFYUSER_ID}
|
||
</if>
|
||
</select>
|
||
<select id="findByName" parameterType="pd" resultType="pd" >
|
||
select
|
||
<include refid="Field"></include>
|
||
from
|
||
<include refid="tableName"></include>
|
||
where
|
||
NAME = #{NAME} AND CORPINFO_ID = #{CORPINFO_ID}
|
||
</select>
|
||
<!-- 通过用户ID获取数据 -->
|
||
<select id="findById" parameterType="pd" resultType="pd" >
|
||
select
|
||
CONVERT (f.USERAVATARURL USING utf8) AS USERAVATARURL_CONVERT,
|
||
<include refid="Fieldf"></include>,
|
||
dicsex.NAME as sexName,
|
||
dept.NAME as deptName,
|
||
post.NAME as postName,
|
||
dicRer.NAME as personnelTypeName,
|
||
dicWork.NAME as typeOfWorkName,
|
||
info.ENTRY_DATE
|
||
from
|
||
<include refid="tableName"></include>f
|
||
left join SYS_USERINFO info on info.USER_ID = f.USER_ID
|
||
left join sys_dictionaries dicsex on dicsex.DICTIONARIES_ID = info.SEX
|
||
left join oa_department dept on dept.DEPARTMENT_ID = f.DEPARTMENT_ID
|
||
left join sys_post post on post.POST_ID = f.POST_ID
|
||
left join sys_dictionaries dicRer on dicRer.DICTIONARIES_ID = info.PERSONNEL_TYPE
|
||
left join sys_dictionaries_corp dicWork on dicWork.DICTIONARIES_ID = info.TYPE_OF_WORK
|
||
where
|
||
f.USER_ID = #{USER_ID}
|
||
</select>
|
||
<!-- 通过用户ID获取数据 -->
|
||
<select id="findPolice" parameterType="pd" resultType="pd" >
|
||
select
|
||
select
|
||
CONVERT (f.USERAVATARURL USING utf8) AS USERAVATARURL_CONVERT,
|
||
<include refid="Fieldf"></include>,
|
||
dicsex.NAME as sexName,
|
||
dept.NAME as deptName,
|
||
post.NAME as postName,
|
||
dicRer.NAME as personnelTypeName,
|
||
dicWork.NAME as typeOfWorkName,
|
||
info.ENTRY_DATE
|
||
from
|
||
<include refid="tableName"></include>f
|
||
left join SYS_USERINFO info on info.USER_ID = f.USER_ID
|
||
left join sys_dictionaries dicsex on dicsex.DICTIONARIES_ID = info.SEX
|
||
left join oa_department dept on dept.DEPARTMENT_ID = f.DEPARTMENT_ID
|
||
left join sys_post post on post.POST_ID = f.POST_ID
|
||
left join sys_dictionaries dicRer on dicRer.DICTIONARIES_ID = info.PERSONNEL_TYPE
|
||
left join sys_dictionaries_corp dicWork on dicWork.DICTIONARIES_ID = info.TYPE_OF_WORK
|
||
where
|
||
f.USER_ID = #{USER_ID}
|
||
</select>
|
||
<!-- 通过邮箱获取数据 -->
|
||
<select id="findByEmail" parameterType="pd" resultType="pd" >
|
||
select
|
||
<include refid="Field"></include>
|
||
from
|
||
<include refid="tableName"></include>
|
||
where
|
||
EMAIL = #{EMAIL}
|
||
<if test="USERNAME != null and USERNAME != ''">
|
||
and USERNAME != #{USERNAME}
|
||
</if>
|
||
</select>
|
||
|
||
<!-- 通过编码获取数据 -->
|
||
<select id="findByNumbe" parameterType="pd" resultType="pd" >
|
||
select
|
||
<include refid="Field"></include>
|
||
from
|
||
<include refid="tableName"></include>
|
||
where
|
||
NUMBER = #{NUMBER}
|
||
<if test="USERNAME != null and USERNAME != ''">
|
||
and USERNAME != #{USERNAME}
|
||
</if>
|
||
</select>
|
||
|
||
<!-- 通过部门ID查询用户名和所属企业 -->
|
||
<select id="findByDeptName" parameterType="String" resultType="pd">
|
||
select
|
||
oa.NAME as DEPTNAME,f.NAME,f.CORPINFO_ID
|
||
from
|
||
`qa-gwj-prevention`.sys_user f
|
||
left join `qa-gwj-prevention`.oa_department oa on oa.DEPARTMENT_ID = f.DEPARTMENT_ID
|
||
where
|
||
USER_ID = #{USER_ID}
|
||
|
||
</select>
|
||
|
||
<!-- 列出某角色下的所有用户 -->
|
||
<select id="listAllUserByRoldId" parameterType="pd" resultType="pd" >
|
||
select USER_ID
|
||
from
|
||
<include refid="tableName"></include>
|
||
where
|
||
ROLE_ID = #{ROLE_ID}
|
||
</select>
|
||
|
||
<!-- 新增用户 -->
|
||
<insert id="saveUser" parameterType="pd" >
|
||
insert into <include refid="tableName"></include> (
|
||
<include refid="Field"></include>
|
||
) values (
|
||
<include refid="FieldValue"></include>
|
||
)
|
||
</insert>
|
||
|
||
<!-- 修改 -->
|
||
<update id="editUser" parameterType="pd" >
|
||
update <include refid="tableName"></include>
|
||
set NAME = #{NAME},
|
||
DEPARTMENT_ID = #{DEPARTMENT_ID},
|
||
POST_ID =#{POST_ID},
|
||
ROLE_ID = #{ROLE_ID},
|
||
ROLE_IDS = #{ROLE_IDS},
|
||
BZ = #{BZ},
|
||
EMAIL = #{EMAIL},
|
||
NUMBER = #{NUMBER},
|
||
SORT = #{SORT},
|
||
PERSON_TYPE = #{PERSON_TYPE},
|
||
IS_HAZARDCONFIRMER = #{IS_HAZARDCONFIRMER},
|
||
IS_ONLINELEARNING = #{IS_ONLINELEARNING},
|
||
PHONE = #{PHONE}
|
||
<if test="CARDNO != null and CARDNO != ''">
|
||
,CARDNO = #{CARDNO}
|
||
</if>
|
||
<if test="MKMJCARD != null and MKMJCARD != ''">
|
||
,MKMJCARD = #{MKMJCARD}
|
||
</if>
|
||
<if test="DURATION != null and DURATION != ''">
|
||
,DURATION = #{DURATION}
|
||
</if>
|
||
<if test="WORKSTATUS != null and WORKSTATUS != ''">
|
||
,WORKSTATUS = #{WORKSTATUS}
|
||
</if>
|
||
<if test="WORKPERIOD != null and WORKPERIOD != ''">
|
||
,WORKPERIOD = #{WORKPERIOD}
|
||
</if>
|
||
<if test="SHIFTDUTYONE != null and SHIFTDUTYONE != ''">
|
||
,SHIFTDUTYONE = #{SHIFTDUTYONE}
|
||
</if>
|
||
<if test="SHIFTDUTYTWO != null and SHIFTDUTYTWO != ''">
|
||
,SHIFTDUTYTWO = #{SHIFTDUTYTWO}
|
||
</if>
|
||
<if test="PASSWORD != null and PASSWORD != ''">
|
||
,PASSWORD = #{PASSWORD}
|
||
</if>
|
||
<if test="USERNAME != null and USERNAME != ''">
|
||
,USERNAME = #{USERNAME}
|
||
</if>
|
||
<if test="JCR != null and JCR != ''">
|
||
,JCR = #{JCR}
|
||
</if>
|
||
where
|
||
USER_ID = #{USER_ID}
|
||
</update>
|
||
<update id="editPassword" parameterType="pd" >
|
||
update <include refid="tableName"></include>
|
||
set PASSWORD = #{PASSWORD}
|
||
where
|
||
USER_ID = #{USER_ID}
|
||
</update>
|
||
|
||
<update id="editUserScheduling" parameterType="pd" >
|
||
update <include refid="tableName"></include>
|
||
set SHIFTDUTYONE = #{SHIFTDUTYONE},
|
||
SHIFTDUTYTWO = #{SHIFTDUTYTWO},
|
||
DURATION = #{DURATION},
|
||
WORKSTATUS = #{WORKSTATUS},
|
||
WORKPERIOD = #{WORKPERIOD}
|
||
where
|
||
USER_ID = #{USER_ID}
|
||
</update>
|
||
|
||
<update id="updatePushCid" parameterType="pd" >
|
||
update <include refid="tableName"></include>
|
||
set PUSH_CID = #{PUSH_CID}
|
||
where
|
||
USER_ID = #{USER_ID}
|
||
</update>
|
||
|
||
<!-- 获取获取部门账号 -->
|
||
<select id="listUserbyDep" parameterType="pd" resultType="pd" >
|
||
select
|
||
<include refid="Field"></include>
|
||
from
|
||
<include refid="tableName"></include>
|
||
where
|
||
DEPARTMENT_ID =#{DEPARTMENT_ID}
|
||
and STATUS = '0'
|
||
and isdelete = '0'
|
||
order by DEPARTMENT_ID, SORT
|
||
</select>
|
||
|
||
|
||
<!-- 用户列表 -->
|
||
<select id="userlistPage" parameterType="page" resultType="pd" >
|
||
select u.USER_ID,
|
||
u.USERNAME,
|
||
u.PASSWORD,
|
||
u.LAST_LOGIN,
|
||
u.NAME,
|
||
u.IP,
|
||
u.EMAIL,
|
||
u.NUMBER,
|
||
u.PHONE,
|
||
u.ISMAIN,
|
||
u.PERSON_TYPE,
|
||
u.SHIFTDUTYONE,
|
||
u.SHIFTDUTYTWO,
|
||
u.DURATION,
|
||
u.WORKSTATUS,
|
||
u.WORKPERIOD,
|
||
u.STATUS,
|
||
r.ROLE_ID,
|
||
r.ROLE_NAME,
|
||
o.NAME as PID_NAME,
|
||
o.PARENT_ID,
|
||
d.NAME as DEPARTMENT_NAME,
|
||
p.NAME AS POST_NAME,
|
||
sw.NAME SHIFTDUTYONENAME,
|
||
swr.NAME SHIFTDUTYTWONAME,
|
||
info.IS_RECORDER,
|
||
info.IS_CHARGE
|
||
<if test="pd.IS_ARCHIVES != null and pd.IS_ARCHIVES != ''"> <!--档案列表 -->
|
||
,(select count(1) from BUS_STAGESTUDENTRELATION s where s.USER_ID = u.USER_ID) as TASK_COUNT,
|
||
(select count(1) from BUS_STAGESTUDENTRELATION s where s.USER_ID = u.USER_ID and s.STAGEEXAMSTATE=3) as COMPLETE_COUNT
|
||
</if>
|
||
from <include refid="tableName"></include> u
|
||
left join SYS_ROLE r on u.ROLE_ID = r.ROLE_ID
|
||
left join OA_DEPARTMENT d on d.DEPARTMENT_ID=u.DEPARTMENT_ID
|
||
left join OA_DEPARTMENT o ON o.DEPARTMENT_ID = d.PARENT_ID
|
||
left join SYS_POST p on p.POST_ID=u.POST_ID
|
||
left join BUS_SHIFTWORKRULES sw on sw.SHIFTWORKRULES_ID = u.SHIFTDUTYONE
|
||
left join BUS_SHIFTWORKRULES swr on swr.SHIFTWORKRULES_ID = u.SHIFTDUTYTWO
|
||
left join SYS_USERINFO info on info.USER_ID = u.USER_ID
|
||
where u.ISDELETE = '0' and
|
||
u.USERNAME != 'admin'
|
||
<!-- and r.PARENT_ID = '1' -->
|
||
<if test="pd.KEYWORDS!= null and pd.KEYWORDS != ''">
|
||
and
|
||
(
|
||
u.USERNAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||
or
|
||
u.EMAIL LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||
or
|
||
u.NUMBER LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||
or
|
||
u.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||
or
|
||
u.PHONE LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||
)
|
||
</if>
|
||
<if test="pd.ROLE_ID != null and pd.ROLE_ID != ''"> <!-- 角色检索 -->
|
||
and u.ROLE_ID=#{pd.ROLE_ID}
|
||
</if>
|
||
<if test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''"> <!-- 角色检索 -->
|
||
and u.DEPARTMENT_ID=#{pd.DEPARTMENT_ID}
|
||
</if>
|
||
<if test="pd.STRARTTIME!=null and pd.STRARTTIME!=''"> <!-- 登录时间检索 -->
|
||
and u.LAST_LOGIN >= #{pd.STRARTTIME}
|
||
</if>
|
||
<if test="pd.ENDTIME!=null and pd.ENDTIME!=''"> <!-- 登录时间检索 -->
|
||
and u.LAST_LOGIN <= #{pd.ENDTIME}
|
||
</if>
|
||
<if test="pd.SHIFTDUTYONE != null and pd.SHIFTDUTYONE != ''">
|
||
and u.SHIFTDUTYONE=#{pd.SHIFTDUTYONE}
|
||
</if>
|
||
<if test="pd.SHIFTDUTYTWO != null and pd.SHIFTDUTYTWO != ''">
|
||
and u.SHIFTDUTYTWO=#{pd.SHIFTDUTYTWO}
|
||
</if>
|
||
<if test="pd.CORPINFO_ID != null and pd.CORPINFO_ID != ''"><!-- 关键词检索 -->
|
||
AND
|
||
u.CORPINFO_ID = #{pd.CORPINFO_ID}
|
||
</if>
|
||
<if test="pd.IS_ARCHIVES != null and pd.IS_ARCHIVES != ''">
|
||
and (select count(1) from BUS_STAGESTUDENTRELATION s where s.USER_ID = u.USER_ID) > 0
|
||
</if>
|
||
<if test="pd.IS_STUDEANT != null and pd.IS_STUDEANT != ''">
|
||
and exists (select 1 from SYS_USERINFO i where i.USER_ID = u.USER_ID)
|
||
</if>
|
||
<if test="pd.IS_RECORDER != null and pd.IS_RECORDER != '' and pd.IS_RECORDER == 1 ">
|
||
and info.IS_RECORDER = #{pd.IS_RECORDER}
|
||
</if>
|
||
<if test="pd.IS_CHARGE != null and pd.IS_CHARGE != '' and pd.IS_CHARGE == 1 ">
|
||
and info.IS_CHARGE = #{pd.IS_CHARGE}
|
||
</if>
|
||
<if test="pd.IS_HAZARDCONFIRMER != null and pd.IS_HAZARDCONFIRMER != ''"><!-- 关键词检索 -->
|
||
AND
|
||
u.IS_HAZARDCONFIRMER =#{pd.IS_HAZARDCONFIRMER}
|
||
</if>
|
||
order by u.SORT asc,d.LEVEL asc ,d.DEP_ORDER,d.DEPARTMENT_ID asc, u.LAST_LOGIN desc
|
||
</select>
|
||
|
||
<!--查询本部门下除选了审核人、审批人之外的所有人-->
|
||
<select id="userConfirmPage" parameterType="page" resultType="pd" >
|
||
SELECT
|
||
e.IS_TO_EXAMINE,
|
||
e.IS_EXAMINE_AND_APPROVE,
|
||
IFNULL(e.IS_EXAMINE_AND_APPROVE,'0') as eaa,
|
||
IFNULL(e.IS_TO_EXAMINE,'0') as asd,
|
||
s.*,
|
||
e.USER_ID
|
||
FROM
|
||
sys_user s
|
||
LEFT JOIN sys_user_examine e ON s.USER_ID = e.USER_ID
|
||
WHERE
|
||
<if test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''"> <!-- 角色检索 -->
|
||
s.DEPARTMENT_ID=#{pd.DEPARTMENT_ID}
|
||
</if>
|
||
AND
|
||
IFNULL(e.IS_TO_EXAMINE,'0') != '1'
|
||
AND IFNULL(e.IS_EXAMINE_AND_APPROVE,'0') !='1'
|
||
and s.ISDELETE='0'
|
||
</select>
|
||
|
||
<!--查询本部门下除选了确认人、审批人之外的所有人-->
|
||
<select id="userExaminePage" parameterType="page" resultType="pd" >
|
||
SELECT
|
||
e.IS_DEPT_CONFIRM,
|
||
e.IS_EXAMINE_AND_APPROVE,
|
||
IFNULL(e.IS_EXAMINE_AND_APPROVE,'0') as eaa,
|
||
IFNULL(e.IS_DEPT_CONFIRM,'0') as asd,
|
||
s.*,
|
||
e.USER_ID
|
||
FROM
|
||
sys_user s
|
||
LEFT JOIN sys_user_examine e ON s.USER_ID = e.USER_ID
|
||
WHERE
|
||
<if test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''"> <!-- 角色检索 -->
|
||
s.DEPARTMENT_ID=#{pd.DEPARTMENT_ID}
|
||
</if>
|
||
AND
|
||
IFNULL(e.IS_DEPT_CONFIRM,'0') != '1'
|
||
AND IFNULL(e.IS_EXAMINE_AND_APPROVE,'0') !='1'
|
||
and s.ISDELETE = '0'
|
||
</select>
|
||
|
||
<!--查询本部门下除选了确认人、审核人之外的所有人-->
|
||
<select id="userApprovePage" parameterType="page" resultType="pd" >
|
||
SELECT
|
||
e.IS_DEPT_CONFIRM,
|
||
e.IS_TO_EXAMINE,
|
||
IFNULL(e.IS_TO_EXAMINE,'0') as eaa,
|
||
IFNULL(e.IS_DEPT_CONFIRM,'0') as asd,
|
||
s.*,
|
||
e.USER_ID
|
||
FROM
|
||
sys_user s
|
||
LEFT JOIN sys_user_examine e ON s.USER_ID = e.USER_ID
|
||
WHERE
|
||
<if test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''"> <!-- 角色检索 -->
|
||
s.DEPARTMENT_ID=#{pd.DEPARTMENT_ID}
|
||
</if>
|
||
AND
|
||
IFNULL(e.IS_DEPT_CONFIRM,'0') != '1'
|
||
AND IFNULL(e.IS_TO_EXAMINE,'0') !='1'
|
||
and s.ISDELETE='0'
|
||
</select>
|
||
|
||
<!-- 用户列表 -->
|
||
<select id="userSelectlistPage" parameterType="page" resultType="pd" >
|
||
select u.USER_ID,
|
||
u.USERNAME,
|
||
u.PASSWORD,
|
||
u.LAST_LOGIN,
|
||
u.NAME,
|
||
u.IP,
|
||
u.EMAIL,
|
||
u.NUMBER,
|
||
u.PHONE,
|
||
u.ISMAIN,
|
||
r.ROLE_ID,
|
||
r.ROLE_NAME,
|
||
d.NAME as DEPARTMENT_NAME,
|
||
p.NAME AS POST_NAME
|
||
from <include refid="tableName"></include> u
|
||
left join SYS_ROLE r on u.ROLE_ID = r.ROLE_ID
|
||
left join OA_DEPARTMENT d on d.DEPARTMENT_ID=u.DEPARTMENT_ID
|
||
left join SYS_POST p on p.POST_ID=u.POST_ID
|
||
where
|
||
u.USERNAME != 'admin'
|
||
and r.PARENT_ID = '1' and u.ISDELETE = '0'
|
||
<if test="pd.KEYWORDS!= null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
|
||
and
|
||
(
|
||
u.USERNAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||
or
|
||
u.EMAIL LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||
or
|
||
u.NUMBER LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||
or
|
||
u.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||
or
|
||
u.PHONE LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||
)
|
||
</if>
|
||
<if test="pd.ROLE_ID != null and pd.ROLE_ID != ''"> <!-- 角色检索 -->
|
||
and u.ROLE_ID=#{pd.ROLE_ID}
|
||
</if>
|
||
<if test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''"> <!-- 角色检索 -->
|
||
and u.DEPARTMENT_ID=#{pd.DEPARTMENT_ID}
|
||
</if>
|
||
<if test="pd.STRARTTIME!=null and pd.STRARTTIME!=''"> <!-- 登录时间检索 -->
|
||
and u.LAST_LOGIN >= #{pd.STRARTTIME}
|
||
</if>
|
||
<if test="pd.ENDTIME!=null and pd.ENDTIME!=''"> <!-- 登录时间检索 -->
|
||
and u.LAST_LOGIN <= #{pd.ENDTIME}
|
||
</if>
|
||
<if test="pd.CORPINFO_ID != null and pd.CORPINFO_ID != ''"><!-- 关键词检索 -->
|
||
AND
|
||
u.CORPINFO_ID = #{pd.CORPINFO_ID}
|
||
</if>
|
||
order by d.LEVEL asc ,d.DEP_ORDER,d.DEPARTMENT_ID asc, u.SORT asc,u.USER_ID
|
||
</select>
|
||
|
||
<!-- 用户列表(全部) -->
|
||
<select id="listAllUser" parameterType="pd" resultType="pd" >
|
||
select u.USER_ID,
|
||
u.USERNAME,
|
||
u.PASSWORD,
|
||
u.LAST_LOGIN,
|
||
u.NAME,
|
||
u.IP,
|
||
u.EMAIL,
|
||
u.NUMBER,
|
||
u.PHONE,
|
||
r.ROLE_ID,
|
||
u.DEPARTMENT_ID,
|
||
o.NAME as PID_NAME,
|
||
o.PARENT_ID,
|
||
d.NAME as DEPARTMENT_NAME,
|
||
r.ROLE_NAME
|
||
from <include refid="tableName"></include> u
|
||
left join SYS_ROLE r on u.ROLE_ID = r.ROLE_ID
|
||
left join OA_DEPARTMENT d on d.DEPARTMENT_ID=u.DEPARTMENT_ID
|
||
left join OA_DEPARTMENT o ON o.DEPARTMENT_ID = d.PARENT_ID
|
||
where u.ROLE_ID = r.ROLE_ID
|
||
and u.USERNAME != 'admin' and u.ISDELETE = '0'
|
||
<!-- and r.PARENT_ID = '1' -->
|
||
<if test="KEYWORDS != null and KEYWORDS != ''"><!-- 关键词检索 -->
|
||
and
|
||
(
|
||
u.USERNAME LIKE CONCAT(CONCAT('%', #{KEYWORDS}),'%')
|
||
or
|
||
u.EMAIL LIKE CONCAT(CONCAT('%', #{KEYWORDS}),'%')
|
||
or
|
||
u.NUMBER LIKE CONCAT(CONCAT('%', #{KEYWORDS}),'%')
|
||
or
|
||
u.NAME LIKE CONCAT(CONCAT('%', #{KEYWORDS}),'%')
|
||
or
|
||
u.PHONE LIKE CONCAT(CONCAT('%', #{KEYWORDS}),'%')
|
||
)
|
||
</if>
|
||
<if test="ROLE_ID != null and ROLE_ID != ''"><!-- 角色检索 -->
|
||
and u.ROLE_ID=#{ROLE_ID}
|
||
</if>
|
||
<if test="STRARTTIME!=null and STRARTTIME!=''"><!-- 登录时间检索 -->
|
||
and u.LAST_LOGIN >= #{STRARTTIME}
|
||
</if>
|
||
<if test="ENDTIME!=null and ENDTIME!=''"><!-- 登录时间检索 -->
|
||
and u.LAST_LOGIN <= #{ENDTIME}
|
||
</if>
|
||
<if test="CORPINFO_ID != null and CORPINFO_ID != ''"><!-- 关键词检索 -->
|
||
AND
|
||
u.CORPINFO_ID = #{CORPINFO_ID}
|
||
</if>
|
||
<if test="DEPARTMENT_ID != null and DEPARTMENT_ID != ''"><!-- 关键词检索 -->
|
||
AND
|
||
u.DEPARTMENT_ID = #{DEPARTMENT_ID}
|
||
</if>
|
||
<if test="POST_ID != null and POST_ID != ''"><!-- 关键词检索 -->
|
||
AND
|
||
u.POST_ID = #{POST_ID}
|
||
</if>
|
||
<if test="NOSELF != null and NOSELF != ''"><!-- 关键词检索 -->
|
||
AND
|
||
u.USER_ID != #{LOGINUSERID}
|
||
</if>
|
||
<if test="NOMAIN != null and NOMAIN != ''"><!-- 关键词检索 -->
|
||
AND
|
||
u.ISMAIN != '1'
|
||
</if>
|
||
<if test="ISMAIN != null and ISMAIN != ''"><!-- 关键词检索 -->
|
||
AND
|
||
u.ISMAIN =#{ISMAIN}
|
||
</if>
|
||
<if test="IS_HAZARDCONFIRMER != null and IS_HAZARDCONFIRMER != ''"><!-- 关键词检索 -->
|
||
AND
|
||
u.IS_HAZARDCONFIRMER =#{IS_HAZARDCONFIRMER}
|
||
</if>
|
||
<if test="IS_ONLINELEARNING != null and IS_ONLINELEARNING != ''"><!-- 隐患确认人 -->
|
||
AND u.IS_ONLINELEARNING =#{IS_ONLINELEARNING}
|
||
</if>
|
||
order by u.DEPARTMENT_ID asc, u.SORT asc,u.LAST_LOGIN desc
|
||
</select>
|
||
|
||
<!--获取全部用户信息列表-->
|
||
<select id="getAllUserList" resultType="com.zcloud.entity.PageData">
|
||
select
|
||
f.USER_ID as value,
|
||
f.USER_ID as id,
|
||
f.USER_ID,
|
||
f.USERNAME,
|
||
f.NAME,
|
||
f.DEPARTMENT_ID,
|
||
f.CORPINFO_ID,
|
||
f.empNo,
|
||
f.cardNo,
|
||
d.NAME as DEPARTMENT_NAME,
|
||
c.CORP_NAME,
|
||
if (CONCAT(c.CORP_NAME,'-',d.NAME,'-',f.NAME) is not null,CONCAT(c.CORP_NAME,'-',d.NAME,'-',f.NAME),'') as label
|
||
from
|
||
<include refid="tableName"></include> f
|
||
left join OA_DEPARTMENT d on d.DEPARTMENT_ID = f.DEPARTMENT_ID
|
||
left join BUS_CORP_INFO c on c.CORPINFO_ID = f.CORPINFO_ID
|
||
where f.ISDELETE = '0'
|
||
AND f.USERNAME != 'admin'
|
||
and f.USERNAME is not null
|
||
and TRIM(f.USERNAME) != ''
|
||
and f.`NAME` is not null
|
||
and TRIM(f.`NAME`) != ''
|
||
and TRIM(if (CONCAT(c.CORP_NAME,'-',d.NAME,'-',f.NAME) is not null,CONCAT(c.CORP_NAME,'-',d.NAME,'-',f.NAME),'')) != ''
|
||
order by CONVERT( f.NAME USING gbk )
|
||
</select>
|
||
|
||
<!-- 通过企业ID获取用户信息 -->
|
||
<select id="getDepartmentId" parameterType="String" resultMap="userAndRoleResultMap">
|
||
select
|
||
<include refid="Field"></include>
|
||
from
|
||
<include refid="tableName"></include>
|
||
where DEPARTMENT_ID=#{DEPARTMENT_ID}
|
||
</select>
|
||
|
||
<!-- 通过企业ID获取用户信息 -->
|
||
<select id="getCorpInfoId" parameterType="String" resultMap="userAndRoleResultMap">
|
||
select
|
||
<include refid="Field"></include>
|
||
from
|
||
<include refid="tableName"></include>
|
||
where ISMAIN=1
|
||
and CORPINFO_ID=#{CORPINFO_ID}
|
||
</select>
|
||
|
||
<!-- 通过用户ID获取用户信息和角色信息 -->
|
||
<select id="getUserAndRoleById" parameterType="String" resultMap="userAndRoleResultMap">
|
||
select u.USER_ID,
|
||
u.USERNAME,
|
||
u.NAME,
|
||
u.PASSWORD,
|
||
u.SKIN,
|
||
u.NUMBER,
|
||
u.ROLE_IDS,
|
||
r.ROLE_ID,
|
||
r.ROLE_NAME,
|
||
r.RIGHTS as ROLE_RIGHTS,
|
||
r.ADD_QX,
|
||
r.DEL_QX,
|
||
r.EDIT_QX,
|
||
r.CHA_QX
|
||
from
|
||
<include refid="tableName"></include> u
|
||
left join
|
||
<include refid="roleTableName"></include> r
|
||
on u.ROLE_ID=r.ROLE_ID
|
||
where u.STATUS=0
|
||
and u.USER_ID=#{USER_ID}
|
||
</select>
|
||
|
||
<!-- 存入IP -->
|
||
<update id="saveIP" parameterType="pd" >
|
||
update
|
||
<include refid="tableName"></include>
|
||
set
|
||
IP = #{IP},
|
||
LAST_LOGIN = #{LAST_LOGIN},
|
||
ERROR_COUNT = 0
|
||
where
|
||
USERNAME = #{USERNAME}
|
||
</update>
|
||
|
||
<!-- 保存用户皮肤 -->
|
||
<update id="saveSkin" parameterType="pd" >
|
||
update
|
||
<include refid="tableName"></include>
|
||
set
|
||
SKIN = #{SKIN}
|
||
where USERNAME = #{USERNAME}
|
||
</update>
|
||
|
||
<!-- 删除用户 -->
|
||
<delete id="deleteUser" parameterType="pd">
|
||
update
|
||
<include refid="tableName"></include>
|
||
set
|
||
ISDELETE = '1'
|
||
where
|
||
USER_ID = #{USER_ID}
|
||
</delete>
|
||
|
||
<!-- 批量删除用户 -->
|
||
<delete id="deleteAllUser" parameterType="String" >
|
||
update
|
||
<include refid="tableName"></include>
|
||
set
|
||
ISDELETE = '1'
|
||
where
|
||
USER_ID in
|
||
<foreach item="item" index="index" collection="array" open="(" separator="," close=")">
|
||
#{item}
|
||
</foreach>
|
||
</delete>
|
||
|
||
<!-- 用户列表(弹窗选择用) -->
|
||
<select id="userBystafflistPage" parameterType="page" resultType="pd" >
|
||
select u.USER_ID,
|
||
u.USERNAME,
|
||
u.PASSWORD,
|
||
u.LAST_LOGIN,
|
||
u.NAME,
|
||
u.IP,
|
||
u.EMAIL,
|
||
u.NUMBER,
|
||
u.PHONE,
|
||
r.ROLE_ID,
|
||
r.ROLE_NAME
|
||
from <include refid="tableName"></include> u, <include refid="roleTableName"></include> r
|
||
where u.ROLE_ID = r.ROLE_ID
|
||
and u.USERNAME != 'admin'
|
||
and r.PARENT_ID = '1'
|
||
<if test="pd.KEYWORDS!= null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
|
||
and
|
||
(
|
||
u.USERNAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||
or
|
||
u.EMAIL LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||
or
|
||
u.NUMBER LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||
or
|
||
u.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||
or
|
||
u.PHONE LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||
)
|
||
</if>
|
||
<if test="pd.ROLE_ID != null and pd.ROLE_ID != ''"><!-- 角色检索 -->
|
||
and u.ROLE_ID=#{pd.ROLE_ID}
|
||
</if>
|
||
<if test="pd.STRARTTIME!=null and pd.STRARTTIME!=''"> <!-- 登录时间检索 -->
|
||
and u.LAST_LOGIN >= #{pd.STRARTTIME}
|
||
</if>
|
||
<if test="pd.ENDTIME!=null and pd.ENDTIME!=''"> <!-- 登录时间检索 -->
|
||
and u.LAST_LOGIN <= #{pd.ENDTIME}
|
||
</if>
|
||
order by u.DEPARTMENT_ID asc, u.SORT asc,u.LAST_LOGIN desc
|
||
</select>
|
||
|
||
<!--设置小程序菜单 -->
|
||
<update id="editUserFuns" parameterType="pd" >
|
||
update <include refid="tableName"></include>
|
||
set FUN_IDS = #{FUN_IDS}
|
||
where
|
||
USER_ID = #{USER_ID}
|
||
</update>
|
||
|
||
<!-- 查询小程序用户 -->
|
||
<select id="findAppUserById" parameterType="pd" resultType="pd" >
|
||
select
|
||
f.ID,
|
||
f.NAME,
|
||
f.APPID,
|
||
f.ISAGREEPROTOCOL,
|
||
f.USER_TYPE,
|
||
bw.BALANCE,
|
||
bp.POINTS
|
||
from
|
||
user_view f
|
||
left join bus_wallet bw on bw.ISDELETE = '0' and bw.USER_ID = f.APPID and bw.USER_TYPE = f.USER_TYPE
|
||
left join bus_points bp on bp.ISDELETE = '0' and bp.USER_ID = f.APPID
|
||
where
|
||
f.APPID = #{APPID}
|
||
<if test="USER_TYPE!=null and USER_TYPE!=''"> <!-- 登录时间检索 -->
|
||
and f.USER_TYPE = #{USER_TYPE}
|
||
</if>
|
||
</select>
|
||
|
||
<!--用户同意协议 -->
|
||
<update id="agreeProtocol" parameterType="pd" >
|
||
update
|
||
sys_user
|
||
SET
|
||
ISAGREEPROTOCOL = '1'
|
||
where
|
||
APPID = #{APPID}
|
||
</update>
|
||
<!-- 列出某角色下的所有用户 -->
|
||
<select id="findUserNameAll" parameterType="pd" resultType="pd" >
|
||
select USERNAME,USER_ID,NAME
|
||
from
|
||
<include refid="tableName"></include>
|
||
where
|
||
CORPINFO_ID = #{CORPINFO_ID}
|
||
order by DEPARTMENT_ID,SORT
|
||
</select>
|
||
<!-- 列出所有用户 -->
|
||
<select id="findAllUser" parameterType="pd" resultType="pd" >
|
||
select *
|
||
from
|
||
<include refid="tableName"></include>
|
||
order by DEPARTMENT_ID,SORT
|
||
</select>
|
||
|
||
<!-- 获取企业的主账号 -->
|
||
<select id="findCorpMain" parameterType="pd" resultType="pd" >
|
||
select
|
||
<include refid="Field"></include>
|
||
from
|
||
<include refid="tableName"></include>
|
||
where
|
||
ISMAIN = '1'
|
||
and CORPINFO_ID =#{CORPINFO_ID}
|
||
and STATUS = '0'
|
||
</select>
|
||
|
||
|
||
<!-- 获取账号及部门岗位 -->
|
||
<select id="listUserDepPos" parameterType="pd" resultType="pd" >
|
||
select
|
||
u.USER_ID,
|
||
u.NAME USERNAME,
|
||
d.NAME DEPARTNAME,
|
||
p.NAME POSTNAME
|
||
from
|
||
<include refid="tableName"></include> u
|
||
left join oa_department d on d.DEPARTMENT_ID = u.DEPARTMENT_ID
|
||
left join sys_post p on p.POST_ID = u.POST_ID and p.ISDELETE = '0' and p.STATUS = '0'
|
||
where
|
||
u.CORPINFO_ID =#{CORPINFO_ID}
|
||
and u.STATUS = '0' and u.ISDELETE = '0'
|
||
<if test="KEYWORDS != null and KEYWORDS != ''"><!-- 关键词检索 -->
|
||
and
|
||
(
|
||
p.NAME LIKE CONCAT(CONCAT('%', #{KEYWORDS}),'%')
|
||
or
|
||
u.NAME LIKE CONCAT(CONCAT('%', #{KEYWORDS}),'%')
|
||
)
|
||
</if>
|
||
<if test="DEPARTMENT_ID != null and DEPARTMENT_ID != ''"><!-- 关键词检索 -->
|
||
and d.DEPARTMENT_ID = #{DEPARTMENT_ID}
|
||
</if>
|
||
|
||
<if test="NOMAIN != null and NOMAIN != ''"><!-- 关键词检索 -->
|
||
and u.ISMAIN = '0'
|
||
</if>
|
||
order by
|
||
d.LEVEL,d.DEP_ORDER,d.DEPARTMENT_ID,u.SORT
|
||
</select>
|
||
|
||
<select id="listUserBYids" parameterType="String" resultType="pd" >
|
||
select u.USER_ID,
|
||
u.USERNAME,
|
||
u.PASSWORD,
|
||
u.LAST_LOGIN,
|
||
u.NAME,
|
||
u.IP,
|
||
u.EMAIL,
|
||
u.NUMBER,
|
||
u.PHONE,
|
||
u.ISMAIN,
|
||
r.ROLE_ID,
|
||
r.ROLE_NAME,
|
||
d.NAME as DEPARTMENT_NAME,
|
||
p.NAME AS POST_NAME
|
||
from <include refid="tableName"></include> u
|
||
left join SYS_ROLE r on u.ROLE_ID = r.ROLE_ID
|
||
left join OA_DEPARTMENT d on d.DEPARTMENT_ID=u.DEPARTMENT_ID
|
||
left join SYS_POST p on p.POST_ID=u.POST_ID
|
||
where
|
||
USER_ID in
|
||
<foreach item="item" index="index" collection="array" open="(" separator="," close=")">
|
||
#{item}
|
||
</foreach>
|
||
order by d.LEVEL asc ,d.DEP_ORDER asc ,d.DEPARTMENT_ID asc, u.SORT asc,u.LAST_LOGIN desc
|
||
</select>
|
||
|
||
<!-- 查询公司员工总数 -->
|
||
<select id="getUserCount" parameterType="pd" resultType="int" >
|
||
SELECT
|
||
COUNT( 1 )
|
||
FROM
|
||
sys_user
|
||
WHERE
|
||
CORPINFO_ID = #{CORPINFO_ID}
|
||
</select>
|
||
|
||
<!-- 查询公司检查过清单的员工总数 -->
|
||
<select id="getWorkedUserCount" parameterType="pd" resultType="int" >
|
||
SELECT
|
||
count( 1 )
|
||
FROM
|
||
(
|
||
SELECT
|
||
count( s.USER_ID )
|
||
FROM
|
||
sys_user s
|
||
LEFT JOIN bus_checkuser cu ON s.USER_ID = cu.USER_ID
|
||
LEFT JOIN bus_checkrecord f ON f.CHECKRECORD_ID = cu.CHECKRECORD_ID
|
||
WHERE
|
||
s.CORPINFO_ID = #{CORPINFO_ID}
|
||
AND f.FINISHED = '1'
|
||
AND f.isdelete = '0'
|
||
AND f.CHECKRECORD_ID IS NOT NULL
|
||
GROUP BY
|
||
s.USER_ID
|
||
) q
|
||
</select>
|
||
|
||
<!-- 首页隐患排查数据 企业人数(总数、已参加排查人数) -->
|
||
<select id="statisticsByCorp" parameterType="pd" resultType="pd" >
|
||
SELECT IFNULL(count(*), 0) COUNT
|
||
FROM SYS_USER u
|
||
LEFT JOIN SYS_ROLE r ON u.ROLE_ID = r.ROLE_ID
|
||
WHERE u.USERNAME != 'admin' AND r.PARENT_ID = '1' AND u.CORPINFO_ID = #{CORPINFO_ID}
|
||
UNION ALL
|
||
SELECT IFNULL(COUNT(*), 0) COUNT FROM (
|
||
SELECT f.USER_ID
|
||
FROM bus_checkuser f
|
||
LEFT JOIN SYS_USER u ON u.USER_ID = f.USER_ID
|
||
LEFT JOIN SYS_ROLE r ON u.ROLE_ID = r.ROLE_ID
|
||
WHERE u.USERNAME != 'admin' AND r.PARENT_ID = '1' AND u.CORPINFO_ID = #{CORPINFO_ID}
|
||
GROUP BY f.USER_ID) f
|
||
</select>
|
||
|
||
<!-- 获取人员Cascader数据(人员ID,姓名,部门ID,部门级别) -->
|
||
<select id="listCascader" parameterType="pd" resultType="pd" >
|
||
select
|
||
u.USER_ID,
|
||
u.NAME USERNAME,
|
||
u.LEARNERCATEGORY,
|
||
d.NAME DEPARTMENTNAME,
|
||
d.LEVEL
|
||
from
|
||
<include refid="tableName"></include> u
|
||
left join OA_DEPARTMENT d on d.DEPARTMENT_ID = u.DEPARTMENT_ID
|
||
where
|
||
u.CORPINFO_ID = #{CORPINFO_ID}
|
||
and u.STATUS = '0'
|
||
<if test="BIANMA != null and BIANMA != ''"><!-- 部门级别 -->
|
||
and d.LEVEL = #{BIANMA}
|
||
<if test="BIANMA == 'departmentLevel0001'"><!-- 部门级别 -->
|
||
and d.PARENT_ID = '0'
|
||
</if>
|
||
</if>
|
||
<if test="DEPARTMENT_ID != null and DEPARTMENT_ID != ''"><!-- 部门ID -->
|
||
and u.DEPARTMENT_ID = #{DEPARTMENT_ID}
|
||
</if>
|
||
<if test="LEARNERCATEGORY != null and LEARNERCATEGORY != ''"><!-- 关键词检索 -->
|
||
and u.LEARNERCATEGORY = #{LEARNERCATEGORY}
|
||
</if>
|
||
order by u.SORT
|
||
</select>
|
||
|
||
<select id="findByRegulatoryId" parameterType="pd" resultType="pd">
|
||
select
|
||
*
|
||
from
|
||
`qa-gwj-regulatory`.SYS_USER
|
||
where USER_ID = #{USER_ID}
|
||
</select>
|
||
<select id="userlistAll" parameterType="pd" resultType="pd">
|
||
select u.USER_ID,
|
||
u.USERNAME,
|
||
u.PASSWORD,
|
||
u.LAST_LOGIN,
|
||
u.NAME,
|
||
u.IP,
|
||
u.EMAIL,
|
||
u.NUMBER,
|
||
u.PHONE,
|
||
u.ISMAIN,
|
||
u.PERSON_TYPE,
|
||
u.SHIFTDUTYONE,
|
||
u.SHIFTDUTYTWO,
|
||
u.DURATION,
|
||
u.WORKSTATUS,
|
||
u.WORKPERIOD,
|
||
r.ROLE_ID,
|
||
r.ROLE_NAME,
|
||
d.NAME as DEPARTMENT_NAME,
|
||
p.NAME AS POST_NAME,
|
||
sw.NAME SHIFTDUTYONENAME,
|
||
swr.NAME SHIFTDUTYTWONAME
|
||
from <include refid="tableName"></include> u
|
||
left join SYS_ROLE r on u.ROLE_ID = r.ROLE_ID
|
||
left join OA_DEPARTMENT d on d.DEPARTMENT_ID=u.DEPARTMENT_ID
|
||
left join SYS_POST p on p.POST_ID=u.POST_ID
|
||
left join BUS_SHIFTWORKRULES sw on sw.SHIFTWORKRULES_ID = u.SHIFTDUTYONE
|
||
left join BUS_SHIFTWORKRULES swr on swr.SHIFTWORKRULES_ID = u.SHIFTDUTYTWO
|
||
left join SYS_USERINFO info on info.USER_ID = u.USER_ID
|
||
where
|
||
u.CORPINFO_ID = #{CORPINFO_ID}
|
||
</select>
|
||
|
||
<!-- 用户列表(监管端用户+企业端用户) -->
|
||
<select id="listAllManageAndCorp" parameterType="pd" resultType="pd">
|
||
select '1' AS `USER_SIDE`,
|
||
u.USER_ID,
|
||
u.USERNAME,
|
||
u.NAME
|
||
from `qa-gwj-regulatory`.sys_user u
|
||
left join `qa-gwj-regulatory`.SYS_ROLE r on u.ROLE_ID = r.ROLE_ID
|
||
where u.USERNAME != 'admin' and u.ISDELETE = '0'
|
||
and r.PARENT_ID = '1'
|
||
<if test="DEPARTMENT_ID != null and DEPARTMENT_ID != ''"><!-- 用户部门 -->
|
||
AND u.DEPARTMENT_ID = #{DEPARTMENT_ID}
|
||
</if>
|
||
UNION ALL
|
||
select '2' AS `USER_SIDE`,
|
||
u.USER_ID,
|
||
u.USERNAME,
|
||
u.NAME
|
||
from `qa-gwj-prevention`.sys_user u, `qa-gwj-prevention`.sys_role r
|
||
where u.ROLE_ID = r.ROLE_ID
|
||
and u.USERNAME != 'admin' and u.ISDELETE = '0'
|
||
<!-- and r.PARENT_ID = '1' -->
|
||
<if test="DEPARTMENT_ID != null and DEPARTMENT_ID != ''"><!-- 用户部门 -->
|
||
AND u.DEPARTMENT_ID = #{DEPARTMENT_ID}
|
||
</if>
|
||
</select>
|
||
|
||
<update id="lockUser" parameterType="pd" >
|
||
update <include refid="tableName"></include>
|
||
set
|
||
STATUS = #{LOCK_STATUS},
|
||
ERROR_COUNT = #{ERROR_COUNT}
|
||
<if test="LAST_LOGIN != null and LAST_LOGIN != ''"><!-- 用户部门 -->
|
||
,LAST_LOGIN = #{LAST_LOGIN}
|
||
</if>
|
||
where
|
||
USER_ID = #{USER_ID}
|
||
</update>
|
||
<update id="resetCardNo">
|
||
update sys_user set CARDNO = null where CARDNO = #{CARDNO}
|
||
</update>
|
||
|
||
<!-- 通过岗位ID查用户列表-->
|
||
<select id="findByPostId" parameterType="pd" resultType="pd">
|
||
select
|
||
<include refid="Field"></include>
|
||
from
|
||
<include refid="tableName"></include>
|
||
where
|
||
POST_ID = #{POST_ID}
|
||
and ISDELETE = '0'
|
||
</select>
|
||
|
||
|
||
<!-- 通过用户ID获取数据 -->
|
||
<select id="findByIdForEmis" parameterType="pd" resultType="pd" >
|
||
select
|
||
f.USER_ID,
|
||
f.USERNAME,
|
||
f.JCR,
|
||
d.DJBM,
|
||
d.NAME as deparName
|
||
from
|
||
<include refid="tableName"></include>f
|
||
left join OA_DEPARTMENT d on d.DEPARTMENT_ID= f.DEPARTMENT_ID
|
||
where
|
||
f.USER_ID = #{USER_ID}
|
||
</select>
|
||
|
||
|
||
|
||
<!-- 用户列表 -->
|
||
<select id="userlistAllToExcel" parameterType="pd" resultType="pd" >
|
||
select u.USER_ID , d.NAME as deptName, p.name as postName,
|
||
u.name,u.username, u.PERSON_TYPE ,IS_HAZARDCONFIRMER
|
||
|
||
|
||
from <include refid="tableName"></include> u
|
||
left join OA_DEPARTMENT d on d.DEPARTMENT_ID=u.DEPARTMENT_ID
|
||
left join SYS_POST p on p.POST_ID=u.POST_ID
|
||
where u.ISDELETE = '0' and
|
||
u.USERNAME != 'admin'
|
||
<if test="KEYWORDS!= null and KEYWORDS != ''">
|
||
and
|
||
(
|
||
u.USERNAME LIKE CONCAT(CONCAT('%', #{KEYWORDS}),'%')
|
||
or
|
||
u.EMAIL LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||
or
|
||
u.NUMBER LIKE CONCAT(CONCAT('%', #{KEYWORDS}),'%')
|
||
or
|
||
u.NAME LIKE CONCAT(CONCAT('%', #{KEYWORDS}),'%')
|
||
or
|
||
u.PHONE LIKE CONCAT(CONCAT('%', #{KEYWORDS}),'%')
|
||
)
|
||
</if>
|
||
<if test="DEPARTMENT_ID != null and DEPARTMENT_ID != ''"> <!-- 角色检索 -->
|
||
and u.DEPARTMENT_ID=#{DEPARTMENT_ID}
|
||
</if>
|
||
<if test="SHIFTDUTYONE != null and SHIFTDUTYONE != ''">
|
||
and u.SHIFTDUTYONE=#{SHIFTDUTYONE}
|
||
</if>
|
||
<if test="SHIFTDUTYTWO != null and SHIFTDUTYTWO != ''">
|
||
and u.SHIFTDUTYTWO=#{SHIFTDUTYTWO}
|
||
</if>
|
||
<if test="CORPINFO_ID != null and CORPINFO_ID != ''"><!-- 关键词检索 -->
|
||
AND
|
||
u.CORPINFO_ID = #{CORPINFO_ID}
|
||
</if>
|
||
<if test="IS_HAZARDCONFIRMER != null and IS_HAZARDCONFIRMER != ''"><!-- 关键词检索 -->
|
||
AND
|
||
u.IS_HAZARDCONFIRMER =#{IS_HAZARDCONFIRMER}
|
||
</if>
|
||
order by u.SORT asc,d.LEVEL asc ,d.DEP_ORDER,d.DEPARTMENT_ID asc, u.LAST_LOGIN desc
|
||
</select>
|
||
<select id="findByCorpInfoId" resultType="com.zcloud.entity.PageData">
|
||
select USER_ID,
|
||
USERNAME,
|
||
PASSWORD,
|
||
DEPARTMENT_ID,
|
||
NAME
|
||
from `qa-gwj-prevention`.SYS_USER
|
||
where CORPINFO_ID = #{CORPINFO_ID}
|
||
and ISMAIN = '1'
|
||
and ISDELETE = '0'
|
||
</select>
|
||
<select id="selectUserListByUserIds" resultType="com.zcloud.entity.PageData">
|
||
<if test=" ids != null and ids != ''">
|
||
select
|
||
f.NAME,
|
||
f.DEPARTMENT_ID,
|
||
f.USER_ID,
|
||
sd.name as punishname
|
||
from `qa-gwj-regulatory`.sys_user f
|
||
LEFT JOIN `qa-gwj-prevention`.vi_department_all sd ON sd.DEPARTMENT_ID = f.DEPARTMENT_ID
|
||
<foreach item="item" index="index" collection="ids" open="WHERE" separator="or">
|
||
<if test=" item != null and item != ''">
|
||
USER_ID like CONCAT(CONCAT('%', #{item}),'%')
|
||
</if>
|
||
</foreach>
|
||
UNION ALL
|
||
select
|
||
z.NAME,
|
||
z.DEPARTMENT_ID,
|
||
z.USER_ID,
|
||
sd.name as punishname
|
||
from `qa-gwj-prevention`.sys_user z
|
||
LEFT JOIN `qa-gwj-prevention`.vi_department_all sd ON sd.DEPARTMENT_ID = z.DEPARTMENT_ID
|
||
<foreach item="item" index="index" collection="ids" open="WHERE" separator="or">
|
||
<if test=" item != null and item != ''">
|
||
USER_ID like CONCAT(CONCAT('%', #{item}),'%')
|
||
</if>
|
||
</foreach>
|
||
</if>
|
||
</select>
|
||
<select id="getUserInfo" resultType="com.zcloud.entity.PageData">
|
||
select * from vi_user_all
|
||
<if test="USER_ID != null and USER_ID != ''">
|
||
where USER_ID = #{USER_ID}
|
||
</if>
|
||
<if test="USER_IDS != null and USER_IDS != ''">
|
||
where USER_ID in
|
||
<foreach item="item" index="index" collection="USER_IDS" open="(" separator="," close=")">
|
||
#{item}
|
||
</foreach>
|
||
</if>
|
||
</select>
|
||
<select id="getUsersInfo" resultType="com.zcloud.entity.PageData">
|
||
select * from `qa-gwj-regulatory`.SYS_USER where ISDELETE = '0'
|
||
<if test="USER_ID != null and USER_ID != ''">
|
||
and USER_ID = #{USER_ID}
|
||
</if>
|
||
<if test="USER_IDS != null and USER_IDS != ''">
|
||
and USER_ID in
|
||
<foreach item="item" index="index" collection="USER_IDS" open="(" separator="," close=")">
|
||
#{item}
|
||
</foreach>
|
||
</if>
|
||
<if test="DEPARTMENT_ID != null and DEPARTMENT_ID != null">
|
||
and DEPARTMENT_ID = #{DEPARTMENT_ID}
|
||
</if>
|
||
<if test="ISASSESS != null and ISASSESS != null">
|
||
and ISASSESS = #{ISASSESS}
|
||
</if>
|
||
</select>
|
||
|
||
<select id="countAllByArea" resultType="com.zcloud.entity.PageData">
|
||
SELECT
|
||
ifnull(COUNT( 1 ),0) USERCOUNT
|
||
FROM
|
||
`qa-gwj-prevention`.sys_user s
|
||
LEFT JOIN `qa-gwj-prevention`.bus_corp_info ci ON s.CORPINFO_ID = ci.CORPINFO_ID
|
||
WHERE s.ISDELETE = '0' and ci.AREA is not null and ci.AREA != ''
|
||
<if test=" AREA != null and AREA != ''">
|
||
and ci.AREA = #{AREA}
|
||
</if>
|
||
</select>
|
||
<select id="getPersonByCardNo" resultType="com.zcloud.entity.PageData">
|
||
SELECT
|
||
u.USER_ID,
|
||
u.NAME,
|
||
u.USERNAME,
|
||
u.USERAVATARURL,
|
||
u.IS_HAZARDCONFIRMER,
|
||
u.PERSON_TYPE,
|
||
d.`NAME` DEPARTMENT_NAME,
|
||
p.`NAME` POST_NAME,
|
||
u.CARDNO,
|
||
c.CORP_NAME
|
||
FROM
|
||
`qa-gwj-prevention`.sys_user u
|
||
LEFT JOIN `qa-gwj-prevention`.bus_corp_info c ON u.CORPINFO_ID = c.CORPINFO_ID
|
||
LEFT JOIN `qa-gwj-prevention`.sys_post p on u.POST_ID = p.POST_ID
|
||
LEFT JOIN `qa-gwj-prevention`.oa_department d on u.DEPARTMENT_ID = d.DEPARTMENT_ID
|
||
WHERE
|
||
u.ISDELETE = 0 and
|
||
u.CARDNO = #{CARDNO}
|
||
</select>
|
||
<!-- 通过用户卡号获取数据(查询企业端用户) -->
|
||
<select id="findByCardNo" parameterType="pd" resultType="pd">
|
||
select
|
||
u.USER_ID,
|
||
u.USERNAME,
|
||
u.PASSWORD,
|
||
u.NAME,
|
||
u.ROLE_ID,
|
||
u.LAST_LOGIN,
|
||
u.IP,
|
||
u.STATUS,
|
||
u.BZ,
|
||
u.SKIN,
|
||
u.EMAIL,
|
||
u.NUMBER,
|
||
u.PHONE,
|
||
u.ROLE_IDS,
|
||
u.DEPARTMENT_ID,
|
||
u.CORPINFO_ID,
|
||
u.FUN_IDS,
|
||
u.APPID,
|
||
u.POST_ID,
|
||
u.ISMAIN,
|
||
u.ERROR_COUNT,
|
||
u.SORT,
|
||
u.LEARNERCATEGORY,
|
||
u.USERAVATARPREFIX,
|
||
u.USERAVATARURL,
|
||
u.SHIFTDUTYONE,
|
||
u.SHIFTDUTYTWO,
|
||
u.DURATION,
|
||
u.WORKSTATUS,
|
||
u.WORKPERIOD,
|
||
u.IS_RECORDER,
|
||
u.PERSONNEL_TYPE,
|
||
u.IS_HAZARDCONFIRMER,
|
||
u.IS_ONLINELEARNING,
|
||
u.PERSON_TYPE,
|
||
u.JCR,
|
||
u.ISDELETE,
|
||
u.PUSH_CID,
|
||
u.EMPNO,
|
||
u.CFD_STATUS,
|
||
u.CARDNO,
|
||
d.NAME as DEPARTMENT_NAME,
|
||
p.NAME as POST_NAME
|
||
from
|
||
`qa-gwj-prevention`.sys_user u
|
||
left join `qa-gwj-prevention`oa_department d on d.DEPARTMENT_ID = u.DEPARTMENT_ID
|
||
left join `qa-gwj-prevention`sys_post p on p.POST_ID = u.POST_ID
|
||
where
|
||
u.CARDNO = #{CARDNO}
|
||
</select>
|
||
|
||
<select id="listUserByDepId" resultType="com.zcloud.entity.PageData">
|
||
select <include refid="Fieldf"></include>
|
||
from <include refid="tableName"></include> f
|
||
where DEPARTMENT_ID = #{RECEIVER_ID} and ISDELETE = '0'
|
||
</select>
|
||
</mapper>
|