blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/article/controller/ArticleController.java
@@ -1,8 +1,6 @@ package org.springblade.jfpt.article.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; import org.springblade.core.mp.support.Condition; @@ -11,9 +9,11 @@ import org.springblade.core.tool.utils.Func; import org.springblade.jfpt.article.entity.Article; import org.springblade.jfpt.article.service.ArticleService; import org.springblade.jfpt.article.vo.ArticleVo; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.util.Date; /** * @author zhongrj @@ -36,7 +36,7 @@ * @return */ @GetMapping("/page") public R<IPage<Article>> page(HttpServletResponse response, Article article, Query query){ public R<IPage<Article>> page(HttpServletResponse response, ArticleVo article, Query query){ response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); response.setHeader("Access-Control-Allow-Credentials","true"); @@ -49,8 +49,6 @@ * @param response */ @GetMapping("/detail") @ApiOperationSupport(order = 1) @ApiOperation(value = "详情", notes = "传入articleoy") public R<Article> detail(Article article, HttpServletResponse response) { response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); @@ -64,8 +62,6 @@ * @param article 资讯对象 */ @PostMapping("/save") @ApiOperationSupport(order = 4) @ApiOperation(value = "新增", notes = "传入article") public R save(@Valid Article article) { return R.status(articleService.save(article)); } @@ -75,8 +71,6 @@ * @param article 资讯对象 */ @PostMapping("/update") @ApiOperationSupport(order = 5) @ApiOperation(value = "修改", notes = "传入article") public R update(@Valid @RequestBody Article article) { return R.status(articleService.updateById(article)); } @@ -86,9 +80,12 @@ * @param article 资讯对象信息 */ @PostMapping("/submit") @ApiOperationSupport(order = 6) @ApiOperation(value = "新增或修改", notes = "传入article") public R submit(@Valid @RequestBody Article article) { //创建时间 if (null == article.getId()) { article.setCreateTime(new Date()); } article.setUpdateTime(new Date()); return R.status(articleService.saveOrUpdate(article)); } @@ -98,8 +95,6 @@ * @param ids 资讯主键id,id集合 */ @PostMapping("/remove") @ApiOperationSupport(order = 8) @ApiOperation(value = "删除", notes = "传入ids") public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { return R.status(articleService.removeByIds(Func.toLongList(ids))); } blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/article/entity/Article.java
@@ -10,6 +10,7 @@ import javax.validation.constraints.NotNull; import java.io.Serializable; import java.time.LocalDateTime; import java.util.Date; /** * @author zhongrj @@ -19,6 +20,8 @@ @Data @TableName("sys_article") public class Article implements Serializable { private static final long serialVersionUID = 1L; /** * 主键id,自增 @@ -53,13 +56,14 @@ */ @TableField("create_time") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private LocalDateTime createTime; private Date createTime; /** * 更新时间 */ @TableField("update_time") private LocalDateTime updateTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private Date updateTime; /** * 发布来源id blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/article/mapper/ArticleMapper.java
@@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springblade.jfpt.article.entity.Article; import org.springblade.jfpt.article.vo.ArticleVo; import java.util.List; @@ -19,5 +20,5 @@ * @param article 资讯对象 * @return */ List<Article> selectArticlePage(IPage<Article> page, Article article); List<Article> selectArticlePage(IPage<Article> page, ArticleVo article); } blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/article/mapper/ArticleMapper.xml
@@ -5,5 +5,19 @@ <!--查询资讯分页列表信息--> <select id="selectArticlePage" resultType="org.springblade.jfpt.article.entity.Article"> select * from sys_article where 1=1 <if test="article.sourceName!=null and article.sourceName!=''"> and source_name like concat('%',#{article.sourceName},'%') </if> <if test="article.title!=null and article.title!=''"> and title like concat('%',#{article.title},'%') </if> <if test="article.startTime!=null and article.startTime!='' and article.startTime!='undefined'"> and create_time >=#{article.startTime} </if> <if test="article.endTime!=null and article.endTime!='' and article.endTime!='undefined'"> and create_time <=#{article.endTime} </if> order by create_time desc </select> </mapper> blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/article/service/ArticleService.java
@@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import org.springblade.jfpt.article.entity.Article; import org.springblade.jfpt.article.vo.ArticleVo; /** * @author zhongrj @@ -16,5 +17,5 @@ * @param article 资讯对象 * @return */ IPage<Article> selectArticlePage(IPage<Article> page,Article article); IPage<Article> selectArticlePage(IPage<Article> page, ArticleVo article); } blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/article/service/impl/ArticleServiceImpl.java
@@ -5,6 +5,7 @@ import org.springblade.jfpt.article.entity.Article; import org.springblade.jfpt.article.mapper.ArticleMapper; import org.springblade.jfpt.article.service.ArticleService; import org.springblade.jfpt.article.vo.ArticleVo; import org.springframework.stereotype.Service; /** @@ -21,7 +22,7 @@ * @return */ @Override public IPage<Article> selectArticlePage(IPage<Article> page, Article article) { public IPage<Article> selectArticlePage(IPage<Article> page, ArticleVo article) { return page.setRecords(baseMapper.selectArticlePage(page,article)); } } blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/article/vo/ArticleVo.java
New file @@ -0,0 +1,16 @@ package org.springblade.jfpt.article.vo; import lombok.Data; import org.springblade.jfpt.article.entity.Article; import java.io.Serializable; import java.util.Date; /** * @author zhongrj */ @Data public class ArticleVo extends Article implements Serializable { private String startTime; private String endTime; } blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/equipment/mapper/EquipmentMapper.xml
@@ -193,13 +193,13 @@ and dtype=#{equipment.dtype} </if> <if test="dxtype!=null and dxtype == 0"> and heartbeat < DATE_SUB(NOW(),INTERVAL 1 DAY) and dtype=0 and dtype=0 </if> <if test="dxtype!=null and dxtype == 1"> and heartbeat >= DATE_SUB(NOW(),INTERVAL 1 DAY) and dtype=1 and dtype=1 </if> <if test="dxtype!=null and dxtype == 2"> and heartbeat >= DATE_SUB(NOW(),INTERVAL 1 DAY) and dtype=2 and dtype=2 </if> <if test="dxtype!=null and dxtype == 3"> and dtype=3 @@ -454,12 +454,12 @@ <!--查询设备在线数量--> <select id="selectEqCz" resultType="Integer"> select COUNT(*) from sys_equipment where heartbeat >= DATE_SUB(NOW(),INTERVAL 1 DAY) and dtype=1 select COUNT(*) from sys_equipment where dtype=1 </select> <!--查询设备掉线数量--> <select id="selectEqCd" resultType="Integer"> select COUNT(*) from sys_equipment where heartbeat < DATE_SUB(NOW(),INTERVAL 1 DAY) and dtype=0 select COUNT(*) from sys_equipment where dtype=0 </select> <!--查询预警设备数量--> @@ -480,7 +480,7 @@ <!--查询预警设备数量--> <select id="selectEqCys" resultType="Integer"> select COUNT(*) from sys_equipment where heartbeat >= DATE_SUB(NOW(),INTERVAL 1 DAY) and dtype=2 select COUNT(*) from sys_equipment where dtype=2 </select> <!--查询设故障数量-->