From 4082af9f2275d501cd47a8a63e34cb266a2fbfd4 Mon Sep 17 00:00:00 2001
From: 罗元桥 <2376770955@qq.com>
Date: 星期六, 09 十月 2021 18:44:00 +0800
Subject: [PATCH] Merge branch 'test_bak' into 'master'
---
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActDynDAO.java | 97 ++++++++++++++++++++++++++++++------------------
1 files changed, 60 insertions(+), 37 deletions(-)
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActDynDAO.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActDynDAO.java
index 2a38f7b..5d322c7 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActDynDAO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActDynDAO.java
@@ -1,14 +1,19 @@
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 java.util.Map;
+
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.ComActDynVO;
+import com.panzhihua.common.model.vos.screen.DateScreenVO;
+import com.panzhihua.common.model.vos.screen.DynamicWorkVO;
+import com.panzhihua.service_community.model.dos.ComActDynDO;
/**
* @program: springcloud_k8s_panzhihuazhihuishequ
@@ -18,36 +23,54 @@
**/
@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.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 = #{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>")
+ @Select("<script> " + "SELECT " + "d.id, " + "d.title, " + "COUNT(u.id)readNum, " + "d.`status`, "
+ + "d.`content`, " + "d.`cover`, " + "d.`type`, " + "d.`cover_mode`, " + "d.is_topping, " + "d.publish_at, "
+ + "d.create_at, " + "cadt.`name` as typeName, " + "cadt.color as typeColor, " + "ca.name as communityName "
+ + "FROM " + "com_act_dyn d " + "LEFT JOIN com_act_dyn_user u ON d.id = u.dyn_id "
+ + "LEFT JOIN com_act_dyn_type as cadt ON cadt.id = d.type "
+ + "LEFT JOIN com_act ca ON d.community_id = ca.community_id " + "WHERE 1=1 "
+ + "<if test='comActDynVO.choice == 0 '>" + "and d.community_id=#{comActDynVO.communityId} " + " </if> "
+ + "<if test='comActDynVO.title != null and comActDynVO.title.trim() != ""'>"
+ + "AND d.title like concat(#{comActDynVO.title},'%') " + " </if> "
+ + "<if test='comActDynVO.isTopping != null '>" + "AND d.is_topping = #{comActDynVO.isTopping} " + " </if> "
+ + "<if test='comActDynVO.status != null '>" + "AND d.`status` = #{comActDynVO.status} " + " </if> "
+ + "<if test='comActDynVO.publishAtBegin != null '>" + "AND d.publish_at BETWEEN #{comActDynVO.publishAtBegin} "
+ + "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();
+
+ @Select("<script> " + "SELECT " + "d.id, " + "d.title, " + "COUNT(u.id)readNum, " + "d.`status`, "
+ + "d.`content`, " + "d.`cover`, " + "d.`type`, " + "d.`cover_mode`, " + "d.is_topping, " + "d.publish_at, "
+ + "d.create_at, " + "cadt.`name` as typeName, " + "ca.name as communityName " + "FROM " + "com_act_dyn d "
+ + "LEFT JOIN com_act_dyn_user u ON d.id = u.dyn_id "
+ + "LEFT JOIN com_act_dyn_type as cadt ON cadt.id = d.type "
+ + "LEFT JOIN com_act ca ON d.community_id = ca.community_id " + "WHERE "
+ + "d.community_id=#{comActDynVO.communityId} "
+ + "<if test='comActDynVO.title != null and comActDynVO.title.trim() != ""'>"
+ + "AND d.title like concat(#{comActDynVO.title},'%') " + " </if> "
+ + "<if test='comActDynVO.isTopping != null '>" + "AND d.is_topping = #{comActDynVO.isTopping} " + " </if> "
+ + "<if test='comActDynVO.status != null '>" + "AND d.`status` = #{comActDynVO.status} " + " </if> "
+ + "<if test='comActDynVO.type != null '>" + "AND d.type = #{comActDynVO.type} " + " </if> "
+ + "<if test='comActDynVO.publishAtBegin != null '>" + "AND d.publish_at BETWEEN #{comActDynVO.publishAtBegin} "
+ + "AND #{comActDynVO.publishAtEnd}" + " </if> " + " group by d.id "
+ + " order by d.is_topping desc, d.create_at desc " + "</script>")
+ IPage<ComActDynVO> pageDynamicByAdmin(Page page, @Param("comActDynVO") ComActDynVO comActDynVO);
+
+ @Select("SELECT " + " count( cad.id ) AS dynTotal, "
+ + " (select count(id) from com_act_dyn where community_id = #{communityId} and create_at LIKE CONCAT(#{nowDate},'%')) as currentNum "
+ + "FROM " + " com_act_dyn AS cad " + "WHERE " + " community_id = #{communityId}")
+ Map<String, Long> countByCommunityId(@Param("communityId") Long communityId, @Param("nowDate") String nowDate);
+
+ @Select("select create_at as startTime,(select create_at from com_act_dyn where community_id = #{communityId} order by create_at desc LIMIT 1 ) as endTime from com_act_dyn where community_id = #{communityId} order by create_at asc LIMIT 1")
+ DateScreenVO countByAvgCommunityId(@Param("communityId") Long communityId);
+
+ @Select("SELECT "
+ + "(SELECT COUNT(id) FROM com_act_dyn WHERE community_id = #{communityId} AND create_at < #{end}) AS dynTotal, "
+ + "(SELECT COUNT(id) FROM com_act_dyn WHERE community_id = #{communityId} AND #{start} < create_at AND create_at < #{end}) AS dynAdd "
+ + " FROM DUAL")
+ DynamicWorkVO countByTime(@Param("start") String start, @Param("end") String end,
+ @Param("communityId") Long communityId);
}
--
Gitblit v1.7.1