189 lines
8.3 KiB
XML
189 lines
8.3 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.bonus.business.mapper.SbdUserMapper">
|
|
|
|
|
|
<insert id="addSbdUser">
|
|
insert into robot_sbd_user(id,
|
|
data_source, user_name, sex, image, post,
|
|
work_type, mobile, create_time, update_time, del_flag,age,id_card
|
|
)values (#{id},0,#{userName},#{sex},#{image},#{post},#{workType},#{mobile},now(),now(),0,#{age},#{idCard})
|
|
|
|
</insert>
|
|
<!--更新送检单人员数据-->
|
|
<insert id="replaceSbdUserInfo">
|
|
replace into robot_sbd_user(
|
|
id, data_source, user_name, sex, image, post,
|
|
work_type, mobile, create_time, update_time, del_flag,age,id_card
|
|
)values
|
|
<foreach collection="list" item="item" separator=",">(
|
|
#{item.id}, #{item.dataSource},#{item.userName},#{item.sex},
|
|
#{item.idCard},#{item.post},#{item.workType},#{item.mobile},now(),now(),0,#{item.age},#{item.idCard}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
<insert id="addSbdStatus">
|
|
replace into robot_sbd_user_status(
|
|
id,send_status
|
|
)values (#{id},'0')
|
|
</insert>
|
|
<!--人员新增插入-->
|
|
<update id="updateSbdUser">
|
|
update robot_sbd_user set user_name=#{userName}, sex=#{sex}, mobile=#{mobile}, work_type=#{workType},
|
|
age=#{age},id_card=#{idCard} ,post=#{post},image=#{image}
|
|
where id=#{id}
|
|
</update>
|
|
<insert id="updateSbdUserStatus">
|
|
replace INTO robot_sbd_user_status (id,send_status)values
|
|
<foreach collection="list" item="item" separator=",">(
|
|
#{item},'1'
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
<insert id="addOrUpdateSbdUserInfo">
|
|
<if test="type == 1">
|
|
insert into robot_sbd_user(
|
|
id, data_source, user_name, sex, image, post,
|
|
work_type, mobile, create_time, update_time, del_flag,age,id_card,birth_date
|
|
)values
|
|
<foreach collection="list" item="item" separator=",">(
|
|
#{item.id}, #{item.dataSource},#{item.userName},#{item.sex},
|
|
#{item.idCard},#{item.post},#{item.workType},#{item.mobile},now(),now(),0,#{item.age},#{item.idCard},#{item.birthDate}
|
|
)
|
|
</foreach>
|
|
</if>
|
|
<if test="type == 2">
|
|
<foreach collection="list" item="item" index="index" separator=";">
|
|
UPDATE robot_sbd_user
|
|
<set>
|
|
data_source=#{item.dataSource},
|
|
user_name=#{item.userName},
|
|
sex=#{item.sex},
|
|
image=#{item.idCard},
|
|
post=#{item.post},
|
|
work_type=#{item.workType},
|
|
mobile=#{item.mobile},
|
|
update_time=now(),
|
|
age = #{item.age},
|
|
id_card = #{item.idCard},
|
|
birth_date = #{item.birthDate}
|
|
</set>
|
|
WHERE id = #{item.id}
|
|
</foreach>
|
|
</if>
|
|
</insert>
|
|
<delete id="delUser">
|
|
update robot_sbd_user set del_flag=1 where id=#{id}
|
|
</delete>
|
|
<select id="getDetails" resultType="com.bonus.business.vo.SbdUserVo">
|
|
select user_name userName, sex ,post,image,work_type workType,mobile,create_time createTime,data_source dataSource,
|
|
age,id_card idCard
|
|
from robot_sbd_user
|
|
WHERE id=#{id}
|
|
</select>
|
|
<select id="getDeviceList" resultType="com.bonus.business.vo.RobotVo">
|
|
SELECT td.id,td.dev_name devName,td.mac_id macId,td.puid puId,td.indexs
|
|
FROM sbd_robot_device td
|
|
where td.del_flag=0
|
|
</select>
|
|
<!--查询人员集合列表-->
|
|
<select id="getList" resultType="com.bonus.business.vo.SbdUserVo">
|
|
select us.id,user_name userName, sex ,post,image,work_type workType,mobile,
|
|
create_time createTime,data_source dataSource,
|
|
age,id_card idCard,IFNULL(sus.send_status,0) isSend
|
|
from robot_sbd_user us
|
|
left join robot_sbd_user_status sus on sus.id=us.id
|
|
WHERE del_flag=0
|
|
<if test="workType!=null and workType!=''">
|
|
and work_type like concat('%',#{workType},'%')
|
|
</if>
|
|
<if test="isSend!=null and isSend!=''">
|
|
and IFNULL(sus.send_status,0)=#{isSend}
|
|
</if>
|
|
<if test="dataSource!=null and dataSource!=''">
|
|
and data_source=#{dataSource}
|
|
</if>
|
|
<if test="userName!=null and userName!=''">
|
|
and user_name like concat('%',#{userName},'%')
|
|
</if>
|
|
<if test="post!=null and post!=''">
|
|
and post like concat('%',#{post},'%')
|
|
</if>
|
|
ORDER BY create_time DESC
|
|
</select>
|
|
<select id="getUserList" resultType="com.bonus.business.vo.RobotUserInfoVo">
|
|
select puid,user_id ,rui.user_name userName,rui.image,rui.data_image dataImage,rui.create_time createTime ,
|
|
rsu.post,rsu.work_type workType,rsu.sex,rsu.age,create_day createDay
|
|
from robot_user_info rui
|
|
left join robot_sbd_user rsu on rsu.id_card=rui.user_id and rsu.del_flag=0
|
|
<where>
|
|
<if test="userName!=null and userName!=''">
|
|
and rui.user_name like concat('%',#{userName},'%')
|
|
</if>
|
|
<if test="startDay!=null and startDay!='' and endDay!='' and endDay!=''">
|
|
and rui.create_day between #{startDay} and #{endDay}
|
|
</if>
|
|
</where>
|
|
order by rui.create_time desc
|
|
</select>
|
|
<select id="getUserListLimit" resultType="com.bonus.business.vo.RobotUserInfoVo">
|
|
select puid,user_id ,rui.user_name userName,rui.image,rui.data_image dataImage,rui.create_time createTime ,
|
|
rsu.post,rsu.work_type workType,rsu.sex,rsu.age,create_day createDay
|
|
from robot_user_info rui
|
|
left join robot_sbd_user rsu on rsu.id_card=rui.user_id and rsu.del_flag=0
|
|
order by rui.create_time desc
|
|
limit 12
|
|
</select>
|
|
<select id="getGdWorker" resultType="com.bonus.business.vo.SbdUserVo">
|
|
select id,name userName,bak_ic idCard,birth_date AS birthDate,sex,age,mobile_phone mobile,'1' dataSource,
|
|
CASE sta_type
|
|
WHEN 1 THEN '特种人员'
|
|
WHEN 2 THEN '其它技能人员'
|
|
WHEN 3 THEN '一般人员'
|
|
ELSE
|
|
'一般人员'
|
|
END AS 'workType',
|
|
CASE people_type
|
|
WHEN 1 THEN '项目经理'
|
|
WHEN 2 THEN '安全员'
|
|
WHEN 3 THEN '项目部其他管理人员'
|
|
WHEN 4 THEN '特种作业人员(技工)'
|
|
WHEN 5 THEN '一般施工人员(辅工、临时工)'
|
|
WHEN 6 THEN '技术服务人员'
|
|
WHEN 7 THEN '大型机械操作员'
|
|
WHEN 8 THEN '带电作业人员'
|
|
WHEN 9 THEN '班组骨干'
|
|
ELSE
|
|
'其他人员'
|
|
END AS 'post'
|
|
from gd_worker
|
|
|
|
</select>
|
|
<select id="getSbdUserList" resultType="com.bonus.business.vo.PersonVo">
|
|
select us.id,user_name name, post,image,work_type workType,mobile phones,
|
|
IFNULL(sex,1) gender, 'face' type,'robotV1' groupname,us.data_source dataSource,
|
|
create_time createTime,'安徽' nativePlace,
|
|
IFNULL(id_card,'9999999999') idCard,
|
|
IFNULL(id_card,'123456789') cardid,
|
|
IFNULL(birth_date,'1999-01-01') birthday
|
|
from robot_sbd_user us
|
|
left join robot_sbd_user_status sus on sus.id=us.id
|
|
WHERE del_flag=0
|
|
<if test="list!=null">
|
|
and id IN(
|
|
<foreach collection="list" item="item" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
)
|
|
</if>
|
|
<if test="list==null">
|
|
AND sus.send_status=0
|
|
</if>
|
|
</select>
|
|
<!--查询库里已存在的数据-->
|
|
<select id="getExistGdWorker" resultType="com.bonus.business.vo.SbdUserVo">
|
|
SELECT id,id_card FROM robot_sbd_user
|
|
</select>
|
|
</mapper> |