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
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.PageActivityMembersVO;
import com.panzhihua.common.model.vos.partybuilding.PartyBuildingActivityVO;
import com.panzhihua.service_dangjian.model.dos.ComPbActivityMemberDO;
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-01 10:04
 **/
@Mapper
public interface ComPbActivityMemberDAO extends BaseMapper<ComPbActivityMemberDO> {
//    @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" +
            "m.id,\n" +
            "me.NAME,\n" +
            "u.phone,\n" +
            "m.create_at registrationTime \n" +
            "FROM\n" +
            "com_pb_activity_member m\n" +
            "JOIN com_pb_member me ON m.member_id = me.id\n" +
            "LEFT JOIN sys_user u ON me.id_card = u.id_card \n" +
            "WHERE\n" +
            "m.activity_id = #{pageActivityMembersVO.activityId} \n" +
            "<if test='pageActivityMembersVO.name != null and pageActivityMembersVO.name.trim() != &quot;&quot;'>" +
            "AND me.`name` = #{pageActivityMembersVO.name} \n" +
            " </if> " +
            "<if test='pageActivityMembersVO.phone != null and pageActivityMembersVO.phone.trim() != &quot;&quot;'>" +
            "AND u.phone = #{pageActivityMembersVO.phone}" +
            " </if> " +
            "</script>")
    IPage<PageActivityMembersVO> pageActivityMembers(Page page, @Param("pageActivityMembersVO") PageActivityMembersVO pageActivityMembersVO);
 
    @Select("select a.* from com_pb_activity_member a join com_pb_member m on m.id=a.member_id " +
            "join sys_user u on m.id_card=u.id_card and u.user_id=#{userId} where a.activity_id=#{id}")
    ComPbActivityMemberDO selectByUserIdActivityId(@Param("id") Long id, @Param("userId") Long userId);
    @Select("SELECT \n" +
            "u.user_id\n" +
            "FROM\n" +
            "com_pb_activity_member m \n" +
            "join com_pb_member b on m.member_id=b.id\n" +
            "join sys_user u on b.id_card=u.id_card\n" +
            "WHERE\n" +
            "m.activity_id =#{id}")
    List<Long> selectAllPartyBuildingActivityMembers(Long id);
}