Commit 093c66b2 by rongkailun

【新增】服务管理---文档管理功能新增

parent ee4aa874
package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.modules.app.annotation.Login;
import io.office.modules.manage.entity.DocEntity;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.manage.vo.request.TopicNewsPartyRequestVo;
import io.office.modules.sys.controller.AbstractController;
import io.office.modules.sys.entity.SysUserEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -26,7 +32,7 @@ import io.office.common.utils.R;
@Slf4j
@RestController
@RequestMapping("/doc")
public class DocController {
public class DocController extends AbstractController {
@Autowired
private DocService docService;
......@@ -35,10 +41,11 @@ public class DocController {
*/
@RequestMapping("/list")
// @RequiresPermissions("manage:doc:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = docService.queryPage(params);
return R.ok().put("page", page);
public R list(@RequestBody NewsParams newsParams){
Page<DocEntity> page = this.docService.selectDocList(newsParams,
new Page(newsParams.getPage(), newsParams.getLimit()));
PageUtils pageUtils = new PageUtils(page);
return R.ok().put("page", pageUtils);
}
......@@ -60,7 +67,6 @@ public class DocController {
// @RequiresPermissions("manage:doc:save")
public R save(@RequestBody DocEntity doc){
docService.save(doc);
return R.ok();
}
......@@ -71,7 +77,6 @@ public class DocController {
// @RequiresPermissions("manage:doc:update")
public R update(@RequestBody DocEntity doc){
docService.updateById(doc);
return R.ok();
}
......@@ -80,12 +85,22 @@ public class DocController {
*/
@RequestMapping("/delete")
// @RequiresPermissions("manage:doc:delete")
public R delete(@RequestBody Integer[] ids){
docService.removeByIds(Arrays.asList(ids));
public R delete(@RequestBody List<Long> ids){
this.docService.deleteDoc(ids);
return R.ok();
}
/**
* 审核
*/
@RequestMapping("/verify")
// @RequiresPermissions("manage:doc:verify")
public R verify(@RequestBody DocEntity doc){
this.docService.verifyDoc(doc,getUser());
return R.ok();
}
@Login
@PostMapping("/api/downLoad")
// @RequiresPermissions("generator:indexcarouselmanage:pictureImageList")
......
package io.office.modules.manage.dao;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.modules.manage.entity.DocEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.office.modules.manage.entity.dto.NewsParams;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* ${comments}
......@@ -14,4 +19,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface DocDao extends BaseMapper<DocEntity> {
List<DocEntity> selectDocList(@Param("newsParams") NewsParams newsParams, 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.DocEntity;
import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.sys.entity.SysUserEntity;
import java.util.List;
import java.util.Map;
/**
......@@ -16,5 +20,11 @@ import java.util.Map;
public interface DocService extends IService<DocEntity> {
PageUtils queryPage(Map<String, Object> params);
Page<DocEntity> selectDocList(NewsParams newsParams, Page page);
void deleteDoc(List<Long> ids);
void verifyDoc(DocEntity doc, SysUserEntity user);
}
package io.office.modules.manage.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.modules.manage.entity.PartnersEntity;
import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.sys.entity.SysUserEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -16,6 +22,9 @@ import io.office.modules.manage.service.DocService;
@Service("docService")
public class DocServiceImpl extends ServiceImpl<DocDao, DocEntity> implements DocService {
@Autowired
private DocDao docDao;
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<DocEntity> page = this.page(
......@@ -26,4 +35,28 @@ public class DocServiceImpl extends ServiceImpl<DocDao, DocEntity> implements Do
return new PageUtils(page);
}
@Override
public Page<DocEntity> selectDocList(NewsParams newsParams, Page page) {
List<DocEntity> list = this.docDao.selectDocList(newsParams,page);
page.setRecords(list);
return page;
}
@Override
public void deleteDoc(List<Long> ids) {
QueryWrapper<DocEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in("id",ids);
DocEntity docEntity = new DocEntity();
docEntity.setLevels(0);
this.baseMapper.update(docEntity,queryWrapper);
}
@Override
public void verifyDoc(DocEntity doc,SysUserEntity user) {
QueryWrapper<DocEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in("id",doc.getId());
doc.setAuditor(user.getUsername());
this.baseMapper.update(doc,queryWrapper);
}
}
\ 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.DocDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="io.office.modules.manage.entity.DocEntity" id="docMap">
<result property="id" column="id"/>
<result property="title" column="title"/>
<result property="author" column="author"/>
<result property="levels" column="levels"/>
<result property="category" column="category"/>
<result property="docfile" column="docfile"/>
<result property="stand" column="stand"/>
<result property="status" column="status"/>
<result property="auditor" column="auditor"/>
</resultMap>
<select id="selectDocList" resultMap="docMap">
SELECT
*, (
CASE
WHEN category = 1 THEN
'表格下载'
ELSE
'分支机构培训计划'
END
) categoryname
FROM
doc
where 1=1
<if test="newsParams.type !=null and newsParams.type !=''">
and category =#{newsParams.type}
</if>
<if test="newsParams.title !=null and newsParams.title !=''">
and title like concat('%',#{newsParams.title},'%')
</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