<?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.thhy.staff.modules.biz.platuser.mapper.PlatUserMapper">
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
t.user_id as userId,
|
t.job_num as jobNum,
|
t.real_name as realName,
|
t.phone as phone,
|
t.sex as sex,
|
t.id_no as idNo,
|
t.has_cert as hasCert,
|
t.zzmm as zzmm,
|
t.employed_time as employedTime,
|
t.come_factory_time as comeFactoryTime,
|
t.leave_factory_time as leaveFactoryTime,
|
t.jg as jg,
|
t.is_use as isUse,
|
t.status as status,
|
t.is_login as isLogin,
|
t.user_type as userType,
|
t.create_time as createTime,
|
t.create_user as createUser,
|
t.update_time as updateTime,
|
t.update_user as updateUser
|
</sql>
|
|
<sql id="condition_query">
|
<where>
|
<trim suffixOverrides=" AND ">
|
<if test="jobNum!=null and jobNum!=''">
|
t.job_num = #{jobNum} AND
|
</if>
|
<if test="realName!=null and realName!=''">
|
t.real_name = #{realName} AND
|
</if>
|
<if test="sex!=null">
|
t.sex = #{sex} AND
|
</if>
|
<if test="idNo!=null and idNo!=''">
|
t.id_no = #{idNo} AND
|
</if>
|
<if test="hasCert!=null">
|
t.has_cert = #{hasCert} AND
|
</if>
|
<if test="zzmm!=null and zzmm!=''">
|
t.zzmm = #{zzmm} AND
|
</if>
|
<if test="employedTime!=null">
|
t.employed_time = #{employedTime} AND
|
</if>
|
<if test="comeFactoryTime!=null">
|
t.come_factory_time = #{comeFactoryTime} AND
|
</if>
|
<if test="leaveFactoryTime!=null">
|
t.leave_factory_time = #{leaveFactoryTime} AND
|
</if>
|
<if test="jg!=null and jg!=''">
|
t.jg = #{jg} AND
|
</if>
|
<if test="isUse!=null">
|
t.is_use = #{isUse} AND
|
</if>
|
<if test="status!=null and status!=''">
|
t.status = #{status} AND
|
</if>
|
<if test="userType!=null">
|
t.user_type = #{userType} AND
|
</if>
|
<if test="createTime!=null">
|
t.create_time = #{createTime} AND
|
</if>
|
<if test="createUser!=null and createUser!=''">
|
t.create_user = #{createUser} AND
|
</if>
|
<if test="updateTime!=null">
|
t.update_time = #{updateTime} AND
|
</if>
|
<if test="updateUser!=null">
|
t.update_user = #{updateUser} AND
|
</if>
|
</trim>
|
</where>
|
</sql>
|
|
<select id="queryById" resultType="com.thhy.staff.modules.biz.platuser.entity.PlatUser">
|
select <include refid="Base_Column_List" />
|
from sys_plat_user t
|
where t.user_id=#{userId}
|
</select>
|
|
<select id="queryPhoneAndIsLogin" resultType="com.thhy.staff.modules.biz.platuser.entity.PlatUser">
|
select t.user_id as userId,t.phone,t.is_login as isLogin
|
from sys_plat_user t
|
where t.user_id=#{userId}
|
</select>
|
|
<select id="queryForPullDown" resultType="com.thhy.staff.modules.biz.platuser.entity.PlatUserPullDown">
|
select spu.user_id as userId,spu.real_name as realName,spu.phone from sys_plat_user spu
|
left join sys_depart_user sdu on sdu.user_id = spu.user_id
|
left join sys_com_depart smt on smt.depart_id = sdu.depart_id
|
<where>
|
<trim suffixOverrides=" AND ">
|
spu.is_use= 1 and smt.company_id = #{companyId} AND
|
<if test="realName !=null and realName !=''">
|
spu.real_name LIKE concat('%',#{realName},'%') AND
|
</if>
|
<if test="userId !=null and userId !=''">
|
sdu.user_id=#{userId} AND
|
</if>
|
</trim>
|
</where>
|
|
</select>
|
|
<select id="queryForPullDownDorm" resultType="com.thhy.staff.modules.biz.platuser.entity.PlatUserPullDown">
|
SELECT a.* from (
|
select spu.user_id as userId,spu.real_name as realName,spu.phone,
|
(select count(id) from sys_dorm_user where user_id = spu.user_id and is_use = 1) as count,
|
sdm.dorm_id
|
from sys_plat_user spu
|
left join sys_depart_user sdu on sdu.user_id = spu.user_id
|
left join sys_com_depart smt on smt.depart_id = sdu.depart_id
|
left join sys_dorm_user sdm on sdm.user_id = spu.user_id
|
where spu.is_use= 1 and smt.company_id = #{companyId}
|
<if test="realName !=null and realName !=''">
|
AND spu.real_name LIKE concat('%',#{realName},'%')
|
</if>
|
) a
|
<if test="dormId !=null and dormId !=''">
|
where (a.count < 1 or a.dorm_id = #{dormId})
|
</if>
|
<if test="dormId ==null or dormId ==''">
|
where a.count < 1
|
</if>
|
|
</select>
|
|
<select id="queryVersionById" resultType="integer">
|
select version from sys_plat_user
|
where user_id=#{userId}
|
</select>
|
|
<!--查询列表-->
|
<select id="findList" resultType="com.thhy.staff.modules.biz.platuser.entity.PlatUserListVo">
|
SELECT a.*,
|
(select GROUP_CONCAT(sgu.group_id) as groupIds
|
from sys_group_user sgu
|
left join sys_group sg on sg.group_id = sgu.group_id
|
where sgu.user_id = a.userId
|
group by sgu.user_id) as groupIds,
|
(select GROUP_CONCAT(sg.group_name) as groupNames
|
from sys_group_user sgu
|
left join sys_group sg on sg.group_id = sgu.group_id
|
where sgu.user_id = a.userId
|
group by sgu.user_id) as groupNames,
|
(select CONCAT(sc2.name,'-',sc1.name)
|
from sys_city sc1
|
left join sys_city sc2 on sc1.parentid = sc2.id
|
where sc1.id = a.jgs) as jg
|
from
|
(SELECT
|
t.user_id as userId,
|
t.job_num as jobNum,
|
t.real_name as realName,
|
t.phone as phone,
|
t.sex as sex,
|
t.id_no as idNo,
|
t.has_cert as hasCert,
|
t.zzmm as zzmm,
|
t.employed_time as employedTime,
|
t.come_factory_time as comeFactoryTime,
|
t.leave_factory_time as leaveFactoryTime,
|
t.jg as jgs,
|
t.is_use as isUse,
|
t.status as status,
|
t.user_type as userType,
|
t.is_login as isLogin,
|
t.create_time as createTime,
|
t.create_user as createUser,
|
t.update_time as updateTime,
|
t.update_user as updateUser,
|
t.photo as photo,
|
t.sync_to_device as syncToDevice,
|
sd.depart_id as departId,
|
sd.depart_name as departName,
|
sp.pos_name as posName,
|
sp.pos_id as posId,
|
dict.dict_name as zzmmValue
|
from sys_plat_user t
|
|
left join sys_depart_user sdu on sdu.user_id = t.user_id
|
left join sys_depart sd on sd.depart_id = sdu.depart_id
|
left join sys_plat_position_user spu on spu.user_id = t.user_id
|
left join sys_position sp on sp.pos_id = spu.position_id
|
left join sys_dict dict on dict.dict_id = t.zzmm
|
left join sys_com_depart scd on scd.depart_id = sdu.depart_id
|
<where>
|
<trim suffixOverrides=" AND ">
|
t.is_use = 1 AND (scd.company_id = #{companyId} or sp.company_id = #{companyId}) AND
|
<if test="userType!=null and userType !=''">
|
t.user_type = #{userType} AND
|
</if>
|
<if test="realName!=null and realName!=''">
|
t.real_name LIKE concat('%',#{realName},'%') AND
|
</if>
|
<if test="departId!=null and departId!=''">
|
sd.depart_id = #{departId} AND
|
</if>
|
<if test="posId!=null and posId!=''">
|
sp.pos_id LIKE concat('%',#{posId},'%') AND
|
</if>
|
<if test="status!=null and status !=''">
|
t.status = #{status} AND
|
</if>
|
</trim>
|
</where>
|
order by t.create_time desc
|
) a
|
|
</select>
|
|
<!--查询列表-->
|
<select id="findAll" resultType="com.thhy.staff.modules.biz.platuser.entity.PlatUser">
|
SELECT
|
<include refid="Base_Column_List" />
|
from sys_plat_user t
|
</select>
|
|
<select id="queryIdByPhone" resultType="string">
|
select user_id from sys_plat_user where phone = #{phone} and is_use = 1
|
</select>
|
|
<select id="querySysUserIdByPhone" resultType="String">
|
select user_id from sys_users where telphone = #{phone} and is_use = 1
|
</select>
|
|
<select id="queryIdByIdno" resultType="string">
|
select user_id from sys_plat_user where id_no = #{idNo} and is_use = 1
|
</select>
|
|
<!--插入操作-->
|
<insert id="insert" useGeneratedKeys="true" keyProperty="userId">
|
insert into sys_plat_user
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
<if test="userId != null">
|
user_id,
|
</if>
|
<if test="jobNum != null">
|
job_num,
|
</if>
|
<if test="realName != null">
|
real_name,
|
</if>
|
<if test="phone != null">
|
phone,
|
</if>
|
<if test="sex != null">
|
sex,
|
</if>
|
<if test="idNo != null">
|
id_no,
|
</if>
|
<if test="hasCert != null">
|
has_cert,
|
</if>
|
<if test="zzmm != null">
|
zzmm,
|
</if>
|
<if test="employedTime != null">
|
employed_time,
|
</if>
|
<if test="comeFactoryTime != null">
|
come_factory_time,
|
</if>
|
<if test="leaveFactoryTime != null">
|
leave_factory_time,
|
</if>
|
<if test="jg != null">
|
jg,
|
</if>
|
<if test="isUse != null">
|
is_use,
|
</if>
|
<if test="status != null">
|
status,
|
</if>
|
<if test="userType != null">
|
user_type,
|
</if>
|
<if test="createTime != null">
|
create_time,
|
</if>
|
<if test="createUser != null">
|
create_user,
|
</if>
|
<if test="updateTime != null">
|
update_time,
|
</if>
|
<if test="updateUser != null">
|
update_user,
|
</if>
|
<if test="isLogin != null">
|
is_login,
|
</if>
|
<if test="openId != null">
|
open_id,
|
</if>
|
<if test="applyFlag != null">
|
apply_flag,
|
</if>
|
<if test="photoUrl != null">
|
photo,
|
</if>
|
<if test="fromPlat != null">
|
from_plat,
|
</if>
|
<if test="remark != null">
|
remark,
|
</if>
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
<if test="userId != null">
|
#{userId},
|
</if>
|
<if test="jobNum != null">
|
#{jobNum},
|
</if>
|
<if test="realName != null">
|
#{realName},
|
</if>
|
<if test="phone != null">
|
#{phone},
|
</if>
|
<if test="sex != null">
|
#{sex},
|
</if>
|
<if test="idNo != null">
|
#{idNo},
|
</if>
|
<if test="hasCert != null">
|
#{hasCert},
|
</if>
|
<if test="zzmm != null">
|
#{zzmm},
|
</if>
|
<if test="employedTime != null">
|
#{employedTime},
|
</if>
|
<if test="comeFactoryTime != null">
|
#{comeFactoryTime},
|
</if>
|
<if test="leaveFactoryTime != null">
|
#{leaveFactoryTime},
|
</if>
|
<if test="jg != null">
|
#{jg},
|
</if>
|
<if test="isUse != null">
|
#{isUse},
|
</if>
|
<if test="status != null">
|
#{status},
|
</if>
|
<if test="userType != null">
|
#{userType},
|
</if>
|
<if test="createTime != null">
|
#{createTime},
|
</if>
|
<if test="createUser != null">
|
#{createUser},
|
</if>
|
<if test="updateTime != null">
|
#{updateTime},
|
</if>
|
<if test="updateUser != null">
|
#{updateUser},
|
</if>
|
<if test="isLogin != null">
|
#{isLogin},
|
</if>
|
<if test="openId != null">
|
#{openId},
|
</if>
|
<if test="applyFlag != null">
|
#{applyFlag},
|
</if>
|
<if test="photoUrl != null">
|
#{photoUrl},
|
</if>
|
<if test="fromPlat != null">
|
#{fromPlat},
|
</if>
|
<if test="remark != null">
|
#{remark},
|
</if>
|
</trim>
|
</insert>
|
|
|
<!--更新操作-->
|
<update id="update">
|
update sys_plat_user
|
<set>
|
<if test="jobNum != null">
|
job_num=#{jobNum},
|
</if>
|
<if test="phone != null">
|
phone=#{phone},
|
</if>
|
<if test="realName != null">
|
real_name=#{realName},
|
</if>
|
<if test="sex != null">
|
sex=#{sex},
|
</if>
|
<if test="idNo != null">
|
id_no=#{idNo},
|
</if>
|
<if test="hasCert != null">
|
has_cert=#{hasCert},
|
</if>
|
<if test="zzmm != null">
|
zzmm=#{zzmm},
|
</if>
|
<if test="employedTime != null">
|
employed_time=#{employedTime},
|
</if>
|
<if test="comeFactoryTime != null">
|
come_factory_time=#{comeFactoryTime},
|
</if>
|
<if test="leaveFactoryTime != null">
|
leave_factory_time=#{leaveFactoryTime},
|
</if>
|
<if test="jg != null">
|
jg=#{jg},
|
</if>
|
<if test="isUse != null">
|
is_use=#{isUse},
|
</if>
|
<if test="status != null">
|
status=#{status},
|
</if>
|
<if test="userType != null">
|
user_type=#{userType},
|
</if>
|
<if test="createTime != null">
|
create_time=#{createTime},
|
</if>
|
<if test="createUser != null">
|
create_user=#{createUser},
|
</if>
|
<if test="updateTime != null">
|
update_time=#{updateTime},
|
</if>
|
<if test="updateUser != null">
|
update_user=#{updateUser},
|
</if>
|
<if test="isLogin != null">
|
is_login=#{isLogin},
|
</if>
|
<if test="applyFlag != null">
|
apply_flag=#{applyFlag},
|
</if>
|
<if test="remark != null">
|
remark=#{remark},
|
</if>
|
<if test="photoUrl != null">
|
photo=#{photoUrl},
|
</if>
|
</set>
|
where user_id=#{userId}
|
</update>
|
|
<!--逻辑删除-->
|
<update id="deletelogic">
|
update sys_plat_user
|
SET is_use = 0
|
where user_id=#{userId}
|
</update>
|
|
<!--根据ID删除-->
|
<delete id="deleteById">
|
delete from sys_plat_user
|
where user_id=#{userId}
|
</delete>
|
|
<select id="queryMaxJobNum" resultType="int">
|
select case when max(a.maxNo) is NULL then 0 else max(a.maxNo) end as maxNo from (select SUBSTR(job_num,2,LENGTH(job_num))+0 as maxNo from sys_plat_user where user_type = #{userType}) a
|
|
</select>
|
|
<!--插入操作-->
|
<insert id="insertSysUser">
|
insert into sys_users
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
<if test="userId != null">
|
user_id,
|
</if>
|
<if test="username != null">
|
username,
|
</if>
|
<if test="password != null">
|
password,
|
</if>
|
<if test="realName != null">
|
real_name,
|
</if>
|
<if test="telphone != null">
|
telphone,
|
</if>
|
<if test="photoUrl != null">
|
photo_url,
|
</if>
|
<if test="createUser != null">
|
create_user,
|
</if>
|
<if test="createTime != null">
|
create_time,
|
</if>
|
<if test="isUse != null">
|
is_use,
|
</if>
|
<if test="sex != null">
|
sex,
|
</if>
|
<if test="email != null">
|
email,
|
</if>
|
<if test="isPlat != null">
|
is_plat,
|
</if>
|
<if test="platId != null">
|
plat_id,
|
</if>
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
<if test="userId != null">
|
#{userId},
|
</if>
|
<if test="username != null">
|
#{username},
|
</if>
|
<if test="password != null">
|
#{password},
|
</if>
|
<if test="realName != null">
|
#{realName},
|
</if>
|
<if test="telphone != null">
|
#{telphone},
|
</if>
|
<if test="photoUrl != null">
|
#{photoUrl},
|
</if>
|
<if test="createUser != null">
|
#{createUser},
|
</if>
|
<if test="createTime != null">
|
#{createTime},
|
</if>
|
<if test="isUse != null">
|
#{isUse},
|
</if>
|
<if test="sex != null">
|
#{sex},
|
</if>
|
<if test="email != null">
|
#{email},
|
</if>
|
<if test="isPlat != null">
|
#{isPlat},
|
</if>
|
<if test="platId != null">
|
#{platId},
|
</if>
|
</trim>
|
</insert>
|
|
<update id="syncDelete">
|
update sys_users set is_use=0 where username = #{jobNum}
|
</update>
|
|
<insert id="insertDepartUser" parameterType="com.thhy.staff.modules.biz.depart.entity.OtherUser">
|
insert into sys_depart_user (id,depart_id,user_id) values (#{id},#{otherId},#{userId});
|
</insert>
|
|
<insert id="insertPositionUser" parameterType="com.thhy.staff.modules.biz.depart.entity.OtherUser">
|
insert into sys_plat_position_user (id,position_id,user_id) values (#{id},#{otherId},#{userId});
|
</insert>
|
|
<insert id="insertGroupUser" parameterType="com.thhy.staff.modules.biz.depart.entity.OtherUser">
|
insert into sys_group_user (id,group_id,user_id) values (#{id},#{groupId},#{userId});
|
</insert>
|
|
<delete id="deleteGroupUserByUser">
|
delete from sys_group_user where user_id = #{userId}
|
</delete>
|
|
<delete id="deletePositionUserByUser">
|
delete from sys_plat_position_user where user_id = #{userId}
|
</delete>
|
|
<delete id="deleteDepartUserByUser">
|
delete from sys_depart_user where user_id = #{userId}
|
</delete>
|
|
<select id="queryByOpenId" resultType="com.thhy.staff.modules.biz.platuser.entity.MpRegisterInfoVo">
|
select t.user_id as userId,
|
t.real_name as realName,
|
t.phone as phone,
|
t.sex as sex,
|
t.id_no as idNo,
|
t.photo as photoUrl,
|
t.remark,
|
t.apply_flag as applyFlag,
|
t.is_login as isLogin,
|
ppu.position_id as posId,
|
sp.pos_name as posName,
|
sp.company_id as companyId,
|
sc.company_name as companyName
|
from sys_plat_user t
|
left join sys_plat_position_user ppu on ppu.user_id = t.user_id
|
left join sys_position sp on sp.pos_id = ppu.position_id
|
left join sys_company sc on sc.company_id = sp.company_id
|
where t.open_id = #{openId} and t.is_use = 1
|
</select>
|
|
<select id="queryByUserId" resultType="com.thhy.staff.modules.biz.platuser.entity.MpRegisterInfoVo">
|
select t.user_id as userId,
|
t.real_name as realName,
|
t.phone as phone,
|
t.sex as sex,
|
t.id_no as idNo,
|
t.photo as photoUrl,
|
t.remark,
|
t.apply_flag as applyFlag,
|
ppu.position_id as posId,
|
sp.pos_name as posName,
|
sp.company_id as companyId,
|
sc.company_name as companyName
|
from sys_plat_user t
|
left join sys_plat_position_user ppu on ppu.user_id = t.user_id
|
left join sys_position sp on sp.pos_id = ppu.position_id
|
left join sys_company sc on sc.company_id = sp.company_id
|
where t.user_id = #{userId} and t.is_use = 1
|
</select>
|
|
<select id="queryForDtoByUserId" resultType="com.thhy.staff.modules.biz.platuser.entity.PlatUserDto">
|
select t.user_id as userId,
|
t.real_name as realName,
|
t.sex as sex,
|
t.job_num as jobNum,
|
t.phone as phone,
|
t.id_no as idNo,
|
t.photo as photoUrl
|
from sys_plat_user t
|
where t.user_id = #{userId}
|
</select>
|
|
<select id="queryHistoryByUserId" resultType="com.thhy.staff.modules.biz.platuser.entity.ApplyHistory">
|
select ah.create_time as createTime,case when ah.process_flag = 1 then spu.real_name else su.real_name end as realName,
|
ah.apply_desc as applyDesc,ah.process_flag as processFlag
|
from t_user_apply_history ah
|
left join sys_users su on su.user_id = ah.create_user
|
left join sys_plat_user spu on spu.user_id = ah.plat_user_id
|
where ah.plat_user_id = #{userId} or ah.user_id = #{userId}
|
order by ah.create_time
|
</select>
|
|
<select id="queryApplyList" resultType="com.thhy.staff.modules.biz.platuser.entity.ApplyListVo">
|
select spu.user_id as userId,spu.real_name as realName,spu.sex,sp.pos_name as posName,spu.create_time as createTime,spu.apply_flag as applyFlag
|
from sys_plat_user spu
|
left join sys_plat_position_user sppu on sppu.user_id = spu.user_id
|
left join sys_position sp on sp.pos_id = sppu.position_id
|
where spu.user_type = 2 and sp.company_id = #{companyId}
|
<if test="realName != null and realName !=''">
|
and spu.real_name LIKE concat('%',#{realName},'%')
|
</if>
|
</select>
|
|
<update id="updateApplyStatus">
|
update sys_plat_user set apply_flag = #{applyFlag} where user_id = #{userId}
|
</update>
|
|
<update id="deleteSysUserByPlat">
|
update sys_users set is_use = 0 where plat_id = #{userId}
|
</update>
|
|
<select id="queryJobNumByUserId" resultType="com.thhy.staff.modules.biz.platuser.entity.FaceDto">
|
select job_num as jobNum,photo,real_name as realName from sys_plat_user where user_id = #{userId}
|
</select>
|
|
<update id="updateFace">
|
update sys_plat_user set photo = #{photo},sync_to_device = #{syncToDevice} where user_id = #{userId}
|
</update>
|
|
<update id="updateDelFace">
|
update sys_plat_user set sync_to_device = #{syncToDevice} where user_id = #{userId}
|
</update>
|
|
<update id="updateFaceStatus">
|
update sys_plat_user set add_face_status = #{addFaceStatus} where user_id = #{userId}
|
</update>
|
|
<insert id="addDoorHis">
|
insert into t_face_record (id,ori_str) values (REPLACE(UUID(),'-',''),#{oriStr})
|
</insert>
|
|
<insert id="insertDoorLis">
|
insert into t_face_record
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
id,
|
<if test="ipAddress!=null and ipAddress !=''">
|
ip_address,
|
</if>
|
<if test="macAddress!=null and macAddress !=''">
|
mac_address,
|
</if>
|
<if test="noticeType!=null">
|
notice_type,
|
</if>
|
<if test="employeeNoString!=null and employeeNoString !=''">
|
employee_no_string,
|
</if>
|
<if test="name!=null and name !=''">
|
name,
|
</if>
|
<if test="verify!=null">
|
verify,
|
</if>
|
<if test="oriStr!=null and oriStr !=''">
|
ori_str,
|
</if>
|
<if test="cmpType!=null and cmpType !=''">
|
cmp_type,
|
</if>
|
<if test="captureScore!=null and captureScore !=''">
|
capture_score,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
#{id},
|
<if test="ipAddress!=null and ipAddress !=''">
|
#{ipAddress},
|
</if>
|
<if test="macAddress!=null and macAddress !=''">
|
#{macAddress},
|
</if>
|
<if test="noticeType!=null">
|
#{noticeType},
|
</if>
|
<if test="employeeNoString!=null and employeeNoString !=''">
|
#{employeeNoString},
|
</if>
|
<if test="name!=null and name !=''">
|
#{name},
|
</if>
|
<if test="verify!=null">
|
#{verify},
|
</if>
|
<if test="oriStr!=null and oriStr !=''">
|
#{oriStr},
|
</if>
|
<if test="cmpType!=null and cmpType !=''">
|
#{cmpType},
|
</if>
|
<if test="captureScore!=null and captureScore !=''">
|
#{captureScore},
|
</if>
|
</trim>
|
|
</insert>
|
|
<insert id="insertDoorListener">
|
insert into t_face_record
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
id,
|
<if test="ip!=null and ip !=''">
|
ip_address,
|
</if>
|
<if test="macAddress!=null and macAddress !=''">
|
mac_address,
|
</if>
|
<if test="firstType!=null">
|
notice_type,
|
</if>
|
<if test="secType!=null">
|
notice_sec,
|
</if>
|
<if test="jobNum!=null and jobNum !=''">
|
employee_no_string,
|
</if>
|
<if test="name!=null and name !=''">
|
name,
|
</if>
|
<if test="verify!=null">
|
verify,
|
</if>
|
<if test="pic!=null">
|
pic,
|
</if>
|
<if test="lockOp!=null">
|
lock_op,
|
</if>
|
<if test="apiFlag!=null">
|
api_flag,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
#{id},
|
<if test="ip!=null and ip !=''">
|
#{ip},
|
</if>
|
<if test="macAddress!=null and macAddress !=''">
|
#{macAddress},
|
</if>
|
<if test="firstType!=null and firstType!=''">
|
#{firstType},
|
</if>
|
<if test="secType!=null">
|
#{secType},
|
</if>
|
<if test="jobNum!=null and jobNum !=''">
|
#{jobNum},
|
</if>
|
<if test="name!=null and name !=''">
|
#{name},
|
</if>
|
<if test="verify!=null">
|
#{verify},
|
</if>
|
<if test="pic!=null">
|
#{pic},
|
</if>
|
<if test="lockOp!=null">
|
#{lockOp},
|
</if>
|
<if test="apiFlag!=null">
|
#{apiFlag},
|
</if>
|
</trim>
|
|
</insert>
|
|
<select id="queryPlatUser" resultType="int">
|
select count(DISTINCT spu.user_id) as userCount from sys_plat_user spu
|
left join sys_depart_user sdu on spu.user_id = sdu.user_id
|
left join sys_com_depart scd on scd.depart_id = sdu.depart_id
|
left join sys_plat_position_user pu on pu.user_id = spu.user_id
|
left join sys_position sp on sp.pos_id = pu.position_id
|
where spu.is_use = 1 and user_type=2 and (scd.company_id = #{companyId} or sp.company_id = #{companyId})
|
</select>
|
|
|
<select id="queryDoorUser" resultType="com.thhy.staff.modules.biz.platuser.entity.DoorUserVo">
|
select fr.id,fr.create_time,fr.employee_no_string as userId,fd.through_type,spu.real_name as realName,spu.job_num as jobNum,sg.group_name as groupName,1 as staffStatus
|
from t_face_record fr
|
left join t_face_device fd on fd.dev_sno = fr.mac_address
|
left join sys_plat_user spu on spu.user_id = fr.employee_no_string
|
left join sys_group_user sgu on spu.user_id = sgu.user_id
|
left join sys_group sg on sg.group_id = sgu.group_id
|
where fr.verify = 1 and fd.through_type = 2
|
order by fr.create_time desc
|
limit 10
|
</select>
|
|
<select id="queryOriStrById" resultType="string">
|
select ori_str from t_face_record where id = #{id}
|
</select>
|
|
<select id="countInDoorUserToday" resultType="int">
|
select count(distinct fr.employee_no_string)
|
from t_face_record fr
|
left join sys_plat_user spu on spu.job_num = fr.employee_no_string
|
where fr.notice_type = 5 and fr.verify = 1 and spu.user_id is not null and (fr.mac_address='e0:ca:3c:f0:d9:3a' or fr.mac_address = 'e0:ca:3c:f0:a7:34' or fr.mac_address = 'e0:ca:3c:f0:d9:3b')
|
and DATE_FORMAT(sysdate(),'%Y-%m-%d') = DATE_FORMAT(fr.create_time,'%Y-%m-%d')
|
</select>
|
|
<select id="groupUserWorking" resultType="com.thhy.staff.modules.biz.platuser.entity.GroupWorking">
|
select sg.group_id as groupId,sg.group_name as groupName,
|
(select count(user_id) from sys_group_user where and is_use = 1 and group_id = sg.group_id) as groupUserCount
|
from sys_group sg
|
left join sys_com_depart sd on sg.depart_id = sd.depart_id
|
where sg.is_use = 1 and sd.company_id = #{companyId}
|
</select>
|
|
<select id="countFaceRecordByGroup" resultType="int">
|
select count(DISTINCT fr.employee_no_string) as count
|
from t_face_record fr
|
left join sys_plat_user spu on spu.job_num = fr.employee_no_string
|
left join sys_group_user sgu on sgu.user_id = spu.user_id and sgu.is_use = 1
|
where sgu.group_id = #{groupId} and fr.notice_type = 5 and fr.verify = 1 and DATE_FORMAT(sysdate(),'%Y-%m-%d') = DATE_FORMAT(fr.create_time,'%Y-%m-%d') and (fr.mac_address='e0:ca:3c:f0:d9:3a' or fr.mac_address = 'e0:ca:3c:f0:a7:34' or fr.mac_address = 'e0:ca:3c:f0:d9:3b')
|
</select>
|
|
<select id="queryFaceUserByJobNum" resultType="com.thhy.staff.modules.biz.platuser.entity.PlatUserFace">
|
select spu.real_name as realName,spu.phone,sp.pos_name as posName,spu.photo
|
from sys_plat_user spu
|
left join sys_plat_position_user sppu on spu.user_id = sppu.user_id
|
left join sys_position sp on sp.pos_id = sppu.position_id
|
where spu.job_num = #{jobNum}
|
</select>
|
|
<select id="queryUserFace" resultType="com.thhy.staff.modules.biz.face.entity.UserFaceVo">
|
select user_id as userId,real_name as realName,sex,photo as templateImgUrl
|
from sys_plat_user spu
|
limit #{offset},#{limit}
|
</select>
|
|
<select id="queryUserFaceSingle" resultType="com.thhy.staff.modules.biz.face.entity.UserFaceVo">
|
select user_id as userId,real_name as realName,sex,photo
|
from sys_plat_user spu
|
where user_id = #{userId}
|
</select>
|
|
<update id="syncResult">
|
update sys_plat_user set sync_success = #{syncSuccess}
|
<where>
|
<foreach item="item" index="index" collection="userIdArray" open="user_id in (" separator="," close=")">
|
#{item}
|
</foreach>
|
</where>
|
</update>
|
|
<update id="syncFail">
|
update sys_plat_user set sync_success = 2,sync_fail_reason = #{syncFailReason} where user_id = #{userId}
|
</update>
|
|
</mapper>
|