Commit 6076b462 by ZhangYunfei

Merge remote-tracking branch 'origin/master'

parents d1ffcdfc 4edf0d90
......@@ -5,12 +5,15 @@ import java.util.Date;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.annotation.SysLog;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.NewtopicEntity;
import io.office.modules.manage.vo.request.NewsMovieEntityVo;
import io.office.modules.manage.vo.request.NewtopicEntityVo;
import io.office.modules.sys.controller.AbstractController;
import io.office.modules.sys.entity.SysUserEntity;
import io.swagger.models.auth.In;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -47,9 +50,10 @@ public class NewsMovieController extends AbstractController {
@RequestMapping("/list")
// @RequiresPermissions("manage:newsmovie:list")
public R list(@RequestBody Map<String, Object> params){
PageUtils page = newsMovieService.queryPage(params);
return R.ok().put("page", page);
Page<NewsMovieEntity> page = this.newsMovieService.selectMoveList(params,
new Page(Integer.valueOf(params.get("page").toString()), Integer.valueOf(params.get("limit").toString())));
PageUtils pageUtils = new PageUtils(page);
return R.ok().put("page", pageUtils);
}
......
package io.office.modules.manage.dao;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.modules.manage.entity.NewsMovieEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* ${comments}
......@@ -13,5 +18,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface NewsMovieDao extends BaseMapper<NewsMovieEntity> {
List<NewsMovieEntity> selectMoveList(@Param("params") Map<String, Object> params, Page page);
}
package io.office.modules.manage.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils;
import io.office.modules.manage.entity.NewsMovieEntity;
......@@ -22,5 +23,6 @@ public interface NewsMovieService extends IService<NewsMovieEntity> {
void insert(NewsMovieEntityVo newsMovieEntityVo, SysUserEntity user);
Page<NewsMovieEntity> selectMoveList(Map<String, Object> params, Page page);
}
package io.office.modules.manage.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.modules.manage.vo.request.NewsMovieEntityVo;
import io.office.modules.sys.entity.SysUserEntity;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -22,11 +25,14 @@ import io.office.modules.manage.service.NewsMovieService;
@Service("newsMovieService")
public class NewsMovieServiceImpl extends ServiceImpl<NewsMovieDao, NewsMovieEntity> implements NewsMovieService {
@Autowired
NewsMovieDao newsMovieDao;
@Override
public PageUtils queryPage(Map<String, Object> params) {
QueryWrapper<NewsMovieEntity> newsMovieEntityQueryWrapper = new QueryWrapper<>();
newsMovieEntityQueryWrapper.select("id,title,keyword,author,releasedate,long as longStr,clanguage,lasteditor,showtime,auditor,status");
newsMovieEntityQueryWrapper.select("");
if(params.containsKey("levels")) {
newsMovieEntityQueryWrapper.eq("levels",params.get("levels"));
} else{
......@@ -59,5 +65,12 @@ public class NewsMovieServiceImpl extends ServiceImpl<NewsMovieDao, NewsMovieEnt
baseMapper.insert(newsMovieEntity);
}
@Override
public Page<NewsMovieEntity> selectMoveList(Map<String, Object> params, Page page) {
List<NewsMovieEntity> list = this.newsMovieDao.selectMoveList(params,page);
page.setRecords(list);
return page;
}
}
\ No newline at end of file
......@@ -32,5 +32,43 @@
<result property="lasteditor" column="lasteditor"/>
</resultMap>
<select id="selectMoveList" resultMap="newsMovieMap">
SELECT
id,
title,
keyword,
author,
releasedate,
long AS longStr,
clanguage,
lasteditor,
showtime,
auditor,
status,
editor
from news_movie
where 1=1
<if test="params.title !=null and params.title !=''">
and title like concat('%',#{params.title},'%')
</if>
<if test="params.author !=null and params.author !=''">
and author like concat('%',#{params.author},'%')
</if>
<if test="params.editor !=null and params.editor !=''">
and editor like concat('%',#{params.editor},'%')
</if>
<if test="params.keyword !=null and params.keyword !=''">
and keyword like concat('%',#{params.keyword},'%')
</if>
<if test="params.status !=null and params.status !=''">
and status = #{params.status}
</if>
<if test="params.clanguage !=null and params.clanguage !=''">
and clanguage =#{params.clanguage}
</if>
<if test="params.levels !=null and params.levels !=''">
and levels = #{params.levels}
</if>
ORDER BY releasedate desc
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment