add:政策资料中心模块
This commit is contained in:
+72
@@ -0,0 +1,72 @@
|
||||
package com.adc.da.slrs.sarLawsInformation.controller;
|
||||
|
||||
import com.adc.da.base.web.BaseController;
|
||||
import com.adc.da.http.PageInfo;
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.slrs.sarLawsInformation.entity.SarLawsInformation;
|
||||
import com.adc.da.slrs.sarLawsInformation.service.SarLawsInformationService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author tjzdw
|
||||
* @description
|
||||
* @date 2023/10/23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/${restPath}/lawss/sarLawsInformation")
|
||||
public class SarLawsInformationController extends BaseController<SarLawsInformation> {
|
||||
|
||||
@Resource
|
||||
private SarLawsInformationService informationService;
|
||||
|
||||
@ApiOperation(value = "根据政策资料ID查询资料信息")
|
||||
@GetMapping("/getLawsInformationInfo")
|
||||
public ResponseMessage<SarLawsInformation> getLawsInformationInfo(String id){
|
||||
if (StringUtils.isBlank(id)) {
|
||||
return Result.error("会议ID为空!");
|
||||
}
|
||||
SarLawsInformation sarLawsInformation = informationService.getLawsInformationInfo(id);
|
||||
return Result.success(sarLawsInformation);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页查询")
|
||||
@GetMapping("/page")
|
||||
public ResponseMessage<PageInfo<SarLawsInformation>> page(SarLawsInformation sarLawsInformation) {
|
||||
List<SarLawsInformation> rows = informationService.queryByPage(sarLawsInformation);
|
||||
return Result.success(getPageInfo(sarLawsInformation.getPager(), rows));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增政策资料")
|
||||
@PostMapping(value = "/addLawsInformation", consumes = "application/json;charset=UTF-8")
|
||||
public ResponseMessage<?> create(@RequestBody SarLawsInformation sarLawsInformation) throws Exception {
|
||||
informationService.addLawsInformation(sarLawsInformation);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@ApiOperation("根据资料ID删除资料信息")
|
||||
@DeleteMapping("/deleteLawsInformation")
|
||||
public ResponseMessage<?> deleteInformation(String id) {
|
||||
if (StringUtils.isBlank(id)) {
|
||||
return Result.error("删除失败,政策资料ID为空");
|
||||
}
|
||||
informationService.deleteInformation(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@ApiOperation("根据资料ID修改政策资料信息")
|
||||
@PutMapping("/updateLawsInformationInfo")
|
||||
public ResponseMessage<?> updateLawsInformationInfo(@RequestBody SarLawsInformation lawsInformation) {
|
||||
if (ObjectUtils.isEmpty(lawsInformation)) {
|
||||
return Result.error("更新失败,政策资料信息不存在");
|
||||
}
|
||||
Boolean updateResult = informationService.updateLawsInformationInfo(lawsInformation);
|
||||
return updateResult ? Result.success() : Result.error("更新失败");
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.adc.da.slrs.sarLawsInformation.dao;
|
||||
|
||||
import com.adc.da.slrs.sarLawsInformation.entity.SarLawsInformation;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author tjzdw
|
||||
* @description 针对表【sar_laws_information】的数据库操作Mapper
|
||||
* @createDate 2023-10-23 09:41:56
|
||||
* @Entity com.adc.da.slrs.sarLawsInformation.entity.SarLawsInformation
|
||||
*/
|
||||
@Mapper
|
||||
public interface SarLawsInformationDao extends BaseMapper<SarLawsInformation> {
|
||||
|
||||
Integer queryByPageCount(SarLawsInformation page);
|
||||
|
||||
List<SarLawsInformation> queryByPage(SarLawsInformation page);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
+160
@@ -0,0 +1,160 @@
|
||||
package com.adc.da.slrs.sarLawsInformation.entity;
|
||||
|
||||
import com.adc.da.base.page.BasePage;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
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 com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
*
|
||||
* @TableName sar_laws_information
|
||||
*/
|
||||
@TableName(value ="sar_laws_information")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
public class SarLawsInformation extends BasePage implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "ID", type = IdType.ID_WORKER_STR)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 一级资料类别
|
||||
*/
|
||||
@TableField(value = "FIRST_TYPE")
|
||||
private String firstType;
|
||||
|
||||
/**
|
||||
* 二级资料类别
|
||||
*/
|
||||
@TableField(value = "SECOND_TYPE")
|
||||
private String secondType;
|
||||
|
||||
/**
|
||||
* 三级资料类别
|
||||
*/
|
||||
@TableField(value = "THIRD_TYPE")
|
||||
private String thirdType;
|
||||
|
||||
/**
|
||||
* 四级资料类别
|
||||
*/
|
||||
@TableField(value = "FOURTH_TYPE")
|
||||
private String fourthType;
|
||||
|
||||
/**
|
||||
* 资料名称
|
||||
*/
|
||||
@TableField(value = "NAME")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 资料归属部门
|
||||
*/
|
||||
@TableField(value = "DEPARTMENT")
|
||||
private String department;
|
||||
|
||||
/**
|
||||
* 作者
|
||||
*/
|
||||
@TableField(value = "AUTHOR")
|
||||
private String author;
|
||||
|
||||
/**
|
||||
* 上传时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@TableField(value = "UPLOAD_TIME")
|
||||
private Date uploadTime;
|
||||
|
||||
/**
|
||||
* 资料说明
|
||||
*/
|
||||
@TableField(value = "DESCRIPTION")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 资料文件
|
||||
*/
|
||||
@TableField(value = "INFORMATION_FILE")
|
||||
private String informationFile;
|
||||
|
||||
/**
|
||||
* 资料文件名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String informationFileName;
|
||||
|
||||
/**
|
||||
* 可查看者,若设置为空则仅有上传人和审批人可以查看,若设置人员后,仅有可查看者可查看文件信息。
|
||||
*/
|
||||
@TableField(value = "VIEWABLE_BY")
|
||||
private String viewableBy;
|
||||
|
||||
/**
|
||||
* 可下载者,若设置为空则所有用户均可下载,若设置人员后,仅有可下载者可以下载文件信息。
|
||||
*/
|
||||
@TableField(value = "DOWNLOADABLE_BY")
|
||||
private String downloadableBy;
|
||||
|
||||
/**
|
||||
* 树节点ID
|
||||
*/
|
||||
private String treeNodeId;
|
||||
|
||||
/**
|
||||
* 树节点名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String treeNodeName;
|
||||
|
||||
/**
|
||||
* 逻辑删除,0可用,1不可用
|
||||
*/
|
||||
@TableField(value = "VALID_FLAG")
|
||||
private Integer validFlag;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@TableField(value = "CREATE_TIME")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@TableField(value = "MODIFY_TIME")
|
||||
private Date modifyTime;
|
||||
|
||||
|
||||
/**
|
||||
* 排序字段
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String sortField = "ID";
|
||||
|
||||
/**
|
||||
* 排序方式
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String sortMode = "asc";
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.adc.da.slrs.sarLawsInformation.service;
|
||||
|
||||
import com.adc.da.slrs.sarLawsInformation.entity.SarLawsInformation;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author tjzdw
|
||||
* @description 针对表【sar_laws_information】的数据库操作Service
|
||||
* @createDate 2023-10-23 09:41:56
|
||||
*/
|
||||
public interface SarLawsInformationService extends IService<SarLawsInformation> {
|
||||
|
||||
SarLawsInformation getLawsInformationInfo(String id);
|
||||
|
||||
List<SarLawsInformation> queryByPage(SarLawsInformation sarLawsInformation);
|
||||
|
||||
Integer addLawsInformation(SarLawsInformation sarLawsInformation);
|
||||
|
||||
Boolean deleteInformation(String id);
|
||||
|
||||
Boolean updateLawsInformationInfo(SarLawsInformation lawsInformation);
|
||||
}
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
package com.adc.da.slrs.sarLawsInformation.service.impl;
|
||||
|
||||
import com.adc.da.slrs.sarLawsInformationCenterTree.entity.SarLawsInformationCenterTree;
|
||||
import com.adc.da.slrs.sarLawsInformationCenterTree.service.SarLawsInformationCenterTreeService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.adc.da.slrs.sarLawsInformation.entity.SarLawsInformation;
|
||||
import com.adc.da.slrs.sarLawsInformation.service.SarLawsInformationService;
|
||||
import com.adc.da.slrs.sarLawsInformation.dao.SarLawsInformationDao;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author tjzdw
|
||||
* @description 针对表【sar_laws_information】的数据库操作Service实现
|
||||
* @createDate 2023-10-23 09:41:56
|
||||
*/
|
||||
@Service
|
||||
public class SarLawsInformationServiceImpl extends ServiceImpl<SarLawsInformationDao, SarLawsInformation>
|
||||
implements SarLawsInformationService{
|
||||
|
||||
@Resource
|
||||
private SarLawsInformationCenterTreeService treeService;
|
||||
|
||||
@Override
|
||||
public SarLawsInformation getLawsInformationInfo(String id) {
|
||||
SarLawsInformation sarLawsInformation = this.baseMapper.selectById(id);
|
||||
if (StringUtils.isNotBlank(sarLawsInformation.getTreeNodeId())) {
|
||||
SarLawsInformationCenterTree treeNode = treeService.getById(sarLawsInformation.getTreeNodeId());
|
||||
sarLawsInformation.setTreeNodeName(treeNode.getName());
|
||||
}
|
||||
return sarLawsInformation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SarLawsInformation> queryByPage(SarLawsInformation page) {
|
||||
// 设置排序字段
|
||||
if (StringUtils.isNotBlank(page.getSortField())) {
|
||||
String sortField = StringUtils.join(StringUtils.splitByCharacterTypeCamelCase(page.getSortField()),"_").toUpperCase();
|
||||
page.setSortField(sortField);
|
||||
} else {
|
||||
page.setSortField("ID");
|
||||
page.setSortMode("asc");
|
||||
}
|
||||
Integer rowCount = this.baseMapper.queryByPageCount(page);
|
||||
page.getPager().setRowCount(rowCount);
|
||||
return this.baseMapper.queryByPage(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer addLawsInformation(SarLawsInformation sarLawsInformation) {
|
||||
sarLawsInformation.setCreateTime(new Date());
|
||||
sarLawsInformation.setModifyTime(new Date());
|
||||
sarLawsInformation.setValidFlag(0);
|
||||
// 若体系类别不存在,则默认属于根节点
|
||||
if (StringUtils.isBlank(sarLawsInformation.getTreeNodeId())) {
|
||||
LambdaQueryWrapper<SarLawsInformationCenterTree> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.isNull(SarLawsInformationCenterTree::getPId);
|
||||
SarLawsInformationCenterTree one = treeService.getOne(wrapper);
|
||||
sarLawsInformation.setTreeNodeId(one.getId());
|
||||
}
|
||||
return this.baseMapper.insert(sarLawsInformation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteInformation(String id) {
|
||||
LambdaUpdateWrapper<SarLawsInformation> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.eq(SarLawsInformation::getId, id);
|
||||
wrapper.set(SarLawsInformation::getValidFlag,1);
|
||||
wrapper.set(SarLawsInformation::getModifyTime,new Date());
|
||||
return update(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateLawsInformationInfo(SarLawsInformation lawsInformation) {
|
||||
if (StringUtils.isBlank(lawsInformation.getId())) {
|
||||
return false;
|
||||
}
|
||||
lawsInformation.setModifyTime(new Date());
|
||||
int update = this.baseMapper.updateById(lawsInformation);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package com.adc.da.slrs.sarLawsInformationCenterTree.controller;
|
||||
|
||||
import com.adc.da.base.web.BaseController;
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.slrs.sarLawsInformationCenterTree.entity.SarLawsInformationCenterTree;
|
||||
import com.adc.da.slrs.sarLawsInformationCenterTree.entity.SarLawsInformationCenterTreeData;
|
||||
import com.adc.da.slrs.sarLawsInformationCenterTree.service.SarLawsInformationCenterTreeService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author tjzdw
|
||||
* @description
|
||||
* @date 2023/10/23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/${restPath}/lawss/sarLawsInformation/tree")
|
||||
public class SarLawsInformationCenterTreeController extends BaseController<SarLawsInformationCenterTree> {
|
||||
|
||||
@Resource
|
||||
private SarLawsInformationCenterTreeService informationCenterTreeService;
|
||||
|
||||
@ApiOperation("新增资料中心左侧树节点")
|
||||
@PostMapping("/addTreeNode")
|
||||
public ResponseMessage<?> addTreeNode(@RequestBody SarLawsInformationCenterTree informationCenterTree){
|
||||
informationCenterTreeService.addTreeNode(informationCenterTree);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@ApiOperation("删除树节点")
|
||||
@DeleteMapping("/deleteTreeNode")
|
||||
public ResponseMessage<String> deleteTreeNode(String id){
|
||||
Boolean aBoolean = informationCenterTreeService.deleteTreeNode(id);
|
||||
return aBoolean ? Result.success("删除成功") : Result.error("节点下存在数据无法删除。");
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("查询树结构")
|
||||
@GetMapping("/getTree")
|
||||
public ResponseMessage<List<SarLawsInformationCenterTreeData>> getTree(){
|
||||
List<SarLawsInformationCenterTreeData> informationCenterTreeList = informationCenterTreeService.getTree();
|
||||
return Result.success(informationCenterTreeList);
|
||||
}
|
||||
|
||||
@ApiOperation("修改树节点")
|
||||
@PutMapping("/updateTreeNode")
|
||||
public ResponseMessage<?> updateTreeNode(@RequestBody SarLawsInformationCenterTree informationCenterTree){
|
||||
boolean b = informationCenterTreeService.updateTreeNode(informationCenterTree);
|
||||
return Result.success("修改成功");
|
||||
}
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.adc.da.slrs.sarLawsInformationCenterTree.dao;
|
||||
|
||||
import com.adc.da.slrs.sarLawsInformationCenterTree.entity.SarLawsInformationCenterTree;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author tjzdw
|
||||
* @description 针对表【sar_laws_information_center_tree】的数据库操作Mapper
|
||||
* @createDate 2023-10-23 11:20:26
|
||||
* @Entity com.adc.da.slrs.sarLawsInformationCenterTree.entity.SarLawsInformationCenterTree
|
||||
*/
|
||||
public interface SarLawsInformationCenterTreeDao extends BaseMapper<SarLawsInformationCenterTree> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package com.adc.da.slrs.sarLawsInformationCenterTree.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @TableName sar_laws_information_center_tree
|
||||
*/
|
||||
@TableName(value ="sar_laws_information_center_tree")
|
||||
@Data
|
||||
public class SarLawsInformationCenterTree implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.ID_WORKER_STR)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 父ID
|
||||
*/
|
||||
@JsonProperty("pId")
|
||||
@TableField(value = "p_id")
|
||||
private String pId;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
@TableField(value = "name")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 排序字段
|
||||
*/
|
||||
@TableField(value = "sort")
|
||||
private Integer sort;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.adc.da.slrs.sarLawsInformationCenterTree.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @TableName sar_laws_information_center_tree
|
||||
*/
|
||||
@Data
|
||||
public class SarLawsInformationCenterTreeData implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 父ID
|
||||
*/
|
||||
private String pId;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 排序字段
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 子节点
|
||||
*/
|
||||
private List<SarLawsInformationCenterTreeData> children;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.adc.da.slrs.sarLawsInformationCenterTree.service;
|
||||
|
||||
import com.adc.da.slrs.sarLawsInformationCenterTree.entity.SarLawsInformationCenterTree;
|
||||
import com.adc.da.slrs.sarLawsInformationCenterTree.entity.SarLawsInformationCenterTreeData;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author tjzdw
|
||||
* @description 针对表【sar_laws_information_center_tree】的数据库操作Service
|
||||
* @createDate 2023-10-23 11:20:26
|
||||
*/
|
||||
public interface SarLawsInformationCenterTreeService extends IService<SarLawsInformationCenterTree> {
|
||||
|
||||
void setResource(SarLawsInformationCenterTree informationCenterTree);
|
||||
|
||||
void addTreeNode(SarLawsInformationCenterTree informationCenterTree);
|
||||
|
||||
Boolean deleteTreeNode(String id);
|
||||
|
||||
List<SarLawsInformationCenterTreeData> getTree();
|
||||
|
||||
boolean updateTreeNode(SarLawsInformationCenterTree informationCenterTree);
|
||||
}
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
package com.adc.da.slrs.sarLawsInformationCenterTree.service.impl;
|
||||
|
||||
import com.adc.da.slrs.sarLawsInformation.entity.SarLawsInformation;
|
||||
import com.adc.da.slrs.sarLawsInformation.service.SarLawsInformationService;
|
||||
import com.adc.da.slrs.sarLawsInformationCenterTree.dao.SarLawsInformationCenterTreeDao;
|
||||
import com.adc.da.slrs.sarLawsInformationCenterTree.entity.SarLawsInformationCenterTreeData;
|
||||
import com.adc.da.slrs.sarRole.dao.TsRoleDao;
|
||||
import com.adc.da.slrs.sarUser.service.ITsUserService;
|
||||
import com.adc.da.slrs.tsRoleMeunData.dao.TsRoleMenuDataDao;
|
||||
import com.adc.da.util.LoginUserUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.adc.da.slrs.sarLawsInformationCenterTree.entity.SarLawsInformationCenterTree;
|
||||
import com.adc.da.slrs.sarLawsInformationCenterTree.service.SarLawsInformationCenterTreeService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author tjzdw
|
||||
* @description 针对表【sar_laws_information_center_tree】的数据库操作Service实现
|
||||
* @createDate 2023-10-23 11:20:26
|
||||
*/
|
||||
@Service
|
||||
public class SarLawsInformationCenterTreeServiceImpl extends ServiceImpl<SarLawsInformationCenterTreeDao, SarLawsInformationCenterTree>
|
||||
implements SarLawsInformationCenterTreeService{
|
||||
|
||||
@Resource
|
||||
private TsRoleDao tsRoleDao;
|
||||
@Resource
|
||||
private TsRoleMenuDataDao tsRoleMenuDataDao;
|
||||
@Resource
|
||||
private ITsUserService tsUserService;
|
||||
@Resource
|
||||
private SarLawsInformationService sarLawsInformationService;
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void addTreeNode(SarLawsInformationCenterTree informationCenterTree) {
|
||||
int save = this.baseMapper.insert(informationCenterTree);
|
||||
//新增后给所有角色配置权限
|
||||
setResource(informationCenterTree);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteTreeNode(String id) {
|
||||
List<String> idList = Arrays.asList(id.split(","));
|
||||
LambdaQueryWrapper<SarLawsInformation> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(SarLawsInformation::getTreeNodeId,idList);
|
||||
int count = sarLawsInformationService.count(wrapper);
|
||||
if (count > 0) {
|
||||
return false;
|
||||
}
|
||||
int deleted = this.baseMapper.deleteBatchIds(idList);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SarLawsInformationCenterTreeData> getTree() {
|
||||
// 获取当前登录人
|
||||
String loginUserId = LoginUserUtil.getUserId();
|
||||
// 查询当前登录人的权限菜单
|
||||
List<String> resourceIdList = tsUserService.getResourceUserId(loginUserId);
|
||||
|
||||
List<SarLawsInformationCenterTreeData> resList = new ArrayList<>();
|
||||
LambdaQueryWrapper<SarLawsInformationCenterTree> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(SarLawsInformationCenterTree::getId, resourceIdList);
|
||||
wrapper.orderByAsc(SarLawsInformationCenterTree::getSort);
|
||||
List<SarLawsInformationCenterTree> list = this.list(wrapper);
|
||||
List<SarLawsInformationCenterTreeData> treeData = new ArrayList<>();
|
||||
//代码遍历生成树
|
||||
for (SarLawsInformationCenterTree informationCenterTree : list) {
|
||||
if (StringUtils.isNotBlank(informationCenterTree.getPId())) {
|
||||
SarLawsInformationCenterTreeData informationCenterTreeData = new SarLawsInformationCenterTreeData();
|
||||
BeanUtils.copyProperties(informationCenterTree, informationCenterTreeData);
|
||||
treeData.add(informationCenterTreeData);
|
||||
}else {
|
||||
SarLawsInformationCenterTreeData res = new SarLawsInformationCenterTreeData();
|
||||
BeanUtils.copyProperties(informationCenterTree, res);
|
||||
resList.add(res);
|
||||
}
|
||||
}
|
||||
List<SarLawsInformationCenterTreeData> treeData1 = new ArrayList<>();
|
||||
//递归生成树
|
||||
for (SarLawsInformationCenterTreeData data : resList) {
|
||||
digui(data,treeData);
|
||||
treeData1.add(data);
|
||||
}
|
||||
return treeData1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateTreeNode(SarLawsInformationCenterTree informationCenterTree) {
|
||||
int updated = this.baseMapper.updateById(informationCenterTree);
|
||||
return updated > 0;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void setResource(SarLawsInformationCenterTree informationCenterTree) {
|
||||
//获取pid
|
||||
String pId = informationCenterTree.getPId();
|
||||
List<String> roleIds = tsRoleDao.getResourceId(pId);
|
||||
for (String roleId : roleIds){
|
||||
tsRoleDao.addResource(roleId,informationCenterTree.getId());
|
||||
tsRoleMenuDataDao.save(roleId,informationCenterTree.getId());
|
||||
}
|
||||
}
|
||||
|
||||
private void digui(SarLawsInformationCenterTreeData res,List<SarLawsInformationCenterTreeData> treeData){
|
||||
for (SarLawsInformationCenterTreeData data : treeData) {
|
||||
if (null==res.getChildren()) {
|
||||
List<SarLawsInformationCenterTreeData> data1=new ArrayList<>();
|
||||
res.setChildren(data1);
|
||||
}
|
||||
if (res.getId().equals(data.getPId())){
|
||||
if (null!=res.getChildren()){
|
||||
res.getChildren().add(data);
|
||||
}else {
|
||||
List<SarLawsInformationCenterTreeData> data1 = new ArrayList<>();
|
||||
data1.add(data);
|
||||
res.setChildren(data1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (null!=res.getChildren()){
|
||||
for (SarLawsInformationCenterTreeData treeData1:res.getChildren()) {
|
||||
digui(treeData1,treeData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
-2
@@ -144,8 +144,6 @@ public class SarLawsTopicServiceImpl extends ServiceImpl<SarLawsTopicMapper, Sar
|
||||
if (update <= 0) {
|
||||
return true;
|
||||
}
|
||||
System.out.println(lawsTopic.getTopicContactInformationList());
|
||||
System.out.println(lawsTopic.getInsideContactInformationList());
|
||||
// 先删除关联信息
|
||||
LambdaQueryWrapper<SarLawsTopicMeeting> topicWrapper = new LambdaQueryWrapper<>();
|
||||
topicWrapper.eq(SarLawsTopicMeeting::getLawsTopicId,lawsTopic.getId());
|
||||
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
<?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="com.adc.da.slrs.sarLawsInformation.dao.SarLawsInformationDao">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.adc.da.slrs.sarLawsInformation.entity.SarLawsInformation">
|
||||
<id property="id" column="ID" jdbcType="VARCHAR"/>
|
||||
<result property="firstType" column="FIRST_TYPE" jdbcType="VARCHAR"/>
|
||||
<result property="secondType" column="SECOND_TYPE" jdbcType="VARCHAR"/>
|
||||
<result property="thirdType" column="THIRD_TYPE" jdbcType="VARCHAR"/>
|
||||
<result property="fourthType" column="FOURTH_TYPE" jdbcType="VARCHAR"/>
|
||||
<result property="name" column="NAME" jdbcType="VARCHAR"/>
|
||||
<result property="department" column="DEPARTMENT" jdbcType="VARCHAR"/>
|
||||
<result property="author" column="AUTHOR" jdbcType="VARCHAR"/>
|
||||
<result property="uploadTime" column="UPLOAD_TIME" jdbcType="TIMESTAMP"/>
|
||||
<result property="description" column="DESCRIPTION" jdbcType="VARCHAR"/>
|
||||
<result property="informationFile" column="INFORMATION_FILE" jdbcType="VARCHAR"/>
|
||||
<result property="viewableBy" column="VIEWABLE_BY" jdbcType="VARCHAR"/>
|
||||
<result property="downloadableBy" column="DOWNLOADABLE_BY" jdbcType="VARCHAR"/>
|
||||
<result property="treeNodeId" column="TREE_NODE_ID" jdbcType="VARCHAR"/>
|
||||
<result property="viewableBy" column="VALID_FLAG" jdbcType="TINYINT"/>
|
||||
<result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP"/>
|
||||
<result property="modifyTime" column="MODIFY_TIME" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
ID,FIRST_TYPE,SECOND_TYPE,
|
||||
THIRD_TYPE,FOURTH_TYPE,`NAME`,
|
||||
DEPARTMENT,AUTHOR,UPLOAD_TIME,
|
||||
`DESCRIPTION`,INFORMATION_FILE,VIEWABLE_BY,
|
||||
DOWNLOADABLE_BY,VALID_FLAG,CREATE_TIME,
|
||||
MODIFY_TIME
|
||||
</sql>
|
||||
<sql id="Base_Where_Clause">
|
||||
<if test="firstType != null and firstType != ''">
|
||||
and FIRST_TYPE = #{firstType}
|
||||
</if>
|
||||
<if test="secondType != null and secondType != ''">
|
||||
and SECOND_TYPE = #{secondType}
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
and `NAME` like concat('%',#{name},'%')
|
||||
</if>
|
||||
<if test="uploadTime != null">
|
||||
and UPLOAD_TIME = #{uploadTime}
|
||||
</if>
|
||||
<if test="treeNodeId != null and treeNodeId != ''">
|
||||
and TREE_NODE_ID = #{treeNodeId}
|
||||
</if>
|
||||
</sql>
|
||||
<select id="queryByPageCount" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from sar_laws_information
|
||||
where VALID_FLAG = 0
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
<select id="queryByPage" resultType="com.adc.da.slrs.sarLawsInformation.entity.SarLawsInformation">
|
||||
select <include refid="Base_Column_List" />
|
||||
from sar_laws_information
|
||||
where VALID_FLAG = 0
|
||||
<include refid="Base_Where_Clause" />
|
||||
order by ${sortField} ${sortMode}
|
||||
limit ${pager.startIndex-1},${pageSize}
|
||||
</select>
|
||||
</mapper>
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
<?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="com.adc.da.slrs.sarLawsInformationCenterTree.dao.SarLawsInformationCenterTreeDao">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.adc.da.slrs.sarLawsInformationCenterTree.entity.SarLawsInformationCenterTree">
|
||||
<result property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="pId" column="p_id" jdbcType="VARCHAR"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="sort" column="sort" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,p_id,`name`,
|
||||
sort
|
||||
</sql>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user