<?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.ComElderAuthRecordsDAO">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComElderAuthRecordsDO">
|
<id column="id" property="id" />
|
<result column="elderlies_id" property="elderliesId" />
|
<result column="auth_period" property="authPeriod" />
|
<result column="submit_user_id" property="submitUserId" />
|
<result column="auth_video" property="authVideo" />
|
<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, elderlies_id, auth_period, submit_user_id, auth_video, approver, approval_status, approval_date, mark, reject_reason, auth_status, auth_date, create_at, update_at
|
</sql>
|
|
<select id="pageElderAuthRecords" resultType="com.panzhihua.common.model.vos.community.ComElderAuthRecordVO">
|
SELECT
|
su.`name` submitUserName,
|
ceae.phone,
|
ceae.`name`,
|
ceae.id_card,
|
ceae.sex,
|
ceae.birthday,
|
ceae.personnel_category,
|
ceae.address,
|
ceae.is_alive,
|
cear.auth_period,
|
cear.auth_date,
|
cear.mark,
|
cear.approval_status,
|
cear.auth_status
|
FROM
|
com_elder_auth_records cear
|
LEFT JOIN com_elder_auth_elderlies ceae ON cear.elderlies_id = ceae.id
|
LEFT JOIN sys_user su ON cear.submit_user_id = su.user_id
|
WHERE
|
ceae.community_id = #{pageElderAuthRecordsDTO.communityId}
|
<if test="pageElderAuthRecordsDTO.authPeriod != null and pageElderAuthRecordsDTO.authPeriod !=''">
|
and cear.auth_period = #{pageElderAuthRecordsDTO.authPeriod}
|
</if>
|
<if test="pageElderAuthRecordsDTO.authDateBegin != null and pageElderAuthRecordsDTO.authDateBegin != ''">
|
and cear.auth_date after #{pageElderAuthRecordsDTO.authDateBegin}
|
</if>
|
<if test="pageElderAuthRecordsDTO.authDateEnd != null and pageElderAuthRecordsDTO.authDateEnd != ''">
|
and cear.auth_date before #{pageElderAuthRecordsDTO.authDateEnd}
|
</if>
|
<if test="pageElderAuthRecordsDTO.approvalStatus != null and pageElderAuthRecordsDTO.approvalStatus != 0">
|
and cear.approval_status = #{pageElderAuthRecordsDTO.approvalStatus}
|
</if>
|
<if test="pageElderAuthRecordsDTO.authStatus != null and pageElderAuthRecordsDTO.authStatus != 0">
|
and cear.auth_status = #{pageElderAuthRecordsDTO.authStatus}
|
</if>
|
<if test="pageElderAuthRecordsDTO.personnelCategory != null and pageElderAuthRecordsDTO.personnelCategory != 0">
|
and ceae.personnel_category = #{pageElderAuthRecordsDTO.personnelCategory}
|
</if>
|
<if test="pageElderAuthRecordsDTO.isAlive != null and pageElderAuthRecordsDTO.isAlive != 0">
|
and ceae.is_alive = #{pageElderAuthRecordsDTO.isAlive}
|
</if>
|
<if test="pageElderAuthRecordsDTO.searchKey != null and pageElderAuthRecordsDTO.searchKey != ''">
|
and (ceae.`name` like concat ('%', #{pageElderAuthRecordsDTO.searchKey}, '%')
|
or cear.mark like concat ('%', #{pageElderAuthRecordsDTO.searchKey}, '%'))
|
</if>
|
order by cear.create_at desc
|
</select>
|
|
<select id="detailElderAuthRecords" resultType="com.panzhihua.common.model.vos.community.ComElderAuthRecordVO">
|
SELECT
|
su.`name` submitUserName,
|
ceae.phone,
|
ceae.`name`,
|
ceae.id_card,
|
ceae.sex,
|
ceae.birthday,
|
ceae.personnel_category,
|
ceae.address,
|
ceae.is_alive,
|
cear.auth_period,
|
cear.auth_date,
|
cear.mark,
|
cear.auth_video,
|
cear.approval_status,
|
su1.`name` as approverName,
|
cear.approval_date
|
FROM
|
com_elder_auth_records cear
|
LEFT JOIN com_elder_auth_elderlies ceae ON cear.elderlies_id = ceae.id
|
LEFT JOIN sys_user su ON cear.submit_user_id = su.user_id
|
LEFT JOIN sys_user su1 ON cear.approver_id = su1.user_id
|
WHERE
|
cear.id = #{authRecordId}
|
</select>
|
|
<select id="getElderAuthRecordsByIds" resultType="com.panzhihua.common.model.vos.community.ComElderAuthRecordExcleVO">
|
SELECT
|
su.`name` submitUserName,
|
ceae.phone,
|
ceae.`name`,
|
ceae.id_card,
|
CASE
|
ceae.sex
|
WHEN 1 THEN
|
'男'
|
WHEN 2 THEN
|
'女'
|
WHEN 3 THEN
|
'其他'
|
END sex,
|
ceae.birthday,
|
CASE
|
ceae.personnel_category
|
WHEN 1 THEN
|
'80-89周岁'
|
WHEN 2 THEN
|
'90-99周岁'
|
WHEN 3 THEN
|
'100周岁(含)以上'
|
END personnelCategory,
|
ceae.address,
|
CASE
|
ceae.isAlive
|
WHEN 1 THEN
|
'是'
|
WHEN 0 THEN
|
'否'
|
END is_alive,
|
cear.auth_period,
|
cear.auth_date,
|
cear.mark,
|
CASE
|
cear.approval_status
|
WHEN 1 THEN
|
'待审核'
|
WHEN 2 THEN
|
'驳回'
|
WHEN 3 THEN
|
'通过'
|
END approvalStatus
|
FROM
|
com_elder_auth_records cear
|
LEFT JOIN com_elder_auth_elderlies ceae ON cear.elderlies_id = ceae.id
|
LEFT JOIN sys_user su ON cear.submit_user_id = su.user_id
|
WHERE
|
cear.id in
|
<foreach collection="ids" item="id" open="(" separator="," close=")" >
|
#{id}
|
</foreach>
|
order by cear.create_at desc
|
</select>
|
|
<update id="updateAll" parameterType="java.util.List">
|
<foreach collection="comElderAuthRecordsDOS" item="item" index="index" separator=";">
|
update com_elder_auth_records
|
<set>
|
<if test="item.id != null">
|
`id` = #{item.id},
|
</if>
|
<if test="item.elderliesId != null">
|
`elderlies_id` = #{item.elderliesId},
|
</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="exportElderAuthRecordsStatistic" resultType="com.panzhihua.common.model.vos.community.ComElderAuthRecordStatisticExcleVO">
|
SELECT
|
su.`name` submitUserName,
|
ceae.phone,
|
ceae.`name`,
|
ceae.id_card,
|
CASE
|
ceae.sex
|
WHEN 1 THEN
|
'男'
|
WHEN 2 THEN
|
'女'
|
WHEN 3 THEN
|
'其他'
|
END sex,
|
ceae.birthday,
|
CASE
|
ceae.personnel_category
|
WHEN 1 THEN
|
'80-89周岁'
|
WHEN 2 THEN
|
'90-99周岁'
|
WHEN 3 THEN
|
'100周岁(含)以上'
|
END personnelCategory,
|
ceae.address,
|
CASE
|
ceae.isAlive
|
WHEN 1 THEN
|
'是'
|
WHEN 0 THEN
|
'否'
|
END is_alive,
|
cear.auth_period,
|
cear.auth_date,
|
cear.mark,
|
CASE
|
cear.auth_status
|
WHEN 1 THEN
|
'已认证'
|
WHEN 0 THEN
|
'未认证'
|
END authStatus
|
FROM
|
com_elder_auth_records cear
|
LEFT JOIN com_elder_auth_elderlies ceae ON cear.elderlies_id = ceae.id
|
LEFT JOIN sys_user su ON cear.submit_user_id = su.user_id
|
WHERE
|
ceae.community_id = #{pageElderAuthRecordsDTO.communityId}
|
<if test="pageElderAuthRecordsDTO.authPeriod != null and pageElderAuthRecordsDTO.authPeriod !=''">
|
and cear.auth_period = #{pageElderAuthRecordsDTO.authPeriod}
|
</if>
|
<if test="pageElderAuthRecordsDTO.authStatus != null and pageElderAuthRecordsDTO.authStatus != 0">
|
and cear.auth_status = #{pageElderAuthRecordsDTO.authStatus}
|
</if>
|
<if test="pageElderAuthRecordsDTO.personnelCategory != null and pageElderAuthRecordsDTO.personnelCategory != 0">
|
and ceae.personnel_category = #{pageElderAuthRecordsDTO.personnelCategory}
|
</if>
|
<if test="pageElderAuthRecordsDTO.isAlive != null and pageElderAuthRecordsDTO.isAlive != 0">
|
and ceae.is_alive = #{pageElderAuthRecordsDTO.isAlive}
|
</if>
|
<if test="pageElderAuthRecordsDTO.searchKey != null and pageElderAuthRecordsDTO.searchKey != ''">
|
and (ceae.`name` like concat ('%', #{pageElderAuthRecordsDTO.searchKey}, '%')
|
or cear.mark like concat ('%', #{pageElderAuthRecordsDTO.searchKey}, '%'))
|
</if>
|
order by cear.create_at desc
|
</select>
|
</mapper>
|