New file |
| | |
| | | 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.vos.community.ComActActivityVO; |
| | | import com.panzhihua.common.model.vos.community.ComActDynVO; |
| | | import com.panzhihua.service_community.model.dos.ComActDynDO; |
| | | 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-07 14:06 |
| | | **/ |
| | | @Mapper |
| | | public interface ComActDynDAO extends BaseMapper<ComActDynDO> { |
| | | @Select("<script> " + |
| | | "SELECT \n" + |
| | | "d.id,\n" + |
| | | "d.title,\n" + |
| | | "COUNT(u.id)readNum,\n" + |
| | | "d.`status`,\n" + |
| | | "d.`content`,\n" + |
| | | "d.`cover`,\n" + |
| | | "d.is_topping,\n" + |
| | | "d.publish_at,\n" + |
| | | "d.create_at\n" + |
| | | "FROM\n" + |
| | | "com_act_dyn d\n" + |
| | | "LEFT JOIN com_act_dyn_user u ON d.id = u.dyn_id \n" + |
| | | "WHERE\n" + |
| | | "d.community_id=#{comActDynVO.communityId}\n" + |
| | | "<if test='comActDynVO.title != null and comActDynVO.title.trim() != ""'>" + |
| | | "AND d.title like concat(#{comActDynVO.title},'%') \n" + |
| | | " </if> " + |
| | | "<if test='comActDynVO.isTopping != null '>" + |
| | | "AND d.is_topping = #{comActDynVO.isTopping} \n" + |
| | | " </if> " + |
| | | "<if test='comActDynVO.status != null '>" + |
| | | "AND d.`status` = #{comActDynVO.status} \n" + |
| | | " </if> " + |
| | | "<if test='comActDynVO.publishAtBegin != null '>" + |
| | | "AND d.publish_at BETWEEN #{comActDynVO.publishAtBegin} \n" + |
| | | "AND #{comActDynVO.publishAtEnd}" + |
| | | " </if> " + |
| | | " group by d.id "+ |
| | | " order by d.is_topping desc, d.create_at desc "+ |
| | | "</script>") |
| | | IPage<ComActDynVO> pageDynamic(Page page, @Param("comActDynVO") ComActDynVO comActDynVO); |
| | | @Update("update com_act_dyn set `status`=1 WHERE `status`=0 and TIMESTAMPDIFF(MINUTE, SYSDATE(), publish_at)<=0 ") |
| | | int timedTaskDynStatus(); |
| | | } |