feat(oa): 新增运营中心制度管理功能
- 新增运营中心制度管理的实体类、VO、BO及Mapper接口 - 实现制度管理的增删改查及分页查询功能 - 提供制度信息的Excel导出功能- 配置MyBatis Plus的逻辑删除支持 - 添加制度管理的校验与业务逻辑处理 - 实现制度管理前端控制器接口 - 支持制度类别、名称等内容的条件查询 - 完成制度信息的数据转换与参数校验 - 设置制度管理模块的基础权限控制- 集成制度信息导入导出工具类支持
This commit is contained in:
@@ -0,0 +1,101 @@
|
|||||||
|
package com.ruoyi.oa.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.common.core.validate.AddGroup;
|
||||||
|
import com.ruoyi.common.core.validate.EditGroup;
|
||||||
|
import com.ruoyi.common.core.validate.QueryGroup;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.oa.domain.vo.OaOperationRuleVo;
|
||||||
|
import com.ruoyi.oa.domain.bo.OaOperationRuleBo;
|
||||||
|
import com.ruoyi.oa.service.IOaOperationRuleService;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运营中心制度管理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-10-22
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/oa/operationRule")
|
||||||
|
public class OaOperationRuleController extends BaseController {
|
||||||
|
|
||||||
|
private final IOaOperationRuleService iOaOperationRuleService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询运营中心制度管理列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<OaOperationRuleVo> list(OaOperationRuleBo bo, PageQuery pageQuery) {
|
||||||
|
return iOaOperationRuleService.queryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出运营中心制度管理列表
|
||||||
|
*/
|
||||||
|
@Log(title = "运营中心制度管理", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(OaOperationRuleBo bo, HttpServletResponse response) {
|
||||||
|
List<OaOperationRuleVo> list = iOaOperationRuleService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "运营中心制度管理", OaOperationRuleVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取运营中心制度管理详细信息
|
||||||
|
*
|
||||||
|
* @param ruleId 主键
|
||||||
|
*/
|
||||||
|
@GetMapping("/{ruleId}")
|
||||||
|
public R<OaOperationRuleVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long ruleId) {
|
||||||
|
return R.ok(iOaOperationRuleService.queryById(ruleId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增运营中心制度管理
|
||||||
|
*/
|
||||||
|
@Log(title = "运营中心制度管理", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody OaOperationRuleBo bo) {
|
||||||
|
return toAjax(iOaOperationRuleService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改运营中心制度管理
|
||||||
|
*/
|
||||||
|
@Log(title = "运营中心制度管理", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody OaOperationRuleBo bo) {
|
||||||
|
return toAjax(iOaOperationRuleService.updateByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除运营中心制度管理
|
||||||
|
*
|
||||||
|
* @param ruleIds 主键串
|
||||||
|
*/
|
||||||
|
@Log(title = "运营中心制度管理", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ruleIds}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ruleIds) {
|
||||||
|
return toAjax(iOaOperationRuleService.deleteWithValidByIds(Arrays.asList(ruleIds), true));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package com.ruoyi.oa.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运营中心制度管理对象 oa_operation_rule
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-10-22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("oa_operation_rule")
|
||||||
|
public class OaOperationRule extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID=1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 唯一标识ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "rule_id")
|
||||||
|
private Long ruleId;
|
||||||
|
/**
|
||||||
|
* 制度类别
|
||||||
|
*/
|
||||||
|
private String ruleCategory;
|
||||||
|
/**
|
||||||
|
* 制度名称
|
||||||
|
*/
|
||||||
|
private String ruleName;
|
||||||
|
/**
|
||||||
|
* 制度内容
|
||||||
|
*/
|
||||||
|
private String coverage;
|
||||||
|
/**
|
||||||
|
* 责任部门/人
|
||||||
|
*/
|
||||||
|
private String responsibleDepartment;
|
||||||
|
/**
|
||||||
|
* 附件(路径或 URL),多附件逗号分隔
|
||||||
|
*/
|
||||||
|
private String accessory;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 删除标志:0=正常,1=已删除
|
||||||
|
*/
|
||||||
|
@TableLogic
|
||||||
|
private Integer delFlag;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package com.ruoyi.oa.domain.bo;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.validate.AddGroup;
|
||||||
|
import com.ruoyi.common.core.validate.EditGroup;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运营中心制度管理业务对象 oa_operation_rule
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-10-22
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class OaOperationRuleBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 唯一标识ID
|
||||||
|
*/
|
||||||
|
private Long ruleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 制度类别
|
||||||
|
*/
|
||||||
|
private String ruleCategory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 制度名称
|
||||||
|
*/
|
||||||
|
private String ruleName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 制度内容
|
||||||
|
*/
|
||||||
|
private String coverage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 责任部门/人
|
||||||
|
*/
|
||||||
|
private String responsibleDepartment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 附件(路径或 URL),多附件逗号分隔
|
||||||
|
*/
|
||||||
|
private String accessory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package com.ruoyi.oa.domain.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.ruoyi.common.annotation.ExcelDictFormat;
|
||||||
|
import com.ruoyi.common.convert.ExcelDictConvert;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运营中心制度管理视图对象 oa_operation_rule
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-10-22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class OaOperationRuleVo {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 唯一标识ID
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "唯一标识ID")
|
||||||
|
private Long ruleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 制度类别
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "制度类别")
|
||||||
|
private String ruleCategory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 制度名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "制度名称")
|
||||||
|
private String ruleName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 制度内容
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "制度内容")
|
||||||
|
private String coverage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 责任部门/人
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "责任部门/人")
|
||||||
|
private String responsibleDepartment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 附件(路径或 URL),多附件逗号分隔
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "附件", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "路=径或,U=RL")
|
||||||
|
private String accessory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.ruoyi.oa.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.oa.domain.OaOperationRule;
|
||||||
|
import com.ruoyi.oa.domain.vo.OaOperationRuleVo;
|
||||||
|
import com.ruoyi.common.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运营中心制度管理Mapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-10-22
|
||||||
|
*/
|
||||||
|
public interface OaOperationRuleMapper extends BaseMapperPlus<OaOperationRuleMapper, OaOperationRule, OaOperationRuleVo> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package com.ruoyi.oa.service;
|
||||||
|
|
||||||
|
import com.ruoyi.oa.domain.OaOperationRule;
|
||||||
|
import com.ruoyi.oa.domain.vo.OaOperationRuleVo;
|
||||||
|
import com.ruoyi.oa.domain.bo.OaOperationRuleBo;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运营中心制度管理Service接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-10-22
|
||||||
|
*/
|
||||||
|
public interface IOaOperationRuleService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询运营中心制度管理
|
||||||
|
*/
|
||||||
|
OaOperationRuleVo queryById(Long ruleId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询运营中心制度管理列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<OaOperationRuleVo> queryPageList(OaOperationRuleBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询运营中心制度管理列表
|
||||||
|
*/
|
||||||
|
List<OaOperationRuleVo> queryList(OaOperationRuleBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增运营中心制度管理
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(OaOperationRuleBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改运营中心制度管理
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(OaOperationRuleBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除运营中心制度管理信息
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
package com.ruoyi.oa.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ruoyi.oa.domain.bo.OaOperationRuleBo;
|
||||||
|
import com.ruoyi.oa.domain.vo.OaOperationRuleVo;
|
||||||
|
import com.ruoyi.oa.domain.OaOperationRule;
|
||||||
|
import com.ruoyi.oa.mapper.OaOperationRuleMapper;
|
||||||
|
import com.ruoyi.oa.service.IOaOperationRuleService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运营中心制度管理Service业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-10-22
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class OaOperationRuleServiceImpl implements IOaOperationRuleService {
|
||||||
|
|
||||||
|
private final OaOperationRuleMapper baseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询运营中心制度管理
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public OaOperationRuleVo queryById(Long ruleId){
|
||||||
|
return baseMapper.selectVoById(ruleId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询运营中心制度管理列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<OaOperationRuleVo> queryPageList(OaOperationRuleBo bo, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<OaOperationRule> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<OaOperationRuleVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询运营中心制度管理列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<OaOperationRuleVo> queryList(OaOperationRuleBo bo) {
|
||||||
|
LambdaQueryWrapper<OaOperationRule> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<OaOperationRule> buildQueryWrapper(OaOperationRuleBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<OaOperationRule> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getRuleCategory()), OaOperationRule::getRuleCategory, bo.getRuleCategory());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getRuleName()), OaOperationRule::getRuleName, bo.getRuleName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getCoverage()), OaOperationRule::getCoverage, bo.getCoverage());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getResponsibleDepartment()), OaOperationRule::getResponsibleDepartment, bo.getResponsibleDepartment());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getAccessory()), OaOperationRule::getAccessory, bo.getAccessory());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增运营中心制度管理
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(OaOperationRuleBo bo) {
|
||||||
|
OaOperationRule add = BeanUtil.toBean(bo, OaOperationRule.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setRuleId(add.getRuleId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改运营中心制度管理
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(OaOperationRuleBo bo) {
|
||||||
|
OaOperationRule update = BeanUtil.toBean(bo, OaOperationRule.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(OaOperationRule entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除运营中心制度管理
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return baseMapper.deleteBatchIds(ids) > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?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.ruoyi.oa.mapper.OaOperationRuleMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.ruoyi.oa.domain.OaOperationRule" id="OaOperationRuleResult">
|
||||||
|
<result property="ruleId" column="rule_id"/>
|
||||||
|
<result property="ruleCategory" column="rule_category"/>
|
||||||
|
<result property="ruleName" column="rule_name"/>
|
||||||
|
<result property="coverage" column="coverage"/>
|
||||||
|
<result property="responsibleDepartment" column="responsible_department"/>
|
||||||
|
<result property="accessory" column="accessory"/>
|
||||||
|
<result property="remark" column="remark"/>
|
||||||
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="updateBy" column="update_by"/>
|
||||||
|
<result property="updateTime" column="update_time"/>
|
||||||
|
<result property="delFlag" column="del_flag"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user