bingbo
2023-11-27 dd68fe194a28fa12f9dab33af84df95a779a204c
hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml
@@ -736,6 +736,12 @@
            <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},
@@ -759,6 +765,12 @@
            </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>
@@ -846,27 +858,30 @@
    <select id="queryDoorUser" resultType="com.thhy.staff.modules.biz.platuser.entity.DoorUserVo">
        select fr.create_time,fr.employee_no_string as jobNum,spu.real_name as realName,sg.group_name as groupName,1 as staffStatus
        select fr.id,fr.create_time as createTime,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,spu.photo
        from t_face_record fr
                 left join sys_plat_user spu on spu.job_num = fr.employee_no_string
                 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.notice_type = 5 and fr.verify = 1 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')
        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 count(employee_no_string) from t_face_record fr
        where fr.verify = 1 and employee_no_string is not null and DATE_FORMAT(create_time,'%Y-%m-%d') = DATE_FORMAT(SYSDATE(),'%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
               (select count(user_id) from sys_group_user where 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}
@@ -877,7 +892,7 @@
        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')
        where sgu.group_id = #{groupId} and fr.verify = 1 and DATE_FORMAT(sysdate(),'%Y-%m-%d') = DATE_FORMAT(fr.create_time,'%Y-%m-%d')
    </select>
    <select id="queryFaceUserByJobNum" resultType="com.thhy.staff.modules.biz.platuser.entity.PlatUserFace">
@@ -888,4 +903,95 @@
        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>
    <select id="countByFaceId" resultType="int">
        select count(user_id) from sys_plat_user where face_id = #{faceId}
    </select>
    <insert id="insertSamplePlatUser">
        insert into sys_plat_user
        <trim prefix="(" suffixOverrides="," suffix=")">
            <if test="userId != null and userId != ''">
                user_id,
            </if>
            <if test="realName != null and realName != ''">
                real_name,
            </if>
            <if test="faceId != null and faceId != ''">
                face_id,
            </if>
            <if test="idNo != null and idNo != ''">
                id_no,
            </if>
        </trim>
        <trim prefix="values (" suffixOverrides="," suffix=")">
            <if test="userId != null and userId != ''">
                #{userId},
            </if>
            <if test="realName != null and realName != ''">
                #{realName},
            </if>
            <if test="faceId != null and faceId != ''">
                #{faceId},
            </if>
            <if test="idNo != null and idNo != ''">
                #{idNo},
            </if>
        </trim>
    </insert>
    <select id="queryGroups" resultType="hashmap">
        select id,group_id as groupId,group_name as groupName from t_audio_group
    </select>
    <select id="queryHelmetWarn" resultType="hashmap">
        select hr.device_id as deviceId,hr.sos_type,hr.user_name as userName,'' as position,hr.sm_time
        from t_helmet_report hr
        order by hr.sm_time
        limit 10
    </select>
    <select id="queryAreaInfo" resultType="com.thhy.staff.modules.biz.platuser.entity.AreaAdmin">
        select reg.id as areaId,reg.region as areaName
        from t_region_hazard_inform reg
    </select>
    <select id="queryAdminByArea" resultType="com.thhy.staff.modules.biz.platuser.entity.NamePhoneDepart">
        select rwu.user_id,spu.real_name as realName,spu.phone,spu.photo,sd.depart_name as departName
        from t_region_warranty_user rwu
                 left join sys_plat_user spu on spu.user_id = rwu.user_id
                 left join sys_depart_user sdu on sdu.user_id = spu.user_id
                 left join sys_depart sd on sd.depart_id = sdu.depart_id
        where rwu.region_warranty_id = #{regionWarrantyId}
        order by user_type
    </select>
    <select id="faceArea" resultType="string">
        select DISTINCT area_name as areaName from t_face_device where area_name is not null
    </select>
</mapper>