5 files modified
1 files added
| | |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.article.entity.Article; |
| | | import org.springblade.modules.article.service.ArticleService; |
| | | import org.springblade.modules.article.vo.ArticleVo; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | * @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"); |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springblade.modules.article.entity.Article; |
| | | import org.springblade.modules.article.vo.ArticleVo; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @param article 资讯对象 |
| | | * @return |
| | | */ |
| | | List<Article> selectArticlePage(IPage<Article> page, Article article); |
| | | List<Article> selectArticlePage(IPage<Article> page, @Param("article") ArticleVo article); |
| | | } |
| | |
| | | <!--查询资讯分页列表信息--> |
| | | <select id="selectArticlePage" resultType="org.springblade.modules.article.entity.Article"> |
| | | select * from sys_article |
| | | where 1=1 |
| | | <if test="article.title!=null and article.title!=''"> |
| | | and title like concat('%',#{article.title},'%') |
| | | </if> |
| | | <if test="article.sourceName!=null and article.sourceName!=''"> |
| | | and source_name like concat('%',#{article.sourceName},'%') |
| | | </if> |
| | | <if test="article.startTime!=null and article.startTime!=''"> |
| | | and create_time>=#{article.startTime} |
| | | </if> |
| | | <if test="article.endTime!=null and article.endTime!=''"> |
| | | and create_time<=#{article.endTime} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springblade.modules.article.entity.Article; |
| | | import org.springblade.modules.article.vo.ArticleVo; |
| | | |
| | | /** |
| | | * @author zhongrj |
| | |
| | | * @param article 资讯对象 |
| | | * @return |
| | | */ |
| | | IPage<Article> selectArticlePage(IPage<Article> page,Article article); |
| | | IPage<Article> selectArticlePage(IPage<Article> page, ArticleVo article); |
| | | } |
| | |
| | | import org.springblade.modules.article.entity.Article; |
| | | import org.springblade.modules.article.mapper.ArticleMapper; |
| | | import org.springblade.modules.article.service.ArticleService; |
| | | import org.springblade.modules.article.vo.ArticleVo; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | |
| | | * @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)); |
| | | } |
| | | } |
| New file |
| | |
| | | package org.springblade.modules.article.vo; |
| | | |
| | | import lombok.Data; |
| | | import org.springblade.modules.article.entity.Article; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | public class ArticleVo extends Article implements Serializable { |
| | | |
| | | /** |
| | | * 开始时间 |
| | | */ |
| | | private String startTime; |
| | | |
| | | /** |
| | | * 结束时间 |
| | | */ |
| | | private String endTime; |
| | | } |