Commit dd6491f9 by rongkailun

【新增】政策法规管理

parent 1e8c9bec
package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Map;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.modules.manage.entity.PolicyEntity;
import io.office.modules.manage.service.PolicyService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* ${comments}
*
* @author chenshun
* @email sunlightcs@gmail.com
* @date 2021-11-04 22:13:54
*/
@RestController
@RequestMapping("generator/policy")
public class PolicyController {
@Autowired
private PolicyService policyService;
/**
* 列表
*/
@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);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
@RequiresPermissions("generator:policy:info")
public R info(@PathVariable("id") Integer id){
PolicyEntity policy = policyService.getById(id);
return R.ok().put("policy", policy);
}
/**
* 保存
*/
@RequestMapping("/save")
@RequiresPermissions("generator:policy:save")
public R save(@RequestBody PolicyEntity policy){
policyService.save(policy);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
@RequiresPermissions("generator:policy:update")
public R update(@RequestBody PolicyEntity policy){
policyService.updateById(policy);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
@RequiresPermissions("generator:policy:delete")
public R delete(@RequestBody Integer[] ids){
policyService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}
package io.office.modules.manage.dao;
import io.office.modules.manage.entity.PolicyEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* ${comments}
*
* @author chenshun
* @email sunlightcs@gmail.com
* @date 2021-11-04 22:13:54
*/
@Mapper
public interface PolicyDao extends BaseMapper<PolicyEntity> {
}
package io.office.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* ${comments}
*
* @author chenshun
* @email sunlightcs@gmail.com
* @date 2021-11-04 22:13:54
*/
@Data
@TableName("Policy")
public class PolicyEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* $column.comments
*/
@TableId
private Integer id;
/**
* $column.comments
*/
@TableField("class")
private String class1;
/**
* $column.comments
*/
private String title;
/**
* $column.comments
*/
private String titleOld;
/**
* $column.comments
*/
private String keyword;
/**
* $column.comments
*/
private String brief;
/**
* $column.comments
*/
private Date releasedate;
/**
* $column.comments
*/
private Date updatedate;
/**
* $column.comments
*/
private String author;
/**
* $column.comments
*/
private String source;
/**
* $column.comments
*/
private Integer levels;
/**
* $column.comments
*/
private String directpath;
/**
* $column.comments
*/
private String content;
/**
* $column.comments
*/
private Integer hits;
/**
* $column.comments
*/
private String editor;
/**
* $column.comments
*/
private String lasteditor;
/**
* $column.comments
*/
private String publicdate;
/**
* $column.comments
*/
private String startdate;
/**
* $column.comments
*/
private String status;
/**
* $column.comments
*/
private String auditor;
}
package io.office.modules.manage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils;
import io.office.modules.manage.entity.PolicyEntity;
import java.util.Map;
/**
* ${comments}
*
* @author chenshun
* @email sunlightcs@gmail.com
* @date 2021-11-04 22:13:54
*/
public interface PolicyService extends IService<PolicyEntity> {
PageUtils queryPage(Map<String, Object> params);
}
package io.office.modules.manage.service.impl;
import io.office.common.utils.PageUtils;
import io.office.common.utils.Query;
import io.office.modules.manage.dao.PolicyDao;
import io.office.modules.manage.entity.PolicyEntity;
import io.office.modules.manage.service.PolicyService;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service("policyService")
public class PolicyServiceImpl extends ServiceImpl<PolicyDao, PolicyEntity> implements PolicyService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<PolicyEntity> page = this.page(
new Query<PolicyEntity>().getPage(params),
new QueryWrapper<PolicyEntity>()
);
return new PageUtils(page);
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.office.modules.manage.dao.PolicyDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="io.office.modules.manage.entity.PolicyEntity" id="policyMap">
<result property="id" column="id"/>
<result property="class" column="class"/>
<result property="title" column="title"/>
<result property="titleOld" column="title_old"/>
<result property="keyword" column="keyword"/>
<result property="brief" column="brief"/>
<result property="releasedate" column="releasedate"/>
<result property="updatedate" column="updatedate"/>
<result property="author" column="author"/>
<result property="source" column="source"/>
<result property="levels" column="levels"/>
<result property="directpath" column="directpath"/>
<result property="content" column="content"/>
<result property="hits" column="hits"/>
<result property="editor" column="editor"/>
<result property="lasteditor" column="lasteditor"/>
<result property="publicdate" column="publicdate"/>
<result property="startdate" column="startdate"/>
<result property="status" column="status"/>
<result property="auditor" column="auditor"/>
</resultMap>
</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