mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?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>