101captain
2021-11-11 78d1c9ee9b0c49f77c29d0535cb93c6d62c42f3a
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<?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>
 
    <select id="pageMicroWishAdmin" 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,
        su1.`name` responsible_name,
        w.score,
        w.img_width,
        w.finish_at,
        w.aim_num,
        w.img_height,
        w.handle_id,
        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 sys_user su1 ON w.responsible_id = su1.user_id
        <where>
            <if test='comActMicroWishVO.communityId != null and comActMicroWishVO.communityId != 0'>
                and w.community_id=#{comActMicroWishVO.communityId}
            </if>
            <if test='comActMicroWishVO.createBegin != null '>
                AND w.create_at BETWEEN #{comActMicroWishVO.createBegin}
                AND #{comActMicroWishVO.createEnd}
            </if>
            <if test='comActMicroWishVO.sponsorPhone != null and comActMicroWishVO.sponsorPhone != &quot;&quot;'>
                AND u.`phone` like concat(#{comActMicroWishVO.sponsorPhone},'%')
            </if>
            <if test='comActMicroWishVO.sponsorName != null and comActMicroWishVO.sponsorName != &quot;&quot;'>
                AND u.`name` like concat(#{comActMicroWishVO.sponsorName},'%')
            </if>
            <if test='comActMicroWishVO.responsibleName != null and comActMicroWishVO.responsibleName != &quot;&quot;'>
                AND su1.`name` like concat(#{comActMicroWishVO.responsibleName},'%')
            </if>
            <if test='comActMicroWishVO.status != null'>
                AND w.`status` = #{comActMicroWishVO.status}
            </if>
        </where>
        group by w.id
 
        ORDER BY  w.create_at desc
    </select>
 
</mapper>