CeDo
2021-05-11 757e5dc619ddf01fbd9ec2c8c75b6663d79835cb
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
169
170
171
172
173
174
175
176
177
178
package com.panzhihua.service_dangjian.dao;
 
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.panzhihua.common.model.vos.partybuilding.ComPbMemberExcelVO;
import com.panzhihua.common.model.vos.partybuilding.PagePartyBuildingMemberVO;
import com.panzhihua.common.model.vos.partybuilding.PagePartyOrganizationVO;
import com.panzhihua.common.model.vos.partybuilding.PartyBuildingMemberVO;
import com.panzhihua.service_dangjian.model.dos.ComPbMemberDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
 
import java.util.List;
 
/**
 * @program: springcloud_k8s_panzhihuazhihuishequ
 * @description: 党员
 * @author: huang.hongfa weixin hhf9596 qq 959656820
 * @create: 2020-11-30 10:52
 **/
@Mapper
public interface ComPbMemberDAO extends BaseMapper<ComPbMemberDO> {
//    -------------------动态模板-------------
//    @Select("<script> " +
//            " <where>" +
//            "<if test='nameCn != null and nameCn.trim() != &quot;&quot;'>" +
//            " </if> " +
//            "<if test='nameCn != null and nameCn.trim() != &quot;&quot;'>" +
//            " </if> " +
//            "<if test='nameCn != null and nameCn.trim() != &quot;&quot;'>" +
//            " </if> " +
//            " </where>" +
//            "</script>")
 
    @Select("<script> " +
            "SELECT\n" +
            "o.`name` orgName,\n" +
            "m.org_id,\n"+
            "m.id_card,\n"+
            "m.`id`,\n" +
            "u.phone,\n" +
            "m.`name`,\n" +
            "m.photo_path,\n" +
            "TIMESTAMPDIFF(\n" +
            "YEAR,\n" +
            "m.employment_time,\n" +
            "DATE_FORMAT( NOW(), '%Y-%m-%d' )) partyAge,\n" +
            "m.join_time,\n" +
            "m.employment_time,\n" +
            "CASE\n" +
            "WHEN u.id_card IS NULL THEN\n" +
            "'未注册' ELSE '已注册' \n" +
            "END STATUS \n" +
            "FROM\n" +
            "com_pb_member m\n" +
            "LEFT JOIN sys_user u ON m.id_card = u.id_card\n" +
            "LEFT JOIN com_pb_org o ON m.org_id = o.id"+
            " where m.community_id=#{pagePartyOrganizationVO.communityId} and m.audit_result='1' " +
            "<if test='pagePartyOrganizationVO.orgName != null and pagePartyOrganizationVO.orgName != &quot;&quot;'>" +
            "and o.name like concat(#{pagePartyOrganizationVO.orgName},'%') "+
            " </if> " +
            "<if test='pagePartyOrganizationVO.account != null and pagePartyOrganizationVO.account != &quot;&quot;'>" +
            "and u.phone like concat (#{pagePartyOrganizationVO.account},'%')"+
            " </if> " +
            "<if test='pagePartyOrganizationVO.name != null and pagePartyOrganizationVO.name != &quot;&quot;'>" +
            "and m.name like concat (#{pagePartyOrganizationVO.name},'%')"+
            " </if> " +
            "order by m.create_at desc "+
            "</script>")
    IPage<PartyBuildingMemberVO> pagePartyOrganization(Page page, @Param("pagePartyOrganizationVO") PagePartyOrganizationVO pagePartyOrganizationVO);
 
    @Select("select m.* from sys_user u join com_pb_member m on u.id_card=m.id_card where u.user_id=#{userId}")
    ComPbMemberDO selectByUserId(Long userId);
 
    @Select("select name from sys_user where user_id=#{createBy}")
    String selectNameByUserId(Long createBy);
    @Update("update sys_user u set u.is_partymember=0 where u.id_card=#{idCard}")
    void updateUserIsPartymember(String idCard);
 
 
    @Select("<script> " +
            "SELECT\n" +
            "o.`name` orgName,\n" +
            "m.org_id,\n"+
            "m.id_card,\n"+
            "m.`id`,\n" +
            "u.phone,\n" +
            "m.`name`,\n" +
            "m.photo_path,\n" +
            "TIMESTAMPDIFF(\n" +
            "YEAR,\n" +
            "m.employment_time,\n" +
            "DATE_FORMAT( NOW(), '%Y-%m-%d' )) partyAge,\n" +
            "m.join_time,\n" +
            "m.audit_result, \n" +
            "m.employment_time,\n" +
            "CASE\n" +
            "WHEN u.id_card IS NULL THEN\n" +
            "'未注册' ELSE '已注册' \n" +
            "END STATUS \n" +
            "FROM\n" +
            "com_pb_member m\n" +
            "LEFT JOIN sys_user u ON m.id_card = u.id_card\n" +
            "LEFT JOIN com_pb_org o ON m.org_id = o.id"+
            " where m.user_id is not null  " +
            "<if test='pagePartyBuildingMemberVO.phone != null and pagePartyBuildingMemberVO.phone != &quot;&quot;'>" +
            "and u.phone = #{pagePartyBuildingMemberVO.phone} "+
            " </if> " +
            "<if test='pagePartyBuildingMemberVO.name != null and pagePartyBuildingMemberVO.name != &quot;&quot;'>" +
            "and u.name like concat (#{pagePartyBuildingMemberVO.name},'%')"+
            " </if> " +
            "<if test='pagePartyBuildingMemberVO.auditStatus != null and pagePartyBuildingMemberVO.auditStatus != &quot;&quot;'>" +
            "and m.audit_result = #{pagePartyBuildingMemberVO.auditStatus}"+
            " </if> " +
            "order by m.join_time desc "+
            "</script>")
    IPage<PartyBuildingMemberVO> pagePartyBuildingMemberVO(Page page, @Param("pagePartyBuildingMemberVO") PagePartyBuildingMemberVO pagePartyBuildingMemberVO);
 
    @Select("<script> " +
            "SELECT\n" +
            "o.`name` orgName,\n" +
            "m.org_id,\n"+
            "m.id_card,\n"+
            "m.`id`,\n" +
            "u.phone,\n" +
            "m.`name`,\n" +
            "m.photo_path,\n" +
            "TIMESTAMPDIFF(\n" +
            "YEAR,\n" +
            "m.employment_time,\n" +
            "DATE_FORMAT( NOW(), '%Y-%m-%d' )) partyAge,\n" +
            "m.join_time,\n" +
            "m.audit_result, \n" +
            "m.employment_time,\n" +
            "CASE\n" +
            "WHEN u.id_card IS NULL THEN\n" +
            "'未注册' ELSE '已注册' \n" +
            "END STATUS," +
            " m.create_at \n" +
            "FROM\n" +
            "com_pb_member m\n" +
            "LEFT JOIN sys_user u ON m.id_card = u.id_card\n" +
            "LEFT JOIN com_pb_org o ON m.org_id = o.id"+
            " where m.audit_result in (0,3)  " +
            "<if test='pagePartyBuildingMemberVO.phone != null and pagePartyBuildingMemberVO.phone != &quot;&quot;'>" +
            " and u.phone LIKE CONCAT('%',#{pagePartyBuildingMemberVO.phone},'%') "+
            " </if> " +
            "<if test='pagePartyBuildingMemberVO.name != null and pagePartyBuildingMemberVO.name != &quot;&quot;'>" +
            " and u.name like concat ('%',#{pagePartyBuildingMemberVO.name},'%')"+
            " </if> " +
            "<if test='pagePartyBuildingMemberVO.auditStatus != null'>" +
            " and m.audit_result = #{pagePartyBuildingMemberVO.auditStatus}"+
            " </if> " +
            " order by m.join_time desc "+
            "</script>")
    IPage<PartyBuildingMemberVO> pagePartyBuildingMembersVO(Page page, @Param("pagePartyBuildingMemberVO") PagePartyBuildingMemberVO pagePartyBuildingMemberVO);
 
    @Select("<script> " +
            "select cpm.name as comName,cpm.id_card,cpm.join_time,cpm.employment_time,ca.`name` as communityName,cpo.name as orgName from com_pb_member as cpm " +
            " left join com_act as ca on ca.community_id = cpm.community_id " +
            " left join com_pb_org as cpo on cpo.id = cpm.org_id " +
            " LEFT JOIN sys_user u ON cpm.id_card = u.id_card " +
            " where cpm.community_id = #{organizationVO.communityId} and cpm.audit_result = 1 " +
            "<if test='organizationVO.orgName != null'>" +
            " and cpo.name LIKE CONCAT('%',#{organizationVO.orgName},'%') "+
            " </if> " +
            "<if test='organizationVO.account != null and organizationVO.account != &quot;&quot;'>" +
            " and u.phone like concat (#{organizationVO.account},'%')"+
            " </if> " +
            "<if test='organizationVO.name != null and organizationVO.name != &quot;&quot;'>" +
            " and cpm.name like concat (#{organizationVO.name},'%')"+
            " </if> " +
            "</script>")
    List<ComPbMemberExcelVO> exportPbMember(@Param("organizationVO") PagePartyOrganizationVO organizationVO);
}