罗元桥
2021-09-27 d7a8baeff8b0e68c54a959e5f46f639c54aad1d1
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?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.ComActMicroWishDAO">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComActMicroWishDO">
        <id column="id" property="id" />
        <result column="sponsor_id" property="sponsorId" />
        <result column="sponsor_phone" property="sponsorPhone" />
        <result column="wish_name" property="wishName" />
        <result column="status" property="status" />
        <result column="form" property="form" />
        <result column="responsible_id" property="responsibleId" />
        <result column="create_at" property="createAt" />
        <result column="examine_at" property="examineAt" />
        <result column="distribution_at" property="distributionAt" />
        <result column="feedback_at" property="feedbackAt" />
        <result column="evaluate_at" property="evaluateAt" />
        <result column="score" property="score" />
        <result column="detail" property="detail" />
        <result column="photo_path_list" property="photoPathList" />
        <result column="community_id" property="communityId" />
        <result column="evaluate" property="evaluate" />
        <result column="finish_at" property="finishAt" />
        <result column="finish_photo_path_list" property="finishPhotoPathList" />
        <result column="finish" property="finish" />
        <result column="reject_reason" property="rejectReason" />
        <result column="feedback" property="feedback" />
        <result column="feedback_photo_path_list" property="feedbackPhotoPathList" />
        <result column="aim_num" property="aimNum" />
        <result column="img_width" property="imgWidth" />
        <result column="img_height" property="imgHeight" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, sponsor_id, sponsor_phone, wish_name, status, form, responsible_id, create_at, examine_at, distribution_at, feedback_at, evaluate_at, score, detail, photo_path_list, community_id, evaluate, finish_at, finish_photo_path_list, finish, reject_reason, feedback, feedback_photo_path_list, aim_num, img_width, img_height
    </sql>
 
    <select id="pageMicroWishApplets" parameterType="com.panzhihua.common.model.vos.community.ComActMicroWishVO"
            resultType="com.panzhihua.common.model.vos.community.ComActMicroWishVO">
        SELECT
        w.id,
        u.name sponsor_name,
        u.nick_name userNickName,
        u.image_url ,
        w.sponsor_phone,
        w.wish_name,
        w.`status`,
        w.`feedback_at`,
        w.`examine_at`,
        w.`distribution_at`,
        w.`evaluate_at`,
        w.`photo_path_list`,
        count(wu.id)star_num,
        w.`detail`,
        w.form,
        w.reject_reason,
        su.`name` responsible_name,
        w.score,
        w.img_width,
        w.finish_at,
        w.aim_num,
        w.img_height,
        w.create_at
        FROM
        com_act_micro_wish w
        left join com_act_micro_wish_user wu on w.id=wu.micro_wish_id
        left JOIN sys_user u ON w.sponsor_id = u.user_id
        left JOIN com_pb_service_team su ON w.responsible_id = su.id
        <where>
            <if test='comActMicroWishVO.communityId != null and comActMicroWishVO.communityId != 0'>
                and w.community_id=#{comActMicroWishVO.communityId}
            </if>
            <if test='comActMicroWishVO.status == 3  and comActMicroWishVO.isApplets != null and comActMicroWishVO.isApplets != 0'>
                AND w.`status` in (2,3)
            </if>
            <if test='comActMicroWishVO.status == 6  and comActMicroWishVO.isApplets != null and comActMicroWishVO.isApplets != 0'>
                AND w.`status` in (5,6)
            </if>
            <if test='comActMicroWishVO.status == 7  and comActMicroWishVO.isApplets != null and comActMicroWishVO.isApplets != 0'>
                AND w.`status` = 7
            </if>
            <if test='comActMicroWishVO.isApplets != null and comActMicroWishVO.isApplets != 0 and comActMicroWishVO.status != null and comActMicroWishVO.status != 7 and comActMicroWishVO.status != 6 and comActMicroWishVO.status != 3'>
                AND w.status  in (3, 5, 6)
            </if>
            <if test='comActMicroWishVO.userId != null and comActMicroWishVO.userId != 0'>
                AND w.sponsor_id  =#{comActMicroWishVO.userId}
            </if>
        </where>
        group by w.id
        ORDER BY  w.create_at desc
    </select>
 
    <select id="getWishHandleListAdmin" resultType="com.panzhihua.common.model.vos.user.SysUserVO">
        <if test="type != null and type == 1">
            select user_id,`name` as `name` from sys_user where `type` = 3 and community_id = #{communityId} and status = 1
        </if>
        <if test="type != null and type == 2">
            select user_id,IFNULL(`name`,nick_name) as `name` from sys_user where `type` = 1 and community_id = #{communityId} and status = 1 and is_partymember = 1
        </if>
        <if test="type != null and type == 3">
            select user_id,IFNULL(`name`,nick_name) as `name` from sys_user where `type` = 1 and community_id = #{communityId} and status = 1 and is_volunteer = 1
        </if>
    </select>
 
    <select id="getUserByUserId" resultType="com.panzhihua.common.model.vos.user.SysUserVO">
        select user_id,IFNULL(`name`,nick_name) as `name`,`type`,is_volunteer,is_partymember from sys_user where user_id = #{userId}
    </select>
 
</mapper>