huanghongfa
2021-07-22 02f18587bd8860b305e2c688e20465be166bb48c
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActQuestnaireDAO.java
@@ -6,7 +6,6 @@
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;
@@ -18,12 +17,20 @@
@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" +
            "SELECT DISTINCT  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 is_hide=0 " +
            "<if test='communityId != null and communityId!=0 '>\n" +
            "<if test='pageQuestnaireDTO.userId != null '>\n" +    //筛选用户已回答的问卷
            " LEFT JOIN com_act_questnaire_sub qs ON aq.id = qs.que_Id\n" +
            " LEFT JOIN com_act_questnaire_answer_content ac ON qs.id = ac.sub_id  AND ac.user_id=#{pageQuestnaireDTO.userId} " +
            " </if> \n" +
            " where aq.is_hide=0 " +
            "<if test='pageQuestnaireDTO.userId != null '>\n" +    //筛选用户已回答的问卷
            "  AND case when ac.id IS NULL then aq.state=0 ELSE TRUE end " +
            " </if> \n" +
            "<if test='communityId != null and communityId!=0l '>\n" +
            " and aq.community_id = #{communityId}\n" +
            " </if> " +
            "<if test='pageQuestnaireDTO.state != null '>\n" +
@@ -32,9 +39,12 @@
            "<if test='pageQuestnaireDTO.forMasses != null '>\n" +
            " and aq.for_masses = #{pageQuestnaireDTO.forMasses} \n" +
            " </if> \n" +
            "<if test='pageQuestnaireDTO.title != null '>\n" +
            " and aq.title like concat('%', #{pageQuestnaireDTO.title},'%') \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" +
            " and ( aq.for_party = 1 OR aq.for_volunteer=1 OR (aq.for_party!=1 AND aq.for_volunteer!=1) )  \n" +
            " </if> \n" +
            "<if test='pageQuestnaireDTO.forParty==true and pageQuestnaireDTO.forVolunteer==false '>\n" +     //党员 不是志愿者
@@ -50,9 +60,10 @@
            " </if> \n" +
            "<if test='pageQuestnaireDTO.startTime != null '>\n" +
            " AND aq.create_at BETWEEN \n" +
            "#{pageComActDTO.startTime} \n" +
            " AND #{pageQuestnaireDTO.endTime}\n" +
            " AND aq.create_at <![CDATA[>=]]> #{pageQuestnaireDTO.startTime}  \n" +
            "</if>" +
            "<if test='pageQuestnaireDTO.endTime != null '>\n" +
            " AND aq.create_at <![CDATA[<=]]> #{pageQuestnaireDTO.endTime}  \n" +
            " </if> \n" +
            " ORDER BY \n" +
            " aq.create_at DESC" +