Commit 34c05225 by rongkailun

【新增】政策法规列表查询

parent 4201b6ce
......@@ -3,10 +3,13 @@ package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Map;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.PictureEntity;
import io.office.modules.manage.entity.PolicyEntity;
import io.office.modules.manage.entity.dto.PolicyParams;
import io.office.modules.manage.service.PolicyService;
import io.office.modules.sys.controller.AbstractController;
import lombok.extern.slf4j.Slf4j;
......@@ -34,10 +37,11 @@ public class PolicyController extends AbstractController {
*/
@RequestMapping("/list")
// @RequiresPermissions("generator:policy:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = policyService.queryPage(params);
return R.ok().put("page", page);
public R list(@RequestBody PolicyParams params){
Page<PictureEntity> page = this.policyService.selectPolicyList(params,
new Page(params.getPage(),params.getLimit()));
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.NewsEntity;
import io.office.modules.manage.entity.PolicyEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.office.modules.manage.entity.dto.PolicyParams;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* ${comments}
......@@ -13,5 +19,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface PolicyDao extends BaseMapper<PolicyEntity> {
List<NewsEntity> selectPolicyList(@Param("newsParams") PolicyParams params, Page page);
}
package io.office.modules.manage.entity.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.office.modules.manage.entity.page.PageParams;
import lombok.Data;
import java.util.Date;
/**
* @author JavaClimber
* @version 1.0
* @date 2021/11/13 21:21
*/
@Data
public class PolicyParams extends PageParams {
private String title;
private String editor;
private String keyword;
private String status;
private String class1;
private String level;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTimeStart;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTimeEnd;
}
\ No newline at end of file
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.common.utils.R;
import io.office.modules.manage.entity.PictureEntity;
import io.office.modules.manage.entity.PolicyEntity;
import io.office.modules.manage.entity.dto.PolicyParams;
import io.office.modules.sys.entity.SysUserEntity;
import java.util.Map;
......@@ -26,5 +29,7 @@ public interface PolicyService extends IService<PolicyEntity> {
R deletePolicy(Integer[] ids, SysUserEntity user);
R verifyTopic(PolicyEntity policyEntity, SysUserEntity user);
Page<PictureEntity> selectPolicyList(PolicyParams params, Page page);
}
package io.office.modules.manage.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.utils.DateUtils;
import io.office.common.utils.PageUtils;
import io.office.common.utils.Query;
import io.office.common.utils.R;
import io.office.modules.manage.dao.PolicyDao;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.PictureEntity;
import io.office.modules.manage.entity.PolicyEntity;
import io.office.modules.manage.entity.dto.PolicyParams;
import io.office.modules.manage.service.PolicyService;
import io.office.modules.sys.entity.SysUserEntity;
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;
......@@ -21,6 +26,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service("policyService")
public class PolicyServiceImpl extends ServiceImpl<PolicyDao, PolicyEntity> implements PolicyService {
@Autowired
private PolicyDao policyDao;
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<PolicyEntity> page = this.page(
......@@ -90,4 +97,11 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyDao, PolicyEntity> impl
return R.ok("审核成功!");
}
@Override
public Page<PictureEntity> selectPolicyList(PolicyParams params, Page page) {
List<NewsEntity> newsList = this.policyDao.selectPolicyList(params, page);
page.setRecords(newsList);
return page;
}
}
\ No newline at end of file
......@@ -6,7 +6,7 @@
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="io.office.modules.manage.entity.PolicyEntity" id="policyMap">
<result property="id" column="id"/>
<result property="class" column="class"/>
<result property="class1" column="class"/>
<result property="title" column="title"/>
<result property="titleOld" column="title_old"/>
<result property="keyword" column="keyword"/>
......@@ -26,6 +26,27 @@
<result property="status" column="status"/>
<result property="auditor" column="auditor"/>
</resultMap>
<select id="selectPolicyList" resultMap="policyMap" parameterType="io.office.modules.manage.entity.dto.PolicyParams">
select class,title,editor,lasteditor,releasedate,updatedate,auditor,status from Policy
where 1=1
<if test="newsParams.updateTimeStart !=null and newsParams.updateTimeEnd !=null">
and updatedate BETWEEN #{newsParams.updateTimeStart} AND #{newsParams.updateTimeEnd}
</if>
<if test="newsParams.keyword !=null and newsParams.keyword !=''">
and keyword like concat('%',#{newsParams.keyword},'%')
</if>
<if test="newsParams.title !=null and newsParams.title !=''">
and title like concat('%',#{newsParams.title},'%')
</if>
<if test="newsParams.status !=null">
and status =#{newsParams.status}
</if>
<if test="newsParams.editor !=null and newsParams.editor !=''">
and editor =#{newsParams.editor}
</if>
ORDER BY
id 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