<?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.ComEldersAuthHistoryRecordMapper">
|
|
<resultMap id="baseResult" type="com.panzhihua.service_community.model.dos.ComEldersAuthHistoryRecordDO">
|
<result property="id" column="id"/>
|
<result property="userId" column="user_id"/>
|
<result property="name" column="name"/>
|
<result property="idCard" column="id_card"/>
|
<result property="brithday" column="brithday"/>
|
<result property="age" column="age"/>
|
<result property="domicile" column="domicile"/>
|
<result property="isAuth" column="is_auth"/>
|
<result property="createAt" column="create_at"/>
|
</resultMap>
|
|
<sql id="columns">
|
<![CDATA[
|
id,user_id,name,id_card,brithday,age,domicile,is_auth,create_at
|
]]>
|
</sql>
|
|
<!-- 分页查询 -->
|
<select id="findByPage" resultType="com.panzhihua.common.model.vos.community.ComEldersAuthHistoryRecordVO"
|
parameterType="com.panzhihua.common.model.dtos.community.PageComEldersAuthHistoryRecordDTO">
|
SELECT <include refid="columns" />
|
FROM com_elders_auth_history_record
|
<where>
|
<if test="pageComEldersAuthHistoryRecordDTO.id!=null">
|
AND id = #{pageComEldersAuthHistoryRecordDTO.id}
|
</if>
|
<if test="pageComEldersAuthHistoryRecordDTO.userId!=null">
|
AND user_id = #{pageComEldersAuthHistoryRecordDTO.userId}
|
</if>
|
<if test="pageComEldersAuthHistoryRecordDTO.name!=null">
|
AND name = #{pageComEldersAuthHistoryRecordDTO.name}
|
</if>
|
<if test="pageComEldersAuthHistoryRecordDTO.idCard!=null">
|
AND id_card = #{pageComEldersAuthHistoryRecordDTO.idCard}
|
</if>
|
<if test="pageComEldersAuthHistoryRecordDTO.brithday!=null">
|
AND brithday = #{pageComEldersAuthHistoryRecordDTO.brithday}
|
</if>
|
<if test="pageComEldersAuthHistoryRecordDTO.age!=null">
|
AND age = #{pageComEldersAuthHistoryRecordDTO.age}
|
</if>
|
<if test="pageComEldersAuthHistoryRecordDTO.domicile!=null">
|
AND domicile = #{pageComEldersAuthHistoryRecordDTO.domicile}
|
</if>
|
<if test="pageComEldersAuthHistoryRecordDTO.isAuth!=null">
|
AND is_auth = #{pageComEldersAuthHistoryRecordDTO.isAuth}
|
</if>
|
<if test="pageComEldersAuthHistoryRecordDTO.createAtBegin!=null">
|
AND create_at >= #{pageComEldersAuthHistoryRecordDTO.createAtBegin}
|
</if>
|
<if test="pageComEldersAuthHistoryRecordDTO.createAtEnd!=null">
|
AND create_at <= #{pageComEldersAuthHistoryRecordDTO.createAtEnd}
|
</if>
|
</where>
|
<if test="pageComEldersAuthHistoryRecordDTO.sortColumns!=null">
|
ORDER BY ${pageComEldersAuthHistoryRecordDTO.sortColumns} ${pageComEldersAuthHistoryRecordDTO.sortType}
|
</if>
|
</select>
|
|
<select id="pageAuthStatisticAdmin" parameterType="com.panzhihua.common.model.dtos.community.elder.PageElderAuthStatisticDTO"
|
resultType="com.panzhihua.common.model.vos.elders.ComEldersAuthStatisticVO">
|
SELECT
|
ceahr.id,
|
ceahr.phone,
|
ceahr.`name`,
|
ceahr.id_card,
|
ceahr.sex,
|
ceahr.age,
|
ceahr.personnel_category,
|
ceahr.is_alive,
|
ceahr.auth_period,
|
ceahr.auth_date,
|
ceahr.auth_method,
|
ceahr.mark,
|
ceahr.is_auth,
|
ceahr.submit_user_id,
|
IFNULL(su.nick_name,su.`name`) as submitUserName,
|
IFNULL(su1.nick_name,su1.`name`) as approvalName,
|
cear.address,
|
cear.auth_video,
|
cear.approval_status,
|
ceahr.approver_id,
|
ceahr.approval_date,
|
ceahr.brithday
|
FROM
|
com_elders_auth_history_record AS ceahr
|
LEFT JOIN com_elder_auth_elderlies AS ceae ON ceae.id = ceahr.elderlies_id
|
left join sys_user as su on su.user_id = ceahr.submit_user_id
|
left join sys_user as su1 on su1.user_id = ceahr.approver_id
|
left join com_elder_auth_records as cear on cear.id = ceahr.auth_id
|
<where>
|
<if test="pageElderAuthStatisticDTO.keyWord != null and pageElderAuthStatisticDTO.keyWord !=""">
|
and (ceahr.`name` like concat (#{pageElderAuthStatisticDTO.keyWord},'%') or
|
ceahr.id_card = #{pageElderAuthStatisticDTO.keyWord} or
|
ceahr.mark like concat (#{pageElderAuthStatisticDTO.keyWord},'%'))
|
</if>
|
<if test="pageElderAuthStatisticDTO.authPeriod != null and pageElderAuthStatisticDTO.authPeriod != """>
|
and ceahr.auth_period = #{pageElderAuthStatisticDTO.authPeriod}
|
</if>
|
<if test="pageElderAuthStatisticDTO.authStatus != null">
|
and ceahr.is_auth = #{pageElderAuthStatisticDTO.authStatus}
|
</if>
|
<if test="pageElderAuthStatisticDTO.personnelCategory != null">
|
and ceahr.personnel_category = #{pageElderAuthStatisticDTO.personnelCategory}
|
</if>
|
<if test="pageElderAuthStatisticDTO.isAlive != null">
|
and ceahr.is_alive = #{pageElderAuthStatisticDTO.isAlive}
|
</if>
|
<if test="pageElderAuthStatisticDTO.communityId != null">
|
and ceahr.community_id = ${pageElderAuthStatisticDTO.communityId}
|
</if>
|
</where>
|
order by ceahr.create_at desc
|
</select>
|
|
<select id="getAuthHeaderStatisticAdmin" parameterType="com.panzhihua.common.model.dtos.community.elder.ElderAuthStatisticHeaderDTO"
|
resultType="com.panzhihua.common.model.vos.elders.ComEldersAuthStatisticHeaderVO">
|
SELECT
|
count( id ) AS allCount,
|
( SELECT count( id ) FROM com_elders_auth_history_record WHERE is_auth = 1
|
<if test="statisticHeaderDTO.authPeriod != null and statisticHeaderDTO.authPeriod != """>
|
and auth_period = #{statisticHeaderDTO.authPeriod}
|
</if>
|
<if test="statisticHeaderDTO.communityId != null">
|
and community_id = ${statisticHeaderDTO.communityId}
|
</if>
|
) AS yesCount,
|
( SELECT count( id ) FROM com_elders_auth_history_record WHERE is_auth = 2
|
<if test="statisticHeaderDTO.authPeriod != null and statisticHeaderDTO.authPeriod != """>
|
and auth_period = #{statisticHeaderDTO.authPeriod}
|
</if>
|
<if test="statisticHeaderDTO.communityId != null">
|
and community_id = ${statisticHeaderDTO.communityId}
|
</if>
|
) AS noCount
|
FROM
|
com_elders_auth_history_record
|
<where>
|
<if test="statisticHeaderDTO.authPeriod != null and statisticHeaderDTO.authPeriod != """>
|
and auth_period = #{statisticHeaderDTO.authPeriod}
|
</if>
|
<if test="statisticHeaderDTO.communityId != null">
|
and community_id = ${statisticHeaderDTO.communityId}
|
</if>
|
</where>
|
</select>
|
|
</mapper>
|