<?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.panzhihua.service_community.dao.ComPensionAuthRecordDAO">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComPensionAuthRecordDO">
|
<id column="id" property="id" />
|
<result column="pensioner_id" property="pensionerId" />
|
<result column="auth_period" property="authPeriod" />
|
<result column="auth_method" property="authMethod" />
|
<result column="verification_result" property="verificationResult" />
|
<result column="submit_user_id" property="submitUserId" />
|
<result column="auth_video" property="authVideo" />
|
<result column="address" property="address" />
|
<result column="approver_id" property="approverId" />
|
<result column="approval_status" property="approvalStatus" />
|
<result column="approval_date" property="approvalDate" />
|
<result column="mark" property="mark" />
|
<result column="reject_reason" property="rejectReason" />
|
<result column="auth_status" property="authStatus" />
|
<result column="auth_date" property="authDate" />
|
<result column="create_at" property="createAt" />
|
<result column="update_at" property="updateAt" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, pensioner_id, auth_period, authMethod, verification_result, submit_user_id, auth_video, address, approver_id, approval_status, approval_date, mark, reject_reason, auth_status, auth_date, create_at, update_at
|
</sql>
|
|
<select id="pagePensionAuthRecords" resultType="com.panzhihua.common.model.vos.community.ComPensionAuthRecordVO">
|
SELECT
|
su.`name` submitUserName,
|
cpap.phone,
|
cpap.`name`,
|
cpap.id_card,
|
cpap.sex,
|
cpap.birthday,
|
cpap.personnel_category,
|
cpar.address,
|
cpap.is_alive,
|
cpar.auth_period,
|
cpar.auth_date,
|
cpar.auth_method,
|
cpar.mark,
|
cpar.approval_status,
|
cpar.id,
|
cpar.auth_status
|
FROM
|
com_pension_auth_records cpar
|
LEFT JOIN com_pension_auth_pensioners cpap ON cpar.pensioner_id = cpap.id
|
LEFT JOIN sys_user su ON cpar.submit_user_id = su.user_id
|
WHERE
|
cpap.community_id = ${pageElderAuthRecordsDTO.communityId}
|
<if test="pageElderAuthRecordsDTO.authPeriod != null and pageElderAuthRecordsDTO.authPeriod !=''">
|
and cpar.auth_period = #{pageElderAuthRecordsDTO.authPeriod}
|
</if>
|
<if test="pageElderAuthRecordsDTO.authMethod != null and pageElderAuthRecordsDTO.authMethod != 0">
|
and cpar.auth_method = #{pageElderAuthRecordsDTO.authMethod}
|
</if>
|
<if test="pageElderAuthRecordsDTO.authDateBegin != null and pageElderAuthRecordsDTO.authDateBegin != ''">
|
and cpar.auth_date <![CDATA[ >= ]]> #{pageElderAuthRecordsDTO.authDateBegin}
|
</if>
|
<if test="pageElderAuthRecordsDTO.authDateEnd != null and pageElderAuthRecordsDTO.authDateEnd != ''">
|
and cpar.auth_date <![CDATA[ <= ]]> #{pageElderAuthRecordsDTO.authDateEnd}
|
</if>
|
<if test="pageElderAuthRecordsDTO.approvalStatus != null and pageElderAuthRecordsDTO.approvalStatus != 0">
|
and cpar.approval_status = #{pageElderAuthRecordsDTO.approvalStatus}
|
</if>
|
<if test="pageElderAuthRecordsDTO.authStatus != null and pageElderAuthRecordsDTO.authStatus != 0">
|
and cpar.auth_status = #{pageElderAuthRecordsDTO.authStatus}
|
</if>
|
<if test="pageElderAuthRecordsDTO.personnelCategory != null and pageElderAuthRecordsDTO.personnelCategory != 0">
|
and cpap.personnel_category = #{pageElderAuthRecordsDTO.personnelCategory}
|
</if>
|
<if test="pageElderAuthRecordsDTO.isAlive != null">
|
and cpap.is_alive = #{pageElderAuthRecordsDTO.isAlive}
|
</if>
|
<if test="pageElderAuthRecordsDTO.searchKey != null and pageElderAuthRecordsDTO.searchKey != ''">
|
and (cpap.`name` like concat ('%', #{pageElderAuthRecordsDTO.searchKey}, '%')
|
or cpar.mark like concat ('%', #{pageElderAuthRecordsDTO.searchKey}, '%')
|
or cpap.id_card = #{pageElderAuthRecordsDTO.idCard})
|
</if>
|
order by cpar.create_at desc
|
</select>
|
|
<select id="detailPensionAuthRecords" resultType="com.panzhihua.common.model.vos.community.ComPensionAuthRecordVO">
|
SELECT
|
su.`name` submitUserName,
|
cpap.phone,
|
cpap.`name`,
|
cpap.id_card,
|
cpap.sex,
|
cpap.birthday,
|
cpap.personnel_category,
|
cpar.address,
|
cpap.is_alive,
|
cpar.auth_period,
|
cpar.auth_date,
|
cpar.mark,
|
cpar.auth_method,
|
cpar.auth_video,
|
cpar.approval_status,
|
cpar.community_id,
|
cpar.id,
|
su1.`name` as approverName,
|
cpar.approval_date
|
FROM
|
com_pension_auth_records cpar
|
LEFT JOIN com_pension_auth_pensioners cpap ON cpar.pensioner_id = cpap.id
|
LEFT JOIN sys_user su ON cpar.submit_user_id = su.user_id
|
LEFT JOIN sys_user su1 ON cpar.approver_id = su1.user_id
|
WHERE
|
cpar.id = #{authRecordId}
|
</select>
|
|
<select id="getPensionAuthRecordsByIds" resultType="com.panzhihua.common.model.vos.community.ComPensionAuthRecordExcleVO">
|
SELECT
|
su.`name` submitUserName,
|
cpap.phone,
|
cpap.`name`,
|
cpap.id_card,
|
CASE
|
cpap.sex
|
WHEN 1 THEN
|
'男'
|
WHEN 2 THEN
|
'女'
|
WHEN 3 THEN
|
'其他'
|
END sex,
|
cpap.birthday,
|
CASE
|
cpap.personnel_category
|
WHEN 1 THEN
|
'80-89周岁'
|
WHEN 2 THEN
|
'90-99周岁'
|
WHEN 3 THEN
|
'100周岁(含)以上'
|
END personnelCategory,
|
cpar.address,
|
CASE
|
cpap.is_alive
|
WHEN 1 THEN
|
'是'
|
WHEN 0 THEN
|
'否'
|
END isAlive,
|
cpar.auth_period,
|
cpar.auth_date,
|
CASE
|
cpar.auth_method
|
WHEN 1 THEN
|
'视频认证'
|
WHEN 2 THEN
|
'人脸认证'
|
WHEN 3 THEN
|
'线下认证'
|
END authMethod,
|
cpar.mark,
|
CASE
|
cpar.approval_status
|
WHEN 1 THEN
|
'待审核'
|
WHEN 2 THEN
|
'驳回'
|
WHEN 3 THEN
|
'通过'
|
END approvalStatus
|
FROM
|
com_pension_auth_records cpar
|
LEFT JOIN com_pension_auth_pensioners cpap ON cpar.pensioner_id = cpap.id
|
LEFT JOIN sys_user su ON cpar.submit_user_id = su.user_id
|
<where>
|
<if test="ids != null and ids.size > 0">
|
and cpar.id in
|
<foreach collection="ids" item="id" open="(" separator="," close=")" >
|
#{id}
|
</foreach>
|
</if>
|
</where>
|
order by cpar.create_at desc
|
</select>
|
|
<update id="updateAll" parameterType="java.util.List">
|
<foreach collection="comPensionAuthRecordDOS" item="item" index="index" separator=";">
|
update com_pension_auth_records
|
<set>
|
<if test="item.pensionerId != null">
|
`pensioner_id` = #{item.pensionerId},
|
</if>
|
<if test="item.authMethod != null and item.authMethod != 0">
|
`auth_method` = #{item.authMethod},
|
</if>
|
<if test="item.authPeriod != null and item.authPeriod != '""'">
|
`auth_period` = #{item.authPeriod},
|
</if>
|
<if test="item.submitUserId != null">
|
`submit_user_id` = #{item.submitUserId},
|
</if>
|
<if test="item.authVideo != null and item.authVideo != '""'">
|
`auth_video` = #{item.authVideo},
|
</if>
|
<if test="item.address != null and item.address != '""'">
|
`address` = #{item.address},
|
</if>
|
<if test="item.approverId != null">
|
`approver_id` = #{item.approverId},
|
</if>
|
<if test="item.approvalStatus != null">
|
`approval_status` = #{item.approvalStatus},
|
</if>
|
<if test="item.approvalDate != null">
|
`approval_date` = #{item.approvalDate},
|
</if>
|
<if test="item.mark != null and item.mark != '""'">
|
`mark` = #{item.mark},
|
</if>
|
<if test="item.rejectReason != null and item.rejectReason != '""'">
|
`reject_reason` = #{item.rejectReason},
|
</if>
|
<if test="item.authStatus != null">
|
`auth_status` = #{item.authStatus},
|
</if>
|
<if test="item.authDate != null">
|
`auth_date` = #{item.authDate},
|
</if>
|
`update_at` = NOW()
|
</set>
|
WHERE `id` = #{item.id}
|
</foreach>
|
;
|
</update>
|
|
<select id="exportPensionAuthRecordsStatistic" resultType="com.panzhihua.common.model.vos.community.ComPensionAuthRecordStatisticExcleVO">
|
SELECT
|
su.`name` submitUserName,
|
cpap.phone,
|
cpap.`name`,
|
cpap.id_card,
|
CASE
|
cpap.sex
|
WHEN 1 THEN
|
'男'
|
WHEN 2 THEN
|
'女'
|
WHEN 3 THEN
|
'其他'
|
END sex,
|
cpap.birthday,
|
CASE
|
cpap.personnel_category
|
WHEN 1 THEN
|
'80-89周岁'
|
WHEN 2 THEN
|
'90-99周岁'
|
WHEN 3 THEN
|
'100周岁(含)以上'
|
END personnelCategory,
|
cpar.address,
|
CASE
|
cpap.is_alive
|
WHEN 1 THEN
|
'是'
|
WHEN 0 THEN
|
'否'
|
END isAlive,
|
cpahr.auth_period,
|
cpahr.auth_date,
|
CASE
|
cpahr.auth_method
|
WHEN 1 THEN
|
'视频认证'
|
WHEN 2 THEN
|
'人脸认证'
|
WHEN 3 THEN
|
'线下认证'
|
END authMethod,
|
cpahr.mark,
|
CASE
|
cpahr.is_auth
|
WHEN 1 THEN
|
'已认证'
|
WHEN 2 THEN
|
'未认证'
|
END authStatus
|
FROM
|
com_pension_auth_history_record as cpahr
|
LEFT JOIN com_pension_auth_records cpar on cpar.id = cpahr.auth_id
|
LEFT JOIN com_pension_auth_pensioners cpap ON cpahr.elderlies_id = cpap.id
|
LEFT JOIN sys_user su ON cpar.submit_user_id = su.user_id
|
WHERE
|
cpahr.community_id = ${pageElderAuthRecordsDTO.communityId}
|
<if test="pageElderAuthRecordsDTO.authPeriod != null and pageElderAuthRecordsDTO.authPeriod !=''">
|
and cpahr.auth_period = #{pageElderAuthRecordsDTO.authPeriod}
|
</if>
|
<if test="pageElderAuthRecordsDTO.authStatus != null">
|
and cpahr.ia_auth = #{pageElderAuthRecordsDTO.authStatus}
|
</if>
|
<if test="pageElderAuthRecordsDTO.personnelCategory != null and pageElderAuthRecordsDTO.personnelCategory != 0">
|
and cpap.personnel_category = #{pageElderAuthRecordsDTO.personnelCategory}
|
</if>
|
<if test="pageElderAuthRecordsDTO.isAlive != null and pageElderAuthRecordsDTO.isAlive != 0">
|
and cpap.is_alive = #{pageElderAuthRecordsDTO.isAlive}
|
</if>
|
<if test="pageElderAuthRecordsDTO.searchKey != null and pageElderAuthRecordsDTO.searchKey != ''">
|
and (cpap.`name` like concat ('%', #{pageElderAuthRecordsDTO.searchKey}, '%')
|
or cpahr.mark like concat ('%', #{pageElderAuthRecordsDTO.searchKey}, '%'))
|
</if>
|
order by cpahr.create_at desc
|
</select>
|
|
<select id="queryRecordWithPage" resultType="com.panzhihua.common.model.vos.community.IdentityAuthRecordDetailVO">
|
SELECT
|
cpar.id,
|
cpar.auth_period,
|
cpar.auth_date,
|
cpar.reject_reason,
|
cpar.approval_status,
|
cpap.name,
|
cpap.id_card
|
FROM `com_pension_auth_records` cpar
|
LEFT JOIN `com_pension_auth_pensioners` cpap ON cpar.pensioner_id = cpap.id
|
WHERE cpar.submit_user_id = #{pageIdentityAuthRecordDTO.submitUserId}
|
ORDER BY cpar.id DESC
|
</select>
|
<select id="findById" resultType="com.panzhihua.common.model.vos.community.IdentityAuthRecordDetailVO">
|
SELECT
|
cpap.name,
|
cpap.id_card,
|
ca.name AS communityName,
|
cpar.address,
|
cpar.auth_period,
|
cpar.auth_date,
|
cpar.auth_video,
|
cpar.reject_reason,
|
cpar.approval_status
|
FROM `com_pension_auth_records` cpar
|
LEFT JOIN `com_pension_auth_pensioners` cpap ON cpar.pensioner_id = cpap.id
|
LEFT JOIN `com_act` ca ON cpap.community_id = ca.community_id
|
WHERE cpar.id = #{identityAuthId}
|
</select>
|
|
<select id="getNextIds" resultType="String">
|
select id from com_pension_auth_records where approval_status = 1 and community_id = ${communityId}
|
</select>
|
</mapper>
|