|
- <?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.lecoo.kjg.web.sys.dao.EmpDao">
-
- <resultMap id="selectMap" type="com.lecoo.kjg.web.sys.entity.Emp" >
- <result property="id" column="id" jdbcType="VARCHAR" />
- <result property="realName" column="real_name" jdbcType="VARCHAR" />
- <result property="jobNumber" column="job_number" jdbcType="VARCHAR" />
- <result property="office.officeCode" column="office_code" jdbcType="NUMERIC" />
- </resultMap>
-
-
- <!-- 根据 JobNumber 查询员工 -->
- <select id="findByJobNum" parameterType="java.lang.String" resultMap="selectMap">
- select e.real_name,e.job_number,e.id,o.office_code,e.register_time,e.status,e.phone_number,e.face_image_name from tf_project_emp e, tf_sys_office o where e.job_number = #{jobNum} and e.status in ("0","1", "4", "10", "11") and e.office_code=o.office_code limit 1;
- </select>
-
- <!-- 根据 FaceId 查询员工 -->
- <select id="findByFaceId" parameterType="java.lang.Integer" resultType="com.lecoo.kjg.web.sys.entity.Emp">
- select * from tf_project_emp where face_id = #{faceId} and status = "0";
- </select>
-
- <!-- 根据显示设备查询员工, device > office > emp -->
- <select id="findByShowDeviceId" parameterType="java.lang.String" resultType="java.util.Map">
- select distinct e.id as id, e.real_name as realname, e.department as department, e.face_image_name as faceImageName from tf_project_emp e where e.status in ("0", "4", "10", "11") and e.office_code in (select distinct od.office_id from tf_project_office_device od left join tf_project_device d on d.id = od.device_id where show_device_id like concat('%', #{showDeviceId}, '%'))
- </select>
-
- <update id="logicDeleteEmp" parameterType="java.lang.String" flushCache="true" >
- update tf_project_emp set face_id = null, status = "1" where id = #{id}
- </update>
-
- <update id="updateToDefaultOffice" parameterType="String" flushCache="true" >
- update tf_project_emp set office_code = #{defaultOfficeCode}, department="未分配" where office_code = #{officeCode}
- </update>
-
- <!-- 根据登录二级管理员编码查询员工,userDataScope-emp -->
- <select id="findByUserCode" parameterType="java.lang.String" resultType="com.lecoo.kjg.web.sys.entity.Emp">
- select * from tf_project_emp e where e.office_code in (select s.ctrl_data from tf_sys_user_data_scope s where s.user_code = #{userCode} and s.ctrl_type='Office');
- </select>
-
- <select id="findByName" parameterType="java.lang.String" resultType="com.lecoo.kjg.web.sys.entity.Emp">
- select * from tf_project_emp e where e.office_code = #{officeCode} AND e.real_name = #{name};
- </select>
-
- <select id="findEmployeeCountByOfficeCode" parameterType="String" resultType="java.lang.Long">
- SELECT count(id) FROM tf_project_emp WHERE office_code = #{officeCode} AND status in ("0", "4", "10", "11")
- </select>
-
- <select id="findByOfficeCode" parameterType="String" resultType="com.lecoo.kjg.web.sys.entity.Emp">
- SELECT * FROM tf_project_emp WHERE office_code = #{officeCode} AND status in ("0","1","4","5", "10", "11")
- </select>
-
- <!-- 根据设备查询员工 -->
- <select id="findFaceIdByDeviceId" parameterType="java.lang.String" resultType="java.util.List">
- select distinct e.face_id as faceId, e.update_time as updateTime from tf_sys_employee e where e.id in(select emp_id from tf_project_emp_device where device_id= #{deviceId})
- </select>
-
- <!-- 根据faceid查询人脸特征 -->
- <select id="findFaceInfoByFaceId" parameterType="java.lang.String" resultType="java.util.Map">
- select e.face_image_name as url, f.feature as feature, e.face_id as faceId from tf_project_emp e left join tf_project_user_face f on e.face_id = f._id where e.face_id = #{faceId}
- </select>
-
- <delete id="delUserRoleByIds" parameterType="java.util.List">
- delete from tf_sys_user_role where user_code in
- <foreach item="item" collection="codes" index="index" open="(" separator="," close=")">
- #{item}
- </foreach>)
- </delete>
-
-
- <select id="findEmployeesByOfficeCode" parameterType="String" resultType="com.lecoo.kjg.web.sys.entity.Emp">
- SELECT * FROM tf_project_emp WHERE office_code in (SELECT DISTINCT office_code FROM tf_sys_office o where parent_codes like concat(#{officeCode}, ',%') or parent_codes like concat('%,', #{officeCode}, ',%') or office_code = #{officeCode}) AND status in ("0", "4", "10", "11")
- </select>
-
- <delete id="delByJobNumber" parameterType="String">
- delete from tf_project_emp where job_number = #{jobNumber}
- </delete>
-
- <select id="findCountByOffice" resultType="java.util.HashMap">
- SELECT * from (SELECT count(1) count, e.office_code, o.parent_codes from tf_project_emp e JOIN tf_sys_office o on e.office_code=o.office_code
- WHERE e.status in ("0","1", "4", "5", "10", "11") GROUP BY office_code UNION SELECT 0, office_code, parent_codes from tf_sys_office) g GROUP BY office_code
- </select>
-
- <update id="deleteByOffice">
- UPDATE tf_project_emp
- <set>
- status = '1'
- </set>
- where office_code in (SELECT DISTINCT office_code FROM tf_sys_office o where parent_codes like concat(#{officeCode}, ',%') or parent_codes like concat('%,', #{officeCode}, ',%') or office_code = #{officeCode})
- </update>
-
-
- <delete id="realDeleteByOffice" parameterType="string">
- delete from tf_project_emp
- where office_code in (SELECT DISTINCT office_code FROM tf_sys_office o where parent_codes like concat(#{officeCode}, ',%') or parent_codes like concat('%,', #{officeCode}, ',%') or office_code = #{officeCode})
- </delete>
-
- <select id="findByName2" parameterType="java.lang.String" resultType="com.lecoo.kjg.web.sys.entity.Emp">
- select * from tf_project_emp e where e.real_name like concat('%', #{name}, '%') or e.nick_name like concat('%', #{name}, '%');
- </select>
- </mapper>
|