huanghongfa
2021-01-15 ada9d2e3f734582a0d9ae8c00a936d8c8ed669d7
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
package com.panzhihua.service_community.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.community.ComMngVolunteerMngVO;
import com.panzhihua.common.model.vos.community.TodoEventsVO;
import com.panzhihua.service_community.model.dos.ComMngVolunteerMngDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
 
import java.util.List;
 
/**
 * @program: springcloud_k8s_panzhihuazhihuishequ
 * @description: 志愿者
 * @author: huang.hongfa weixin hhf9596 qq 959656820
 * @create: 2020-12-15 09:50
 **/
@Mapper
public interface ComMngVolunteerMngDAO extends BaseMapper<ComMngVolunteerMngDO> {
    //    @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" +
            "id,\n" +
            "`name`,\n" +
            "photo_path,\n" +
            "phone,\n" +
            "integral,\n" +
            "create_at \n" +
            "FROM\n" +
            "com_mng_volunteer_mng \n" +
            " where state=2 and community_id=#{comMngVolunteerMngVO.communityId}" +
            "<if test='comMngVolunteerMngVO.name != null and comMngVolunteerMngVO.name.trim() != &quot;&quot;'>" +
            " and name = #{comMngVolunteerMngVO.name} \n" +
            " </if> " +
            "<if test='comMngVolunteerMngVO.phone != null and comMngVolunteerMngVO.phone.trim() != &quot;&quot;'>" +
            "AND phone = #{comMngVolunteerMngVO.phone}" +
            " </if> " +
            " order by integral desc,create_at desc"+
            "</script>")
    IPage<ComMngVolunteerMngVO> pageVolunteer(Page page, @Param("comMngVolunteerMngVO") ComMngVolunteerMngVO comMngVolunteerMngVO);
 
    @Select("<script> " +
            "SELECT\n" +
            "id,\n" +
            "`name`,\n" +
            "state,\n" +
            "phone,\n" +
            "create_at \n" +
            "FROM\n" +
            "com_mng_volunteer_mng \n" +
            "WHERE\n" +
            "state in (1,3)\n" +
            "<if test='comMngVolunteerMngVO.name != null and comMngVolunteerMngVO.name.trim() != &quot;&quot;'>" +
            "and name = #{comMngVolunteerMngVO.name} \n" +
            " </if> " +
            "<if test='comMngVolunteerMngVO.phone != null and comMngVolunteerMngVO.phone.trim() != &quot;&quot;'>" +
            "AND phone = #{comMngVolunteerMngVO.phone}\n" +
            " </if> " +
            "<if test='comMngVolunteerMngVO.state != null and comMngVolunteerMngVO.state != 0'>" +
            "and state=#{comMngVolunteerMngVO.state}\n" +
            " </if> " +
            "ORDER BY state asc " +
            "</script>")
    IPage<ComMngVolunteerMngVO> pageVolunteerExamine(Page page, @Param("comMngVolunteerMngVO") ComMngVolunteerMngVO comMngVolunteerMngVO);
    @Select("SELECT\n" +
            "'人脸采集' FUNCTION,\n" +
            "'待审核' behavior,\n" +
            "'新增人脸采集信息待审核' words \n" +
            "FROM\n" +
            "sys_user u \n" +
            "WHERE\n" +
            "u.face_state = 0 \n" +
            "AND u.community_id = #{communityId} \n" +
            "GROUP BY\n" +
            "u.community_id UNION ALL\n" +
            "SELECT\n" +
            "'志愿者审核' FUNCTION,\n" +
            "'待审核' behavior,\n" +
            "'新增志愿者申请待审核' words \n" +
            "FROM\n" +
            "com_mng_volunteer_mng v \n" +
            "WHERE\n" +
            "v.state = 1 \n" +
            "AND v.`community_id` = #{communityId} \n" +
            "GROUP BY\n" +
            "v.community_id")
    List<TodoEventsVO> selectNeedToDo(Long communityId);
    @Select("select user_id from sys_user where type=1 and phone=#{phone}")
    Long selectUserIdByPhone(String phone);
}