forked from integrated_whb/integrated_whb
2010 lines
56 KiB
XML
2010 lines
56 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"/>
|
||
<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="SKIN" property="SKIN"/>
|
||
<result column="ROLE_IDS" property="ROLE_IDS"/>
|
||
</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,
|
||
SEX,
|
||
NUMBER,
|
||
PHONE,
|
||
ROLE_IDS,
|
||
DEPARTMENT_ID,
|
||
POST_ID,
|
||
ISMAIN,
|
||
FUN_IDS,
|
||
SORT,
|
||
LEARNERCATEGORY,
|
||
USERAVATARPREFIX,
|
||
USERAVATARURL,
|
||
SHIFTDUTYONE,
|
||
SHIFTDUTYTWO,
|
||
DURATION,
|
||
WORKSTATUS,
|
||
WORKPERIOD,
|
||
ISSTUDENT,
|
||
RIGHTS,
|
||
CORPINFO_ID,
|
||
IS_SAFETY,
|
||
ISDELETE,
|
||
ISHEAD,
|
||
CARDNO,
|
||
PLS_ID,
|
||
ISLEADER
|
||
</sql>
|
||
|
||
|
||
|
||
<!-- 字段值 -->
|
||
<sql id="FieldValue">
|
||
#{USER_ID},
|
||
#{USERNAME},
|
||
#{PASSWORD},
|
||
#{NAME},
|
||
#{ROLE_ID},
|
||
#{LAST_LOGIN},
|
||
#{IP},
|
||
#{STATUS},
|
||
#{BZ},
|
||
#{SKIN},
|
||
#{EMAIL},
|
||
#{NUMBER},
|
||
#{SEX},
|
||
#{PHONE},
|
||
#{ROLE_IDS},
|
||
#{DEPARTMENT_ID},
|
||
#{POST_ID},
|
||
#{ISMAIN},
|
||
#{FUN_IDS},
|
||
#{SORT},
|
||
#{LEARNERCATEGORY},
|
||
#{USERAVATARPREFIX},
|
||
#{USERAVATARURL},
|
||
#{SHIFTDUTYONE},
|
||
#{SHIFTDUTYTWO},
|
||
#{DURATION},
|
||
#{WORKSTATUS},
|
||
#{WORKPERIOD},
|
||
#{ISSTUDENT},
|
||
#{RIGHTS},
|
||
#{CORPINFO_ID},
|
||
#{IS_SAFETY},
|
||
0,
|
||
#{ISHEAD},
|
||
#{CARDNO},
|
||
#{PLS_ID},
|
||
#{ISLEADER}
|
||
</sql>
|
||
|
||
<!-- 字段2 -->
|
||
<sql id="Field2">
|
||
f.USER_ID,
|
||
f.USERNAME,
|
||
f.PASSWORD,
|
||
f.NAME,
|
||
f.ROLE_ID,
|
||
f.LAST_LOGIN,
|
||
f.IP,
|
||
f.STATUS,
|
||
f.BZ,
|
||
f.SKIN,
|
||
f.EMAIL,
|
||
f.NUMBER,
|
||
f.SEX,
|
||
f.PHONE,
|
||
f.ROLE_IDS,
|
||
f.DEPARTMENT_ID,
|
||
f.POST_ID,
|
||
f.ISMAIN,
|
||
f.FUN_IDS,
|
||
f.SORT,
|
||
f.LEARNERCATEGORY,
|
||
f.USERAVATARPREFIX,
|
||
f.USERAVATARURL,
|
||
f.SHIFTDUTYONE,
|
||
f.SHIFTDUTYTWO,
|
||
f.DURATION,
|
||
f.WORKSTATUS,
|
||
f.WORKPERIOD,
|
||
f.ISSTUDENT,
|
||
f.IS_SAFETY,
|
||
f.CORPINFO_ID,
|
||
f.ISHEAD,
|
||
f.CARDNO,
|
||
f.PLS_ID,
|
||
f.ISLEADER
|
||
</sql>
|
||
|
||
<!-- 通过USERNAME获取数据 -->
|
||
<select id="findByUsername" parameterType="pd" resultType="pd" >
|
||
select
|
||
<include refid="Field"></include>
|
||
from
|
||
<include refid="tableName"></include>
|
||
where ISDELETE = 0 and
|
||
USERNAME = #{USERNAME}
|
||
<if test="NAME != null and NAME != ''">
|
||
and NAME = #{NAME}
|
||
</if>
|
||
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
|
||
and CORPINFO_ID = #{CORPINFO_ID}
|
||
</if>
|
||
<if test="VERIFYUSER_ID != null and VERIFYUSER_ID != ''">
|
||
and USER_ID != #{VERIFYUSER_ID}
|
||
</if>
|
||
<if test="DEPARTMENT_ID != null and DEPARTMENT_ID != ''">
|
||
and DEPARTMENT_ID = #{DEPARTMENT_ID}
|
||
</if>
|
||
</select>
|
||
<select id="findByName" parameterType="pd" resultType="pd" >
|
||
select
|
||
<include refid="Field"></include>
|
||
from
|
||
<include refid="tableName"></include>
|
||
where ISDELETE = 0 and
|
||
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="Field2"></include>,
|
||
c.CORP_NAME,
|
||
p.NAME AS POST_NAME,
|
||
d.NAME AS DEPARTMENT_NAME,
|
||
ui.USER_ID_CARD,
|
||
ui.DEGREE_OF_EDUCATION,
|
||
ui.DUTIES,
|
||
du.NAME DUTIES_NAME,
|
||
dt.NAME TITLE_NAME,
|
||
ui.PERSONNEL_TYPE,
|
||
ui.CERTIFICATETYPE
|
||
from
|
||
<include refid="tableName"></include>f
|
||
left join BUS_CORP_INFO c on c.CORPINFO_ID=f.CORPINFO_ID
|
||
left join OA_DEPARTMENT d on d.DEPARTMENT_ID=f.DEPARTMENT_ID
|
||
left join SYS_POST p on p.POST_ID=f.POST_ID
|
||
left join SYS_USERINFO ui on ui.USER_ID = f.USER_ID
|
||
left join SYS_DICTIONARIES_CORP du on du.DICTIONARIES_ID = ui.DUTIES
|
||
LEFT JOIN SYS_DICTIONARIES_CORP dt on dt.DICTIONARIES_ID = ui.TITLE
|
||
where
|
||
f.USER_ID = #{USER_ID} and f.ISDELETE = 0
|
||
</select>
|
||
|
||
<!-- 通过邮箱获取数据 -->
|
||
<select id="findByEmail" parameterType="pd" resultType="pd" >
|
||
select
|
||
<include refid="Field"></include>
|
||
from
|
||
<include refid="tableName"></include>
|
||
where ISDELETE = 0 and
|
||
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 ISDELETE = 0 and
|
||
NUMBER = #{NUMBER}
|
||
<if test="USERNAME != null and USERNAME != ''">
|
||
and USERNAME != #{USERNAME}
|
||
</if>
|
||
</select>
|
||
|
||
<!-- 列出某角色下的所有用户 -->
|
||
<select id="listAllUserByRoldId" parameterType="pd" resultType="pd" >
|
||
select USER_ID
|
||
from
|
||
<include refid="tableName"></include>
|
||
where ISDELETE = 0 and
|
||
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="editUserState" parameterType="pd" >
|
||
update <include refid="tableName"></include>
|
||
set ISSTUDENT = 'true'
|
||
where
|
||
USER_ID = #{USER_ID}
|
||
</update>
|
||
<!-- 修改 -->
|
||
<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},
|
||
SEX = #{SEX},
|
||
EMAIL = #{EMAIL},
|
||
NUMBER = #{NUMBER},
|
||
SORT = #{SORT},
|
||
CARDNO = #{CARDNO},
|
||
PHONE = #{PHONE}
|
||
<if test="LEARNERCATEGORY != null and LEARNERCATEGORY != ''">
|
||
,LEARNERCATEGORY = #{LEARNERCATEGORY}
|
||
</if>
|
||
<if test="USERAVATARURL != null">
|
||
,USERAVATARPREFIX = #{USERAVATARPREFIX}
|
||
,USERAVATARURL = #{USERAVATARURL}
|
||
</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="ISSTUDENT != null and ISSTUDENT != ''">
|
||
,ISSTUDENT = #{ISSTUDENT}
|
||
</if>
|
||
<if test="IS_SAFETY != null and IS_SAFETY != ''">
|
||
,IS_SAFETY = #{IS_SAFETY}
|
||
</if>
|
||
<if test="ISHEAD != null and ISHEAD != ''">
|
||
,ISHEAD = #{ISHEAD}
|
||
</if>
|
||
<if test="ISLEADER != null and ISLEADER != ''">
|
||
,ISLEADER = #{ISLEADER}
|
||
</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="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 ISDELETE = 0 and
|
||
DEPARTMENT_ID =#{DEPARTMENT_ID}
|
||
and STATUS = '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.SHIFTDUTYONE,
|
||
u.SHIFTDUTYTWO,
|
||
u.DURATION,
|
||
u.WORKSTATUS,
|
||
u.WORKPERIOD,
|
||
u.DEPARTMENT_ID,
|
||
u.POST_ID,
|
||
r.ROLE_ID,
|
||
r.ROLE_NAME,
|
||
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>
|
||
,info.USER_ID_CARD
|
||
,info.CERTIFICATETYPE
|
||
,info.DEGREE_OF_EDUCATION
|
||
,info.PERSONNEL_TYPE
|
||
,info.DUTIES
|
||
,dic.`BIANMA` as PERSONNEL_TYPE_BIANMA
|
||
,dic.`NAME` as PERSONNEL_TYPE_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
|
||
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
|
||
left join SYS_DICTIONARIES dic on dic.DICTIONARIES_ID = info.PERSONNEL_TYPE
|
||
where
|
||
u.ISDELETE = 0
|
||
and u.USERNAME != 'admin'
|
||
<if test="pd.VIPLEVEL != null and pd.VIPLEVEL != ''"> <!-- 角色检索 -->
|
||
and r.PARENT_ID=#{pd.VIPLEVEL}
|
||
</if>
|
||
<if test="pd.VIPLEVEL == null or pd.VIPLEVEL == ''"> <!-- 角色检索 -->
|
||
and r.PARENT_ID = '1'
|
||
</if>
|
||
<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.STARTTIME!=null and pd.STARTTIME!=''"> <!-- 登录时间检索 -->
|
||
and u.LAST_LOGIN >= #{pd.STARTTIME}
|
||
</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_STUDENT != null and pd.IS_STUDENT != ''">
|
||
and u.ISSTUDENT = #{pd.IS_STUDENT}
|
||
</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>
|
||
order by d.LEVEL asc ,d.DEP_ORDER,d.DEPARTMENT_ID asc, u.SORT asc,u.LAST_LOGIN desc
|
||
</select>
|
||
|
||
<!-- 用户列表 -->
|
||
<select id="userSelectlistPage" parameterType="page" resultType="pd" >
|
||
select u.USER_ID,
|
||
u.USERNAME,
|
||
u.PASSWORD,
|
||
u.LAST_LOGIN,
|
||
u.NAME,
|
||
u.SEX,
|
||
u.IP,
|
||
u.EMAIL,
|
||
u.NUMBER,
|
||
u.PHONE,
|
||
u.ISMAIN,
|
||
u.PUSH_CID,
|
||
r.ROLE_ID,
|
||
r.ROLE_NAME,
|
||
d.NAME as DEPARTMENT_NAME,
|
||
p.NAME AS POST_NAME,
|
||
c.PERSONNEL_TYPE,
|
||
sd.NAME AS PERSONNEL_TYPE_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
|
||
left join SYS_USERINFO c on c.USER_ID=u.USER_ID
|
||
left join sys_dictionaries sd on sd.DICTIONARIES_ID = c.PERSONNEL_TYPE AND sd.PARENT_ID = '0b62f92b0b624aab8e89a77304a64d5e'
|
||
where
|
||
u.ISDELETE = 0 and
|
||
u.USERNAME != 'admin'
|
||
<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}),'%')
|
||
or
|
||
d.NAME 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.STARTTIME!=null and pd.STARTTIME!=''"> <!-- 登录时间检索 -->
|
||
and u.LAST_LOGIN >= #{pd.STARTTIME}
|
||
</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>
|
||
<if test="pd.PERSONNEL_TYPE != null and pd.PERSONNEL_TYPE != ''"><!-- 关键词检索 -->
|
||
AND c.PERSONNEL_TYPE = #{pd.PERSONNEL_TYPE}
|
||
</if>
|
||
order by d.LEVEL asc ,d.DEP_ORDER,d.DEPARTMENT_ID asc, u.SORT asc,u.USER_ID
|
||
</select>
|
||
|
||
<!-- 获取账号及部门岗位 -->
|
||
<select id="listUserlistPage" parameterType="page" resultType="pd" >
|
||
select
|
||
u.USER_ID,
|
||
u.NAME USERNAME,
|
||
d.NAME DEPARTNAME,
|
||
getFullName(d.DEPARTMENT_ID) DEPARTNAME_ALL,
|
||
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 =#{pd.CORPINFO_ID}
|
||
AND u.STATUS = '0'
|
||
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
|
||
and
|
||
(
|
||
p.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||
or
|
||
u.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||
)
|
||
</if>
|
||
<!-- <if test="DEPARTMENT_ID != null and DEPARTMENT_ID != ''">关键词检索
|
||
and d.DEPARTMENT_ID = #{DEPARTMENT_ID}
|
||
</if> -->
|
||
|
||
|
||
<choose>
|
||
<when test='pd.ISMAIN != null and pd.ISMAIN != "" and pd.ISMAIN == "1"'>
|
||
<if test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
||
and
|
||
d.DEPARTMENT_ID in
|
||
<foreach item="item" index="index"
|
||
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
||
'${item}'
|
||
</foreach>
|
||
</if>
|
||
</when>
|
||
<otherwise>
|
||
<choose>
|
||
<when test='pd.ISSUPERVISE != null and pd.ISSUPERVISE != "" and pd.ISSUPERVISE == "1"'>
|
||
<choose>
|
||
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
||
and
|
||
d.DEPARTMENT_ID in
|
||
<foreach item="item" index="index"
|
||
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
||
'${item}'
|
||
</foreach>
|
||
</when>
|
||
<otherwise>
|
||
and
|
||
d.DEPARTMENT_ID in (
|
||
select
|
||
SUB_DEPARTMENT_ID
|
||
from
|
||
oa_supervision_department osd
|
||
where
|
||
osd.SUP_DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
|
||
and osd.ISDELETE = '0'
|
||
and osd.CORPINFO_ID = #{pd.CORPINFO_ID}
|
||
)
|
||
</otherwise>
|
||
</choose>
|
||
</when>
|
||
<when test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''">
|
||
and d.DEPARTMENT_ID=#{pd.DEPARTMENT_ID}
|
||
</when>
|
||
<otherwise>
|
||
</otherwise>
|
||
</choose>
|
||
</otherwise>
|
||
</choose>
|
||
|
||
<if test="pd.NOMAIN != null and pd.NOMAIN != ''"><!-- 关键词检索 -->
|
||
and u.ISMAIN = '0'
|
||
</if>
|
||
order by
|
||
d.LEVEL,d.DEP_ORDER,d.DEPARTMENT_ID,u.SORT
|
||
</select>
|
||
|
||
<!-- 用户列表(全部) -->
|
||
<select id="listAllUser" parameterType="pd" resultType="com.zcloud.entity.PageData" >
|
||
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.ISDELETE = 0 and u.ROLE_ID = r.ROLE_ID
|
||
and u.USERNAME != 'admin'
|
||
<!-- 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="STARTTIME!=null and STARTTIME!=''"><!-- 登录时间检索 -->
|
||
and u.LAST_LOGIN >= #{STARTTIME}
|
||
</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="NAME != null and NAME != ''"><!-- 关键词检索 -->
|
||
AND
|
||
u.NAME = #{NAME}
|
||
</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>
|
||
order by u.DEPARTMENT_ID asc, u.SORT asc,u.LAST_LOGIN desc
|
||
</select>
|
||
|
||
<!-- 查询部门下用户 -->
|
||
<select id="listUserByDept" 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,
|
||
r.ROLE_NAME
|
||
from <include refid="tableName"></include> u, <include refid="roleTableName"></include> r
|
||
where u.ISDELETE = 0 and u.ROLE_ID = r.ROLE_ID
|
||
and u.USERNAME != 'admin'
|
||
<!-- 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="STARTTIME!=null and STARTTIME!=''"><!-- 登录时间检索 -->
|
||
and u.LAST_LOGIN >= #{STARTTIME}
|
||
</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>
|
||
<choose>
|
||
<when test='ISMAIN != null and ISMAIN != "" and ISMAIN == "1"'>
|
||
<if test="DEPT_IDS != null and DEPT_IDS != ''">
|
||
and
|
||
u.DEPARTMENT_ID in
|
||
<foreach item="item" index="index"
|
||
collection="DEPT_IDS" open="(" separator="," close=")">
|
||
'${item}'
|
||
</foreach>
|
||
</if>
|
||
</when>
|
||
<otherwise>
|
||
<choose>
|
||
<when test='ISSUPERVISE != null and ISSUPERVISE != "" and ISSUPERVISE == "1"'>
|
||
<choose>
|
||
<when test="DEPT_IDS != null and DEPT_IDS != ''">
|
||
and
|
||
u.DEPARTMENT_ID in
|
||
<foreach item="item" index="index"
|
||
collection="DEPT_IDS" open="(" separator="," close=")">
|
||
'${item}'
|
||
</foreach>
|
||
</when>
|
||
<otherwise>
|
||
and
|
||
u.DEPARTMENT_ID in (
|
||
select
|
||
SUB_DEPARTMENT_ID
|
||
from
|
||
oa_supervision_department osd
|
||
where
|
||
osd.SUP_DEPARTMENT_ID = #{DEPARTMENT_ID}
|
||
and osd.ISDELETE = '0'
|
||
and osd.CORPINFO_ID = #{CORPINFO_ID}
|
||
)
|
||
</otherwise>
|
||
</choose>
|
||
</when>
|
||
<when test="DEPARTMENT_ID != null and DEPARTMENT_ID != ''">
|
||
and u.DEPARTMENT_ID=#{DEPARTMENT_ID}
|
||
</when>
|
||
<otherwise>
|
||
</otherwise>
|
||
</choose>
|
||
</otherwise>
|
||
</choose>
|
||
<if test="NOSELF != null and NOSELF != ''"><!-- 关键词检索 -->
|
||
AND
|
||
u.USER_ID != #{LOGINUSERID}
|
||
</if>
|
||
order by u.DEPARTMENT_ID asc, u.SORT asc,u.LAST_LOGIN desc
|
||
</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.ISDELETE = 0 and 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}
|
||
where
|
||
USERNAME = #{USERNAME}
|
||
</update>
|
||
|
||
<!-- 保存用户皮肤 -->
|
||
<update id="saveSkin" parameterType="pd" >
|
||
update
|
||
<include refid="tableName"></include>
|
||
set
|
||
SKIN = #{SKIN}
|
||
where USERNAME = #{USERNAME}
|
||
</update>
|
||
|
||
<!-- 删除用户 -->
|
||
<update id="deleteUser" parameterType="pd">
|
||
update
|
||
<include refid="tableName"></include>
|
||
set ISDELETE = 1
|
||
where
|
||
USER_ID = #{USER_ID}
|
||
and
|
||
USER_ID != '1'
|
||
</update>
|
||
|
||
<!-- 列表(全部) -->
|
||
<select id="listAll" parameterType="pd" resultType="pd">
|
||
select
|
||
f.USER_ID,
|
||
f.USERNAME,
|
||
un.NAME as POST_NAME
|
||
from
|
||
<include refid="tableName"></include> f
|
||
left join SYS_POST un on un.POST_ID = f.POST_ID
|
||
where f.ISDELETE = '0'
|
||
<if test="POST_ID != null and POST_ID != ''">
|
||
and f.POST_ID=#{POST_ID}
|
||
</if>
|
||
</select>
|
||
|
||
<!-- 批量删除用户 -->
|
||
<update 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>
|
||
and
|
||
USER_ID != '1'
|
||
</update>
|
||
|
||
<!-- 用户列表(弹窗选择用) -->
|
||
<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.ISDELETE = 0 and u.ROLE_ID = r.ROLE_ID
|
||
and u.USERNAME != 'admin'
|
||
<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.STARTTIME!=null and pd.STARTTIME!=''"> <!-- 登录时间检索 -->
|
||
and u.LAST_LOGIN >= #{pd.STARTTIME}
|
||
</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 *
|
||
from
|
||
<include refid="tableName"></include>
|
||
where ISDELETE = 0
|
||
order by DEPARTMENT_ID,SORT
|
||
</select>
|
||
<!-- 列出所有用户 -->
|
||
<select id="findAllUser" parameterType="pd" resultType="pd" >
|
||
select *
|
||
from
|
||
<include refid="tableName"></include>
|
||
where ISDELETE = 0
|
||
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,
|
||
getFullName(d.DEPARTMENT_ID) DEPARTNAME_ALL,
|
||
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.ISDELETE = 0 and
|
||
u.CORPINFO_ID =#{CORPINFO_ID}
|
||
and u.STATUS = '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> -->
|
||
|
||
|
||
<choose>
|
||
<when test='ISMAIN != null and ISMAIN != "" and ISMAIN == "1"'>
|
||
<if test="DEPT_IDS != null and DEPT_IDS != ''">
|
||
and
|
||
d.DEPARTMENT_ID in
|
||
<foreach item="item" index="index"
|
||
collection="DEPT_IDS" open="(" separator="," close=")">
|
||
'${item}'
|
||
</foreach>
|
||
</if>
|
||
</when>
|
||
<otherwise>
|
||
<choose>
|
||
<when test='ISSUPERVISE != null and ISSUPERVISE != "" and ISSUPERVISE == "1"'>
|
||
<choose>
|
||
<when test="DEPT_IDS != null and DEPT_IDS != ''">
|
||
and
|
||
d.DEPARTMENT_ID in
|
||
<foreach item="item" index="index"
|
||
collection="DEPT_IDS" open="(" separator="," close=")">
|
||
'${item}'
|
||
</foreach>
|
||
</when>
|
||
<otherwise>
|
||
and
|
||
d.DEPARTMENT_ID in (
|
||
select
|
||
SUB_DEPARTMENT_ID
|
||
from
|
||
oa_supervision_department osd
|
||
where
|
||
osd.SUP_DEPARTMENT_ID = #{DEPARTMENT_ID}
|
||
and osd.ISDELETE = '0'
|
||
and osd.CORPINFO_ID = #{CORPINFO_ID}
|
||
)
|
||
</otherwise>
|
||
</choose>
|
||
</when>
|
||
<when test="DEPARTMENT_ID != null and DEPARTMENT_ID != ''">
|
||
and d.DEPARTMENT_ID=#{DEPARTMENT_ID}
|
||
</when>
|
||
<otherwise>
|
||
</otherwise>
|
||
</choose>
|
||
</otherwise>
|
||
</choose>
|
||
|
||
<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,
|
||
u.DEPARTMENT_ID,
|
||
d.NAME as DEPARTMENT_NAME,
|
||
u.POST_ID,
|
||
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
|
||
ISDELETE = 0 and 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.ISDELETE = 0 and
|
||
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="getUserWork" parameterType="pd" resultType="pd" >
|
||
SELECT
|
||
s.USER_ID,
|
||
s.NAME,
|
||
s.DURATION,
|
||
s.WORKSTATUS,
|
||
s.WORKPERIOD,
|
||
swp.ONDAY,
|
||
swp.OFFDAY,
|
||
swp.SORT,
|
||
swp.ISEND
|
||
FROM
|
||
SYS_USER s
|
||
LEFT JOIN BUS_SHIFTWORKRULES swr ON swr.SHIFTWORKRULES_ID = s.SHIFTDUTYTWO
|
||
LEFT JOIN BUS_SHIFTWORKPERIOD swp ON swp.SHIFTWORKRULES_ID = swr.SHIFTWORKRULES_ID
|
||
WHERE
|
||
s.ISDELETE = 0 and
|
||
s.WORKPERIOD = swp.SORT
|
||
AND s.CORPINFO_ID = swr.CORPINFO_ID
|
||
AND swr.ISDELETE = '0'
|
||
AND swp.ISDELETE = '0'
|
||
AND swr.ISCUSTOM = '1'
|
||
</select>
|
||
|
||
<!--修改用户倒班周期 -->
|
||
<update id="editShiftWork" parameterType="pd" >
|
||
update
|
||
sys_user
|
||
SET
|
||
USER_ID = #{USER_ID}
|
||
<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>
|
||
where
|
||
USER_ID = #{USER_ID}
|
||
</update>
|
||
|
||
|
||
<!-- 获取人员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.ISDELETE = 0 and
|
||
u.CORPINFO_ID = #{CORPINFO_ID}
|
||
and u.STATUS = '0'
|
||
<if test="BIANMA != null and BIANMA != '' and BIANMA != 'departmentLevel0001'" ><!-- 部门级别 -->
|
||
and d.LEVEL = #{BIANMA}
|
||
</if>
|
||
<if test="BIANMA == 'departmentLevel0001'"><!-- 部门级别 -->
|
||
and d.PARENT_ID = '0'
|
||
</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>
|
||
|
||
<!--清除在线学习人员分类 -->
|
||
<update id="clearLearnerCategory" parameterType="pd" >
|
||
UPDATE
|
||
<include refid="tableName"></include> u
|
||
SET
|
||
u.LEARNERCATEGORY = NULL
|
||
WHERE
|
||
u.CORPINFO_ID = #{CORPINFO_ID}
|
||
and u.LEARNERCATEGORY = #{DICTIONARIES_ID}
|
||
</update>
|
||
<!-- 获取账号及部门岗位 -->
|
||
<select id="listUserDepPoslistPage" parameterType="page" resultType="pd" >
|
||
select
|
||
u.USER_ID,
|
||
u.NAME USERNAME,
|
||
d.NAME DEPARTNAME,
|
||
getFullName(d.DEPARTMENT_ID) DEPARTNAME_ALL,
|
||
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.ISDELETE = 0 and
|
||
u.CORPINFO_ID =#{pd.CORPINFO_ID}
|
||
and u.STATUS = '0'
|
||
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
|
||
and
|
||
(
|
||
p.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||
or
|
||
u.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||
)
|
||
</if>
|
||
<!-- <if test="DEPARTMENT_ID != null and DEPARTMENT_ID != ''">关键词检索
|
||
and d.DEPARTMENT_ID = #{DEPARTMENT_ID}
|
||
</if> -->
|
||
|
||
|
||
<choose>
|
||
<when test='pd.ISMAIN != null and pd.ISMAIN != "" and pd.ISMAIN == "1"'>
|
||
<if test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
||
and
|
||
d.DEPARTMENT_ID in
|
||
<foreach item="item" index="index"
|
||
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
||
'${item}'
|
||
</foreach>
|
||
</if>
|
||
</when>
|
||
<otherwise>
|
||
<choose>
|
||
<when test='pd.ISSUPERVISE != null and pd.ISSUPERVISE != "" and pd.ISSUPERVISE == "1"'>
|
||
<choose>
|
||
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
||
and
|
||
d.DEPARTMENT_ID in
|
||
<foreach item="item" index="index"
|
||
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
||
'${item}'
|
||
</foreach>
|
||
</when>
|
||
<otherwise>
|
||
and
|
||
d.DEPARTMENT_ID in (
|
||
select
|
||
SUB_DEPARTMENT_ID
|
||
from
|
||
oa_supervision_department osd
|
||
where
|
||
osd.SUP_DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
|
||
and osd.ISDELETE = '0'
|
||
and osd.CORPINFO_ID = #{pd.CORPINFO_ID}
|
||
)
|
||
</otherwise>
|
||
</choose>
|
||
</when>
|
||
<when test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''">
|
||
and d.DEPARTMENT_ID=#{pd.DEPARTMENT_ID}
|
||
</when>
|
||
<otherwise>
|
||
</otherwise>
|
||
</choose>
|
||
</otherwise>
|
||
</choose>
|
||
|
||
<if test="pd.NOMAIN != null and pd.NOMAIN != ''"><!-- 关键词检索 -->
|
||
and u.ISMAIN = '0'
|
||
</if>
|
||
order by
|
||
d.LEVEL,d.DEP_ORDER,d.DEPARTMENT_ID,u.SORT
|
||
</select>
|
||
<update id="updateCornUser" parameterType="pd" >
|
||
update
|
||
<include refid="tableName"></include>
|
||
set
|
||
USERNAME = #{USERNAME},
|
||
NAME = #{NAME},
|
||
PASSWORD = #{PASSWORD}
|
||
where
|
||
USERNAME = #{OLDUSERNAME}
|
||
and
|
||
CORPINFO_ID = #{CORPINFO_ID}
|
||
</update>
|
||
<update id="removeCardNoUser">
|
||
update
|
||
<include refid="tableName"></include>
|
||
set
|
||
CARDNO = null
|
||
where
|
||
CORPINFO_ID = #{CORPINFO_ID} and
|
||
CARDNO in <foreach item="item" collection="USER_IDS" index="index" separator="," open="(" close=")">
|
||
#{item}
|
||
</foreach>
|
||
</update>
|
||
<update id="editUserCardNoByPid">
|
||
update
|
||
<include refid="tableName"></include>
|
||
set
|
||
CARDNO = #{cardNo}
|
||
where
|
||
PLS_ID = #{psnId}
|
||
</update>
|
||
|
||
<!-- 查询用户名称及部门名称 -->
|
||
<select id="findUserDept" parameterType="pd" resultType="pd" >
|
||
SELECT
|
||
s.USER_ID,
|
||
s.NAME USER_NAME,
|
||
d.NAME DEPARTMENT_NAME
|
||
FROM
|
||
SYS_USER s
|
||
LEFT JOIN OA_DEPARTMENT d ON d.DEPARTMENT_ID = s.DEPARTMENT_ID
|
||
WHERE
|
||
s.USER_ID = #{USER_ID}
|
||
</select>
|
||
|
||
<!-- 用户列表(本部门及所有上级部门领导负责人) -->
|
||
<select id="listUserLeader" parameterType="pd" resultType="pd" >
|
||
SELECT
|
||
f.USER_ID,
|
||
f.NAME USER_NAME,
|
||
d.NAME DEPARTMENT_NAME,
|
||
CONCAT(f.NAME, ' [', d.NAME, ']') NAME
|
||
FROM
|
||
SYS_USER f
|
||
LEFT JOIN OA_DEPARTMENT d ON d.DEPARTMENT_ID = f.DEPARTMENT_ID
|
||
where f.ISDELETE = 0 and f.ISLEADER = '1'
|
||
<if test="DEPT_IDS != null and !DEPT_IDS.isEmpty()">
|
||
and d.DEPARTMENT_ID in
|
||
<foreach item="item" index="index"
|
||
collection="DEPT_IDS" open="(" separator="," close=")">
|
||
'${item}'
|
||
</foreach>
|
||
</if>
|
||
order by d.DEPARTMENT_ID,d.DEP_ORDER
|
||
</select>
|
||
|
||
<!-- 用户列表(全部) -->
|
||
<select id="listUserAndDept" parameterType="pd" resultType="com.zcloud.entity.PageData">
|
||
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>
|
||
|
||
<select id="findByRegulatoryId" parameterType="pd" resultType="com.zcloud.entity.PageData">
|
||
select
|
||
*
|
||
from
|
||
`qa-gwj-regulatory`.SYS_USER
|
||
where USER_ID = #{USER_ID}
|
||
</select>
|
||
|
||
<!-- 通过用户ID获取数据 -->
|
||
<select id="findByIdForEmis" parameterType="pd" resultType="com.zcloud.entity.PageData" >
|
||
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="findByCardNo" resultType="com.zcloud.entity.PageData">
|
||
select
|
||
*
|
||
from
|
||
<include refid="tableName"></include>
|
||
where
|
||
CARDNO = #{CARDNO} and CORPINFO_ID = #{CORPINFO_ID} and ISDELETE = 0
|
||
</select>
|
||
<select id="getUserCardNoAll" resultType="com.zcloud.entity.PageData">
|
||
select
|
||
USERNAME,
|
||
CARDNO
|
||
from
|
||
<include refid="tableName"></include>
|
||
where CORPINFO_ID = #{CORPINFO_ID} and ISDELETE = 0
|
||
</select>
|
||
<select id="getUserByCardNo" resultType="com.zcloud.entity.PageData">
|
||
select u.*,
|
||
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.CARDNO = #{CARDNO} and u.ISDELETE = 0
|
||
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
|
||
and u.CORPINFO_ID = #{CORPINFO_ID}
|
||
</if>
|
||
</select>
|
||
|
||
<select id="selectUserListByUserIds" resultType="com.zcloud.entity.PageData">
|
||
<if test=" ids != null and ids != ''">
|
||
select
|
||
f.NAME,
|
||
f.DEPARTMENT_ID as INSPECTION_DEPARTMENT_ID,
|
||
f.USER_ID as INSPECTION_USER_ID,
|
||
sd.name as punishname
|
||
from sys_user f
|
||
LEFT JOIN oa_department 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>
|
||
</if>
|
||
</select>
|
||
|
||
<select id="simplelistPage" parameterType="page" resultType="pd">
|
||
select
|
||
DISTINCT a.USER_ID,
|
||
a.USERNAME,
|
||
a.NAME,
|
||
a.CERTIFICATETYPE,
|
||
b.NAME as CERTIFICATETYPE_NAME,
|
||
a.NUMBER,
|
||
a.PHONE,
|
||
a.CULTURAL_LEVEL,
|
||
c.NAME as CULTURAL_LEVEL_NAME,
|
||
a.PORTRAIT,
|
||
a.ID_PHOTO,
|
||
a.USER_ID_CARD,
|
||
a.CREATTIME
|
||
from <include refid="tableName"></include> a
|
||
LEFT JOIN `qa-traffic-education-org`.bus_student s on s.USER_ID = a.USER_ID
|
||
left join SYS_DICTIONARIES b on b.DICTIONARIES_ID = a.CERTIFICATETYPE
|
||
left join SYS_DICTIONARIES c on c.DICTIONARIES_ID = a.CULTURAL_LEVEL
|
||
where a.USERNAME != 'admin'
|
||
and a.ISDELETE = '0'
|
||
<if test="pd.NAME!= null and pd.NAME != ''"><!-- 关键词检索 -->
|
||
and a.NAME LIKE CONCAT(CONCAT('%', #{pd.NAME}),'%')
|
||
</if>
|
||
<if test="pd.CORPINFO_ID != null and pd.CORPINFO_ID != ''">
|
||
and s.CORPINFO_ID = #{pd.CORPINFO_ID}
|
||
</if>
|
||
<if test="pd.USER_ID != null and pd.USER_ID != ''">
|
||
and d.CREATOR = #{pd.USER_ID}
|
||
</if>
|
||
order by a.LAST_LOGIN desc
|
||
</select>
|
||
|
||
<!-- 修改图片 -->
|
||
<update id="editPhoto" parameterType="pd">
|
||
update
|
||
<include refid="tableName"></include>
|
||
set
|
||
<if test="ID_PHOTO != null and ID_PHOTO != ''">
|
||
ID_PHOTO = #{ID_PHOTO},
|
||
</if>
|
||
<if test="SIGNATURE_FILE_PATH != null and SIGNATURE_FILE_PATH != ''">
|
||
SIGNATURE_FILE_PATH = #{SIGNATURE_FILE_PATH},
|
||
</if>
|
||
OPERATOR = #{OPERATOR},
|
||
OPERATTIME = #{OPERATTIME}
|
||
where
|
||
USER_ID = #{USER_ID}
|
||
</update>
|
||
|
||
<update id="editAuthentication" parameterType="pd">
|
||
update
|
||
<include refid="tableName"></include>
|
||
set
|
||
AUTHENTICATION = #{AUTHENTICATION},
|
||
OPERATOR = #{OPERATOR},
|
||
OPERATTIME = #{OPERATTIME}
|
||
where
|
||
USER_ID = #{USER_ID}
|
||
and AUTHENTICATION = '0'
|
||
</update>
|
||
<select id="findTemporaryStudent" resultType="com.zcloud.entity.PageData">
|
||
select a.NAME,
|
||
c.NAME as CERTIFICATETYPE_NAME,
|
||
b.USER_ID_CARD,
|
||
b.PHONE,
|
||
case if(length(a.USER_ID_CARD) = 18, cast(substring(a.USER_ID_CARD, 17, 1) as UNSIGNED)%2,
|
||
if(length(a.USER_ID_CARD) = 15, cast(substring(a.USER_ID_CARD, 15, 1) as UNSIGNED)%2, 3))
|
||
when 1 then '男'
|
||
when 0 then '女'
|
||
else '未知' end as SEX_NAME,
|
||
e.NAME as DEGREE_OF_EDUCATION_NAME,
|
||
b.DUTIES,
|
||
b.DEPARTMENT_NAME,
|
||
b.POST_NAME,
|
||
h.NAME as PERSONNEL_TYPE_NAME,
|
||
b.CREATTIME
|
||
from sys_user a
|
||
left join bus_student b on a.USER_ID = b.USER_ID and b.ISDELETE = '0'
|
||
left join sys_dictionaries c on a.CERTIFICATETYPE = c.DICTIONARIES_ID
|
||
left join sys_dictionaries e on b.DEGREE_OF_EDUCATION = e.DICTIONARIES_ID and a.USER_ID = b.USER_ID
|
||
left join sys_dictionaries h on b.PERSONNEL_TYPE = h.DICTIONARIES_ID and a.USER_ID = b.USER_ID
|
||
where a.USER_ID = #{USER_ID};
|
||
</select>
|
||
|
||
<!-- 通过用户身份证号获取数据 -->
|
||
<select id="findByIdCard" parameterType="pd" resultType="pd">
|
||
select
|
||
<include refid="Field2"></include>
|
||
from
|
||
<include refid="tableName"></include>
|
||
f
|
||
where
|
||
f.ISDELETE = '0'
|
||
and f.USER_ID_CARD = #{USER_ID_CARD}
|
||
</select>
|
||
<select id="getByUserId" resultType="com.zcloud.entity.PageData">
|
||
select
|
||
<include refid="Field"></include>, a.NAME as POST_NAME
|
||
from
|
||
<include refid="tableName"></include>
|
||
f
|
||
left join bus_post_type a on a.POSTTYPE_ID = f.POST_ID
|
||
where
|
||
f.USER_ID = #{USER_ID}
|
||
</select>
|
||
|
||
<!-- 用户列表 -->
|
||
<select id="studentlist" 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.SHIFTDUTYONE,
|
||
u.SHIFTDUTYTWO,
|
||
u.DURATION,
|
||
u.WORKSTATUS,
|
||
u.WORKPERIOD,
|
||
u.DEPARTMENT_ID,
|
||
u.POST_ID,
|
||
d.NAME as DEPARTMENT_NAME,
|
||
p.NAME AS POST_NAME,
|
||
info.IS_RECORDER,
|
||
info.IS_CHARGE
|
||
,info.USER_ID_CARD
|
||
,info.CERTIFICATETYPE
|
||
,info.DEGREE_OF_EDUCATION
|
||
,info.PERSONNEL_TYPE
|
||
,info.DUTIES
|
||
,dic.`NAME` as PERSONNEL_TYPE_NAME
|
||
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
|
||
left join SYS_USERINFO info on info.USER_ID = u.USER_ID
|
||
left join SYS_DICTIONARIES dic on dic.DICTIONARIES_ID = info.PERSONNEL_TYPE
|
||
where
|
||
u.ISDELETE = 0
|
||
and u.USERNAME != 'admin'
|
||
and u.ISSTUDENT = 'true'
|
||
<if test="CORPINFO_ID != null and CORPINFO_ID != ''"><!-- 关键词检索 -->
|
||
AND
|
||
u.CORPINFO_ID = #{CORPINFO_ID}
|
||
</if>
|
||
<if test="personnelTypes != null">
|
||
and info.PERSONNEL_TYPE in
|
||
<foreach item="item" index="index" collection="personnelTypes" open="(" separator="," close=")">
|
||
#{item}
|
||
</foreach>
|
||
</if>
|
||
order by d.LEVEL asc ,d.DEP_ORDER,d.DEPARTMENT_ID asc, u.SORT asc,u.LAST_LOGIN desc
|
||
</select>
|
||
|
||
<select id="userSelectPersonTypelist" resultType="com.zcloud.entity.PageData">
|
||
select u.USER_ID,
|
||
u.USERNAME,
|
||
u.PASSWORD,
|
||
u.LAST_LOGIN,
|
||
u.NAME,
|
||
u.IP,
|
||
u.EMAIL,
|
||
u.NUMBER,
|
||
u.PHONE,
|
||
u.ISMAIN,
|
||
u.SHIFTDUTYONE,
|
||
u.SHIFTDUTYTWO,
|
||
u.DURATION,
|
||
u.WORKSTATUS,
|
||
u.WORKPERIOD,
|
||
u.CORPINFO_ID,
|
||
u.DEPARTMENT_ID,
|
||
u.POST_ID,
|
||
u.SORT,
|
||
r.ROLE_ID,
|
||
r.ROLE_NAME,
|
||
d.NAME as DEPARTMENT_NAME,
|
||
p.NAME AS POST_NAME,
|
||
sw.NAME SHIFTDUTYONENAME,
|
||
swr.NAME SHIFTDUTYTWONAME,
|
||
info.IS_RECORDER,
|
||
info.IS_CHARGE
|
||
,info.USER_ID_CARD
|
||
,info.CERTIFICATETYPE
|
||
,info.DEGREE_OF_EDUCATION
|
||
,info.PERSONNEL_TYPE
|
||
,info.DUTIES
|
||
,info.TITLE
|
||
,info.ENTRY_DATE
|
||
<!-- ,dic.`NAME` as PERSONNEL_TYPE_NAME -->
|
||
,(SELECT GROUP_CONCAT(dic.NAME SEPARATOR ',') from SYS_DICTIONARIES dic
|
||
where dic.PARENT_ID = '0b62f92b0b624aab8e89a77304a64d5e'
|
||
and dic.BIANMA like '%TRAFFIC_EMPLOYMENT_DRIVE%'
|
||
and FIND_IN_SET(dic.DICTIONARIES_ID,info.PERSONNEL_TYPE)) as PERSONNEL_TYPE_NAME
|
||
,uc.USER_CORP_ID
|
||
,uc.APPLY_TYPE
|
||
,uc.APPLY_STATUS
|
||
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
|
||
<!-- left join SYS_DICTIONARIES dic on dic.DICTIONARIES_ID = info.PERSONNEL_TYPE -->
|
||
left join (
|
||
SELECT t1.USER_CORP_ID, t1.CORPINFO_ID, t1.USER_ID, t1.APPLY_TYPE, t1.APPLY_STATUS, t1.ISDELETE
|
||
FROM SYS_USER_CORP t1
|
||
WHERE t1.ISDELETE = '0'
|
||
<if test="APPLY_TYPE != null and APPLY_TYPE != ''">
|
||
<choose>
|
||
<when test="APPLY_TYPE == '1-3'"> AND t1.APPLY_TYPE in ('1','3')</when>
|
||
</choose>
|
||
</if> AND t1.CREATTIME = (
|
||
SELECT MAX(t2.CREATTIME)
|
||
FROM SYS_USER_CORP t2
|
||
WHERE t2.ISDELETE = '0'
|
||
<if test="APPLY_TYPE != null and APPLY_TYPE != ''">
|
||
<choose>
|
||
<when test="APPLY_TYPE == '1-3'"> AND t2.APPLY_TYPE in ('1','3')</when>
|
||
</choose>
|
||
</if> AND t2.USER_ID = t1.USER_ID)
|
||
) uc on uc.USER_ID = u.USER_ID and uc.ISDELETE = 0
|
||
where u.ISDELETE = 0
|
||
and u.USERNAME != 'admin'
|
||
<if test="VIPLEVEL != null and VIPLEVEL != ''"> <!-- 角色检索 -->
|
||
and r.PARENT_ID=#{VIPLEVEL}
|
||
</if>
|
||
<if test="VIPLEVEL == null or VIPLEVEL == ''"> <!-- 角色检索 -->
|
||
and r.PARENT_ID = '1'
|
||
</if>
|
||
<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="DEPARTMENT_ID != null and DEPARTMENT_ID != ''"> <!-- 角色检索 -->
|
||
and u.DEPARTMENT_ID=#{DEPARTMENT_ID}
|
||
</if>
|
||
<if test="STARTTIME!=null and STARTTIME!=''"> <!-- 登录时间检索 -->
|
||
and u.LAST_LOGIN >= #{STARTTIME}
|
||
</if>
|
||
<if test="ENDTIME!=null and ENDTIME!=''"> <!-- 登录时间检索 -->
|
||
and u.LAST_LOGIN <= #{ENDTIME}
|
||
</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
|
||
uc.CORPINFO_ID = #{CORPINFO_ID}
|
||
</if>
|
||
<if test="IS_ARCHIVES != null and IS_ARCHIVES != ''">
|
||
and (select count(1) from BUS_STAGESTUDENTRELATION s where s.USER_ID = u.USER_ID) > 0
|
||
</if>
|
||
<if test="IS_STUDENT != null and IS_STUDENT != ''">
|
||
and u.ISSTUDENT = #{IS_STUDENT}
|
||
</if>
|
||
<if test="PERSONNEL_TYPE != null and PERSONNEL_TYPE != ''">
|
||
and info.PERSONNEL_TYPE = #{PERSONNEL_TYPE}
|
||
</if>
|
||
<if test="IS_RECORDER != null and IS_RECORDER != '' and IS_RECORDER == 1 ">
|
||
and info.IS_RECORDER = #{IS_RECORDER}
|
||
</if>
|
||
<if test="IS_CHARGE != null and IS_CHARGE != '' and IS_CHARGE == 1 ">
|
||
and info.IS_CHARGE = #{IS_CHARGE}
|
||
</if>
|
||
order by u.SORT asc,u.LAST_LOGIN desc
|
||
</select>
|
||
|
||
<!-- 从业人员列表 userlistPage -->
|
||
<select id="practitionerlistPage" 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.SHIFTDUTYONE,
|
||
u.SHIFTDUTYTWO,
|
||
u.DURATION,
|
||
u.WORKSTATUS,
|
||
u.WORKPERIOD,
|
||
u.CORPINFO_ID,
|
||
u.DEPARTMENT_ID,
|
||
u.POST_ID,
|
||
u.SORT,
|
||
r.ROLE_ID,
|
||
r.ROLE_NAME,
|
||
d.NAME as DEPARTMENT_NAME,
|
||
p.NAME AS POST_NAME,
|
||
sw.NAME SHIFTDUTYONENAME,
|
||
swr.NAME SHIFTDUTYTWONAME,
|
||
info.IS_RECORDER,
|
||
info.IS_CHARGE
|
||
,info.USER_ID_CARD
|
||
,info.CERTIFICATETYPE
|
||
,info.DEGREE_OF_EDUCATION
|
||
,info.PERSONNEL_TYPE
|
||
,info.DUTIES
|
||
,info.TITLE
|
||
,info.ENTRY_DATE
|
||
<!-- ,dic.`NAME` as PERSONNEL_TYPE_NAME -->
|
||
,(SELECT GROUP_CONCAT(dic.NAME SEPARATOR ',') from SYS_DICTIONARIES dic
|
||
where dic.PARENT_ID = '0b62f92b0b624aab8e89a77304a64d5e'
|
||
and dic.BIANMA like '%TRAFFIC_EMPLOYMENT_DRIVE%'
|
||
and FIND_IN_SET(dic.DICTIONARIES_ID,info.PERSONNEL_TYPE)) as PERSONNEL_TYPE_NAME
|
||
,uc.USER_CORP_ID
|
||
,uc.APPLY_TYPE
|
||
,uc.APPLY_STATUS
|
||
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
|
||
<!-- left join SYS_DICTIONARIES dic on dic.DICTIONARIES_ID = info.PERSONNEL_TYPE -->
|
||
left join (
|
||
SELECT t1.USER_CORP_ID, t1.CORPINFO_ID, t1.USER_ID, t1.APPLY_TYPE, t1.APPLY_STATUS, t1.ISDELETE
|
||
FROM SYS_USER_CORP t1
|
||
WHERE t1.ISDELETE = '0'
|
||
<if test="pd.APPLY_TYPE != null and pd.APPLY_TYPE != ''">
|
||
<choose>
|
||
<when test="pd.APPLY_TYPE == '1-3'"> AND t1.APPLY_TYPE in ('1','3')</when>
|
||
</choose>
|
||
</if> AND t1.CREATTIME = (
|
||
SELECT MAX(t2.CREATTIME)
|
||
FROM SYS_USER_CORP t2
|
||
WHERE t2.ISDELETE = '0'
|
||
<if test="pd.APPLY_TYPE != null and pd.APPLY_TYPE != ''">
|
||
<choose>
|
||
<when test="pd.APPLY_TYPE == '1-3'"> AND t2.APPLY_TYPE in ('1','3')</when>
|
||
</choose>
|
||
</if> AND t2.USER_ID = t1.USER_ID)
|
||
) uc on uc.USER_ID = u.USER_ID and uc.ISDELETE = 0
|
||
where u.ISDELETE = 0
|
||
and u.USERNAME != 'admin'
|
||
<if test="pd.VIPLEVEL != null and pd.VIPLEVEL != ''"> <!-- 角色检索 -->
|
||
and r.PARENT_ID=#{pd.VIPLEVEL}
|
||
</if>
|
||
<if test="pd.VIPLEVEL == null or pd.VIPLEVEL == ''"> <!-- 角色检索 -->
|
||
and r.PARENT_ID = '1'
|
||
</if>
|
||
<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.STARTTIME!=null and pd.STARTTIME!=''"> <!-- 登录时间检索 -->
|
||
and u.LAST_LOGIN >= #{pd.STARTTIME}
|
||
</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
|
||
uc.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_STUDENT != null and pd.IS_STUDENT != ''">
|
||
and u.ISSTUDENT = #{pd.IS_STUDENT}
|
||
</if>
|
||
<if test="pd.PERSONNEL_TYPE != null and pd.PERSONNEL_TYPE != ''">
|
||
and info.PERSONNEL_TYPE LIKE CONCAT(CONCAT('%', #{pd.PERSONNEL_TYPE}),'%')
|
||
</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>
|
||
order by u.SORT asc,u.LAST_LOGIN desc
|
||
</select>
|
||
|
||
<select id="getUserByUserId" resultType="com.zcloud.entity.PageData">
|
||
select
|
||
<include refid="Field"></include>
|
||
from
|
||
<include refid="tableName"></include> f
|
||
where
|
||
f.USER_ID = #{USER_ID}
|
||
</select>
|
||
|
||
<!-- 从业人员入职审核 -->
|
||
<update id="setPractitionerReview" parameterType="pd" >
|
||
update <include refid="tableName"></include>
|
||
set
|
||
CORPINFO_ID = #{CORPINFO_ID},
|
||
DEPARTMENT_ID = #{DEPARTMENT_ID},
|
||
POST_ID = #{POST_ID},
|
||
SHIFTDUTYONE = #{SHIFTDUTYONE},
|
||
SHIFTDUTYTWO = #{SHIFTDUTYTWO},
|
||
DURATION = #{DURATION},
|
||
WORKSTATUS = #{WORKSTATUS},
|
||
WORKPERIOD = #{WORKPERIOD}
|
||
<if test="SORT != null">
|
||
,SORT = #{SORT}
|
||
</if>
|
||
where
|
||
USER_ID = #{USER_ID}
|
||
</update>
|
||
|
||
<!-- 修改从业人员信息 -->
|
||
<update id="editPractitioner" parameterType="pd" >
|
||
update <include refid="tableName"></include>
|
||
set
|
||
NAME = #{NAME},
|
||
PHONE = #{PHONE},
|
||
USER_ID = USER_ID
|
||
where
|
||
USER_ID = #{USER_ID}
|
||
</update>
|
||
|
||
<select id="getPractitionerSelectList" resultType="com.zcloud.entity.PageData">
|
||
select
|
||
u.USER_ID,
|
||
u.USERNAME,
|
||
u.PASSWORD,
|
||
u.LAST_LOGIN,
|
||
u.NAME,
|
||
u.SEX,
|
||
u.IP,
|
||
u.EMAIL,
|
||
u.NUMBER,
|
||
u.PHONE,
|
||
u.ISMAIN,
|
||
u.PUSH_CID,
|
||
r.PERSONNEL_TYPE
|
||
from <include refid="tableName"></include> u
|
||
left join sys_userinfo r on u.USER_ID = r.USER_ID
|
||
left join sys_dictionaries d on r.PERSONNEL_TYPE = d.DICTIONARIES_ID
|
||
<if test="PARENT_ID != null and PARENT_ID != ''"> <!-- 从业类别 -->
|
||
and d.PARENT_ID=#{PARENT_ID}
|
||
</if>
|
||
where u.ISDELETE = 0 and u.ISMAIN = '0' and u.CORPINFO_ID = #{CORPINFO_ID}
|
||
and d.BIANMA LIKE CONCAT(CONCAT('%', #{BIANMA}),'%')
|
||
</select>
|
||
|
||
<select id="listUserByIds" parameterType="String" resultType="pd" >
|
||
select
|
||
<include refid="Field2"></include>
|
||
from
|
||
<include refid="tableName"></include> f
|
||
where
|
||
USER_ID in
|
||
<foreach item="item" index="index" collection="array" open="(" separator="," close=")">
|
||
#{item}
|
||
</foreach>
|
||
</select>
|
||
|
||
<select id="getAllUser" resultType="com.zcloud.entity.PageData">
|
||
select u.USER_ID,
|
||
u.USERNAME,
|
||
u.PASSWORD,
|
||
u.LAST_LOGIN,
|
||
u.NAME,
|
||
u.SEX,
|
||
u.IP,
|
||
u.EMAIL,
|
||
u.NUMBER,
|
||
u.PHONE,
|
||
u.ISMAIN,
|
||
u.PUSH_CID,
|
||
r.ROLE_ID,
|
||
r.ROLE_NAME,
|
||
d.NAME as DEPARTMENT_NAME,
|
||
p.NAME AS POST_NAME,
|
||
c.PERSONNEL_TYPE,
|
||
sd.NAME AS PERSONNEL_TYPE_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
|
||
left join SYS_USERINFO c on c.USER_ID=u.USER_ID
|
||
left join sys_dictionaries sd on sd.DICTIONARIES_ID = c.PERSONNEL_TYPE AND sd.PARENT_ID = '0b62f92b0b624aab8e89a77304a64d5e'
|
||
where
|
||
u.ISDELETE = 0 and
|
||
u.USERNAME != 'admin'
|
||
<if test="CORPINFO_ID != null and CORPINFO_ID != ''"><!-- 关键词检索 -->
|
||
AND
|
||
u.CORPINFO_ID = #{CORPINFO_ID}
|
||
</if>
|
||
order by d.LEVEL asc ,d.DEP_ORDER,d.DEPARTMENT_ID asc, u.SORT asc,u.USER_ID
|
||
</select>
|
||
|
||
</mapper>
|