huanghongfa
2021-01-14 2b5b52e808c172d9b9fb86a1aed3ae022326e5bc
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.PartyBuildingComPbDynVO;
import com.panzhihua.common.model.vos.partybuilding.PartyCommitteeVO;
import com.panzhihua.service_dangjian.model.dos.ComPbDynDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
 
/**
 * @program: springcloud_k8s_panzhihuazhihuishequ
 * @description: 动态
 * @author: huang.hongfa weixin hhf9596 qq 959656820
 * @create: 2020-12-01 15:49
 **/
@Mapper
public interface ComPbDynDAO extends BaseMapper<ComPbDynDO> {
//    @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" +
            "d.id,\n" +
            "d.title,\n" +
            "COUNT( u.id ) readingVolume,\n" +
            "d.`status`,\n" +
            "d.publish_at,\n" +
            "d.content,\n" +
            "d.cover,\n" +
            "d.create_at \n" +
            "FROM\n" +
            "com_pb_dyn d\n" +
            "LEFT JOIN com_pb_dyn_user u ON d.id = u.dyn_id \n" +
            "where d.type=#{partyBuildingComPbDynVO.type}  \n" +
            "<if test='partyBuildingComPbDynVO.communityId != null and partyBuildingComPbDynVO.communityId != 0'>" +
            "and d.community_id = #{partyBuildingComPbDynVO.communityId} \n" +
            " </if> " +
            "<if test='partyBuildingComPbDynVO.title != null and partyBuildingComPbDynVO.title.trim() != &quot;&quot;'>" +
            "and d.title = #{partyBuildingComPbDynVO.title} \n" +
            " </if> " +
            "<if test='partyBuildingComPbDynVO.status != null and partyBuildingComPbDynVO.status != 0'>" +
            "AND d.`status` = #{partyBuildingComPbDynVO.status} \n" +
            " </if> " +
            "<if test='partyBuildingComPbDynVO.publishAtBegin != null '>" +
            "AND d.publish_at BETWEEN #{partyBuildingComPbDynVO.publishAtBegin} \n" +
            "AND #{partyBuildingComPbDynVO.publishAtEnd} \n" +
            " </if> " +
            "GROUP BY\n" +
            "d.id\n" +
            "ORDER BY d.create_at desc"+
            "</script>")
    IPage<PartyBuildingComPbDynVO> pageYnamic(Page page, @Param("partyBuildingComPbDynVO") PartyBuildingComPbDynVO partyBuildingComPbDynVO);
    @Update("update com_pb_dyn set `status`=2  WHERE `status`=1 and TIMESTAMPDIFF(HOUR,SYSDATE(),publish_at)<=0")
    int timedTaskPartyBuildingStatus();
}