CeDo
2021-04-14 2b31c465fe201d378c35d0711b1ce0337f194914
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
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.dtos.community.PageQuestnaireDTO;
import com.panzhihua.common.model.vos.community.questnaire.QuestnaireListVo;
import com.panzhihua.service_community.model.dos.ComActQuestnaireDO;
import com.panzhihua.service_community.model.dos.ComActQuestnaireSubSelectionDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
 
/**
 * @Author: llming
 * @Description: 调查问卷 问卷表
 */
@Mapper
public interface ComActQuestnaireDAO extends BaseMapper<ComActQuestnaireDO> {
    @Select("<script> " +
            "SELECT  aq.id, aq.title, aq.state, u.name as create_user, aq.join_count, aq.create_at , aq.create_by \n" +
            "FROM \n" +
            " com_act_questnaire aq \n" +
            " LEFT JOIN sys_user u on aq.create_by = u.user_id \n" +
            " where 1=1 " +
            "<if test='communityId != null and communityId!=0 '>\n" +
            " and aq.community_id = #{communityId}\n" +
            " </if> " +
            "<if test='pageQuestnaireDTO.state != null '>\n" +
            " and aq.state = #{pageQuestnaireDTO.state} \n" +
            " </if> " +
            "<if test='pageQuestnaireDTO.forMasses != null '>\n" +
            " and aq.for_masses = #{pageQuestnaireDTO.forMasses} \n" +
            " </if> \n" +
 
            "<if test='pageQuestnaireDTO.forParty==true and pageQuestnaireDTO.forVolunteer==true '>\n" +   //既是党员又是志愿者
            " and ( aq.for_party = 1 OR aq.for_party=1 OR (aq.for_party!=1 AND aq.for_volunteer!=1) )  \n" +
            " </if> \n" +
 
            "<if test='pageQuestnaireDTO.forParty==true and pageQuestnaireDTO.forVolunteer==false '>\n" +     //党员 不是志愿者
            " and ( aq.for_party = 1 OR (aq.for_party!=1 AND aq.for_volunteer!=1) )  \n" +
            " </if> \n" +
 
            "<if test='pageQuestnaireDTO.forParty==false and pageQuestnaireDTO.forVolunteer==true '>\n" +    //非党员的志愿者
            " and ( aq.for_volunteer = 1 OR (aq.for_party!=1 AND aq.for_volunteer!=1) )  \n" +
            " </if> \n" +
 
            "<if test='pageQuestnaireDTO.forParty==false and pageQuestnaireDTO.forVolunteer==false '>\n" +    //非党员非志愿者
            " and  (aq.for_party!=1 AND aq.for_volunteer!=1)  \n" +
            " </if> \n" +
 
            "<if test='pageQuestnaireDTO.startTime != null '>\n" +
            " AND aq.create_at BETWEEN \n" +
            "#{pageComActDTO.startTime} \n" +
            " AND #{pageQuestnaireDTO.endTime}\n" +
            " </if> \n" +
            " ORDER BY \n" +
            " aq.create_at DESC" +
            "</script>")
    IPage<QuestnaireListVo> selectPageList(Page page, @Param("pageQuestnaireDTO") PageQuestnaireDTO pageQuestnaireDTO, @Param("communityId") Long communityId);
}