219 lines
7.8 KiB
XML
219 lines
7.8 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.primeport.persistence.mapper.ClosedAreaPersonApplyMapper">
|
|
|
|
<select id="getCorpUserList" resultType="com.zcloud.primeport.persistence.dataobject.UserDto">
|
|
SELECT
|
|
u.id user_id,
|
|
u.username user_name,
|
|
u.`name`,
|
|
u.corpinfo_id corpId,
|
|
u.post_id,
|
|
CASE
|
|
WHEN c.type IN (3,4,5) THEN u.post_name
|
|
ELSE p.post_name
|
|
END AS post_name,
|
|
c.corp_name,
|
|
d.id dept_Id,
|
|
d.`name` dept_Name,
|
|
u.phone,
|
|
u.user_avatar_url user_face_url,
|
|
u.rz_flag,
|
|
u.employment_flag,
|
|
u.user_id_card,
|
|
IFNULL( vehicle_tmp.vehicle_count, 0 ) vehicle_count,
|
|
IFNULL(cafpa.mkmj_permission,2) mkmj_permission
|
|
FROM
|
|
`user` AS u
|
|
LEFT JOIN corp_info c ON u.corpinfo_id = c.id
|
|
LEFT JOIN department d ON u.department_id = d.id
|
|
LEFT JOIN post p ON p.id = u.post_id
|
|
LEFT JOIN closed_area_fgs_person_auth cafpa on cafpa.user_id = u.id and cafpa.delete_enum = 'FALSE'
|
|
LEFT JOIN (
|
|
SELECT
|
|
va.employee_vehicle_user_id,
|
|
COUNT( va.id ) vehicle_count
|
|
FROM
|
|
`vehicle_apply` va
|
|
WHERE
|
|
va.audit_flag = 2
|
|
AND va.vehicle_belong_type = 3
|
|
AND va.delete_enum = 'FALSE'
|
|
GROUP BY
|
|
va.employee_vehicle_user_id
|
|
) vehicle_tmp ON u.id = vehicle_tmp.employee_vehicle_user_id
|
|
WHERE
|
|
u.delete_enum = 'FALSE'
|
|
AND u.main_corp_flag = 0
|
|
AND u.corpinfo_id = #{params.corpinfoId}
|
|
AND u.rz_flag = 1
|
|
|
|
<if test="params.hasFaceUrl != null and params.hasFaceUrl == 1">
|
|
AND u.user_avatar_url IS NOT NULL
|
|
</if>
|
|
<if test="params.deptId != null">
|
|
AND u.department_id = #{params.deptId}
|
|
</if>
|
|
<if test="params.name != null and params.name != ''">
|
|
AND u.name like CONCAT('%', #{params.name}, '%')
|
|
</if>
|
|
<if test="params.noSelf != null and params.noSelf == 2">
|
|
AND u.id != #{params.selfUserId}
|
|
</if>
|
|
ORDER BY
|
|
u.department_id
|
|
</select>
|
|
<select id="listPage" resultType="com.zcloud.primeport.persistence.dataobject.ClosedAreaPersonApplyDO">
|
|
select c.*,c.create_name apply_user_name
|
|
from closed_area_person_apply c
|
|
where c.delete_enum = 'FALSE'
|
|
|
|
<if test="params.applyPersonCorpName != null and params.applyPersonCorpName != ''">
|
|
AND c.jurisdictional_corp_name like CONCAT('%', #{params.applyPersonCorpName}, '%')
|
|
</if>
|
|
|
|
<if test="params.projectName != null and params.projectName != ''">
|
|
AND c.project_name like CONCAT('%', #{params.projectName}, '%')
|
|
</if>
|
|
<if test="params.deptId != null">
|
|
AND c.apply_person_department_id = #{params.deptId}
|
|
</if>
|
|
<if test="params.processOrRecord != null">
|
|
<if test="params.processOrRecord == 1">
|
|
AND c.audit_flag = 1
|
|
</if>
|
|
<if test="params.processOrRecord == 2">
|
|
AND c.audit_flag != 1
|
|
</if>
|
|
</if>
|
|
<if test="params.personBelongType != null">
|
|
<if test="params.personBelongType == 4">
|
|
AND c.person_belong_type = 4
|
|
</if>
|
|
<if test="params.personBelongType == 1">
|
|
AND c.person_belong_type = 1
|
|
</if>
|
|
<if test="params.personBelongType == 2">
|
|
AND c.person_belong_type = 2
|
|
</if>
|
|
<if test="params.personBelongType == 3">
|
|
AND c.person_belong_type = 3
|
|
</if>
|
|
<if test="params.personBelongType == -1">
|
|
AND c.person_belong_type != 4
|
|
</if>
|
|
</if>
|
|
<if test="params.applyPersonUserName != null and params.applyPersonUserName != ''">
|
|
AND c.apply_person_user_name like CONCAT('%', #{params.applyPersonUserName}, '%')
|
|
</if>
|
|
order by c.id desc
|
|
</select>
|
|
|
|
<select id="screenList" resultType="com.zcloud.primeport.persistence.dataobject.ClosedAreaPersonApplyDO">
|
|
select c.*, c.create_name apply_user_name
|
|
from closed_area_person_apply c
|
|
left join closed_area ca on c.closed_area_id = ca.id and ca.delete_enum = 'FALSE'
|
|
where c.delete_enum = 'FALSE'
|
|
and c.audit_flag = 2
|
|
<if test="params.corpinfoId != null">
|
|
and ca.jurisdictional_corp_id = #{params.corpinfoId}
|
|
</if>
|
|
order by c.id desc
|
|
</select>
|
|
|
|
<select id="deptList" resultType="com.zcloud.primeport.persistence.dataobject.ClosedAreaPersonApplyDeptDO">
|
|
SELECT DISTINCT
|
|
apply_person_corp_id,
|
|
apply_person_corp_name,
|
|
apply_person_department_id,
|
|
apply_person_department_name
|
|
FROM closed_area_person_apply
|
|
WHERE delete_enum = 'FALSE'
|
|
AND apply_person_department_id IS NOT NULL
|
|
ORDER BY apply_person_department_id DESC
|
|
</select>
|
|
|
|
<select id="getDockAuthInfoById" resultType="com.zcloud.primeport.plan.mjDevice.dto.TwoLevelUser">
|
|
SELECT
|
|
capa.id,
|
|
capa.closed_area_id,
|
|
GROUP_CONCAT( chvi.hk_index_code ) hk_index_code,
|
|
capa.visit_start_time,
|
|
capa.visit_end_time,
|
|
capa.user_face_url user_face_images,
|
|
capa.user_phone,
|
|
capa.user_card,
|
|
capa.apply_person_user_name user_name,
|
|
capa.entourage
|
|
FROM
|
|
closed_area_person_apply capa
|
|
LEFT JOIN (
|
|
SELECT
|
|
m.closed_area_id,
|
|
GROUP_CONCAT( DISTINCT tmp.hk_index_code ) hk_index_code
|
|
FROM
|
|
mkmj m
|
|
LEFT JOIN (
|
|
SELECT
|
|
mg.mkmj_id,
|
|
mg.hk_index_code
|
|
FROM
|
|
mkmj_gate mg
|
|
WHERE
|
|
mg.gate_type = 'HGKM_MKMJ_GATE_TYPE_PERSON'
|
|
AND mg.gate_status = 2
|
|
AND mg.delete_enum = 'FALSE'
|
|
) tmp ON m.id = tmp.mkmj_id
|
|
WHERE
|
|
m.delete_enum = 'FALSE'
|
|
AND m.mkmj_status = 2
|
|
AND m.mkmj_level = 2
|
|
GROUP BY
|
|
m.closed_area_id
|
|
) chvi ON chvi.closed_area_id = capa.closed_area_id
|
|
WHERE
|
|
capa.delete_enum = 'FALSE'
|
|
AND capa.audit_flag = 2
|
|
AND capa.person_belong_type IN ( 1, 2, 3 )
|
|
AND capa.visit_end_time >= DATE_FORMAT( now(), '%Y-%m-%d' )
|
|
AND capa.visit_start_time <= DATE_FORMAT( now(), '%Y-%m-%d' )
|
|
AND chvi.hk_index_code IS NOT NULL
|
|
<if test="applyId != null">
|
|
and capa.id = #{applyId}
|
|
</if>
|
|
GROUP BY
|
|
capa.id
|
|
</select>
|
|
<select id="getDockAuthTmpInfoById" resultType="com.zcloud.primeport.plan.mjDevice.dto.TwoLevelUser">
|
|
SELECT
|
|
capa.id,
|
|
GROUP_CONCAT( DISTINCT mg.hk_index_code ) hk_index_code,
|
|
capa.visit_start_time,
|
|
capa.visit_end_time,
|
|
capa.user_face_url user_face_images,
|
|
capa.user_phone,
|
|
capa.user_card,
|
|
capa.apply_person_user_name user_name
|
|
FROM
|
|
closed_area_person_apply capa
|
|
LEFT JOIN mkmj_gate mg ON capa.level_two_mkmj_id = mg.mkmj_id
|
|
AND mg.delete_enum = 'FALSE'
|
|
AND mg.gate_type = 'HGKM_MKMJ_GATE_TYPE_PERSON'
|
|
AND mg.gate_status = 2
|
|
WHERE
|
|
capa.delete_enum = 'FALSE'
|
|
AND capa.person_belong_type = 4
|
|
AND capa.audit_flag = 2
|
|
AND capa.visit_end_time >= DATE_FORMAT( now(), '%Y-%m-%d' )
|
|
AND capa.visit_start_time <= DATE_FORMAT( now(), '%Y-%m-%d' )
|
|
<if test="applyId != null">
|
|
and capa.id = #{applyId}
|
|
</if>
|
|
GROUP BY
|
|
capa.id
|
|
</select>
|
|
</mapper>
|
|
|