findyguo
2021-03-05 68f64a1e69e852654f097e84d15843f37bdf34b7
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
package com.panzhihua.service_community.dao;
 
import java.util.List;
 
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 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.ComActEasyPhotoVO;
import com.panzhihua.common.model.vos.community.ComActMessageBackVO;
import com.panzhihua.common.model.vos.community.ComActMessageVO;
import com.panzhihua.common.model.vos.community.PageComActMessageVO;
import com.panzhihua.common.model.vos.partybuilding.ComPbServiceTeamVO;
import com.panzhihua.common.model.vos.partybuilding.PartyCommitteeVO;
import com.panzhihua.service_community.model.dos.ComActMessageDO;
 
@Mapper
public interface ComActMessageDAO extends BaseMapper<ComActMessageDO> {
 
    @Select("select * from com_pb_member_role where id=#{id}")
    PartyCommitteeVO selectPartyCommitteeById(@Param("id")Long id);
    @Select("select * from com_pb_service_team where id=#{id}")
    ComPbServiceTeamVO selectComPbServiceTeamById(@Param("id")Long id);
    
    @Select("select * from com_act_message_back where msg_id=#{id} order by create_at desc")
    List<ComActMessageBackVO> selectMsgBackList(@Param("id")Long id);
    
    @Select("select * from com_act_message where (sendto_user_id in (select id from com_pb_member_role t1 where t1.phone=#{comActMessageVO.phone})) or (sendto_user_id in (select id from com_pb_service_team t2 where t2.phone=#{comActMessageVO.phone}))  order by create_at desc")
    IPage<PageComActMessageVO> pageSendMeMessageApplets(Page page, @Param("comActMessageVO")ComActMessageVO comActMessageVO);
    
    @Select("select * from com_act_message where user_id=#{comActMessageVO.userId}  order by create_at desc")
    IPage<PageComActMessageVO> pageMyMessageApplets(Page page, @Param("comActMessageVO")ComActMessageVO comActMessageVO);
    @Select("select * from com_act_message where sendto_user_id=#{comActMessageVO.sendtoUserId} and ispublic=1")
    IPage<PageComActMessageVO> pageMessageByUserApplets(Page page, @Param("comActMessageVO")ComActMessageVO comActMessageVO);
    
    @Update("update com_act_message set ispublic=#{ispublic} where id=#{id}")
    void updatePublic(@Param("ispublic") Integer ispublic,@Param("id") Long id);
    
    @Select("<script> " +
            "SELECT * \n" +
            "FROM\n" +
            "com_act_message t where t.community_id=#{comActMessageVO.communityId}\n" +
            "<if test='comActMessageVO.userAccount != null and comActMessageVO.userAccount.trim() != &quot;&quot;'>" +
            " and t.user_account=#{comActMessageVO.userAccount} \n" +
            " </if> " +
            "<if test='comActMessageVO.userName != null and comActMessageVO.userName.trim() != &quot;&quot;'>" +
            " and t.user_name=#{comActMessageVO.userName} \n" +
            " </if> " +
            "<if test='comActMessageVO.userPhone != null and comActMessageVO.userPhone.trim() != &quot;&quot;'>" +
            " and t.user_phone=#{comActMessageVO.userPhone} \n" +
            " </if> " +
            "<if test='comActMessageVO.msgContent != null and comActMessageVO.msgContent.trim() != &quot;&quot;'>" +
            " and t.msg_content like concat('%',#{comActMessageVO.msgContent},'%') \n" +
            " </if> " +
            "<if test='comActMessageVO.status != null and comActMessageVO.status != 0'>" +
            " and t.`status`=#{comActMessageVO.status} \n" +
            " </if> " +
            "<if test='comActMessageVO.ispublic != null and comActMessageVO.ispublic != 0'>" +
            " and t.ispublic=#{comActMessageVO.ispublic} \n" +
            " </if> " +
            "<if test='comActMessageVO.sendtoUserName != null and comActMessageVO.sendtoUserName.trim() != &quot;&quot;'>" +
            " and t.sendto_user_name=#{comActMessageVO.sendtoUserName} \n" +
            " </if> " +
            "<if test='comActMessageVO.publishAtBegin != null '>" +
            "AND t.create_at BETWEEN #{comActMessageVO.publishAtBegin} \n" +
            "AND #{comActMessageVO.publishAtEnd} \n" +
            " </if> " +
            " order by create_at desc"+
            "</script>")
    IPage<PageComActMessageVO> pageMyCommunityMessageApplets(Page page, @Param("comActMessageVO")ComActMessageVO comActMessageVO);
}