<?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.ComEldersAuthUserMapper">
|
|
<resultMap id="baseResult" type="com.panzhihua.service_community.model.dos.ComEldersAuthUserDO">
|
<result property="id" column="id"/>
|
<result property="userId" column="user_id"/>
|
<result property="relation" column="relation"/>
|
<result property="isAuth" column="is_auth"/>
|
<result property="name" column="name"/>
|
<result property="idCard" column="id_card"/>
|
<result property="communityId" column="community_id"/>
|
<result property="bigAgeId" column="big_age_id"/>
|
</resultMap>
|
|
<sql id="columns">
|
<![CDATA[
|
id,user_id,relation,is_auth,name,id_card,community_id,big_age_id
|
]]>
|
</sql>
|
|
<!-- 分页查询 -->
|
<select id="findByPage" resultType="com.panzhihua.common.model.vos.elders.ComElderAuthUserAppVO">
|
SELECT
|
ceau.id AS elderId,
|
ceau.`name`,
|
ceau.id_card,
|
ceau.relation,
|
ceau.is_auth,
|
ca.`name` AS communityName,
|
ae.is_exist
|
FROM
|
com_elders_auth_user AS ceau
|
LEFT JOIN com_act AS ca ON ca.community_id = ceau.community_id
|
LEFT JOIN com_elders_auth_elderly ae ON ceau.big_age_id = ae.id
|
where ceau.user_id = #{userId}
|
order by ceau.create_at desc
|
</select>
|
|
<select id="countCurrentMonthValidAuthRecord" resultType="java.lang.Integer" >
|
SELECT COUNT(*)
|
FROM com_elders_auth
|
WHERE FAMILY_USER_ID = #{elderId} AND DATE_FORMAT(create_at, '%Y-%m') = DATE_FORMAT(NOW(), '%Y-%m') AND (`type` = 2 OR ( type=1 AND `STATUS` IS NULL) )
|
</select>
|
|
<update id="updateAuthStatus">
|
update com_elders_auth_user set is_auth = 2
|
</update>
|
|
|
</mapper>
|