mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-21 02:25:56 +08:00
update 更新 system 相关表接口 (sys_config, sys_dept) 新增 Bo | Vo 类, 更改请求以及响应参数 ;
This commit is contained in:
parent
075ef635c6
commit
177a73a71c
@ -9,7 +9,8 @@ import com.ruoyi.common.core.domain.R;
|
|||||||
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.log.enums.BusinessType;
|
import com.ruoyi.common.log.enums.BusinessType;
|
||||||
import com.ruoyi.common.excel.utils.ExcelUtil;
|
import com.ruoyi.common.excel.utils.ExcelUtil;
|
||||||
import com.ruoyi.system.domain.SysConfig;
|
import com.ruoyi.system.domain.bo.SysConfigBo;
|
||||||
|
import com.ruoyi.system.domain.vo.SysConfigVo;
|
||||||
import com.ruoyi.system.service.ISysConfigService;
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -36,8 +37,8 @@ public class SysConfigController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:config:list")
|
@SaCheckPermission("system:config:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo<SysConfig> list(SysConfig config, PageQuery pageQuery) {
|
public TableDataInfo<SysConfigVo> list(SysConfigBo bo, PageQuery pageQuery) {
|
||||||
return configService.selectPageConfigList(config, pageQuery);
|
return configService.selectPageConfigList(bo, pageQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -46,9 +47,9 @@ public class SysConfigController extends BaseController {
|
|||||||
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
||||||
@SaCheckPermission("system:config:export")
|
@SaCheckPermission("system:config:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(SysConfig config, HttpServletResponse response) {
|
public void export(SysConfigBo bo, HttpServletResponse response) {
|
||||||
List<SysConfig> list = configService.selectConfigList(config);
|
List<SysConfigVo> list = configService.selectConfigList(bo);
|
||||||
ExcelUtil.exportExcel(list, "参数数据", SysConfig.class, response);
|
ExcelUtil.exportExcel(list, "参数数据", SysConfigVo.class, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,7 +59,7 @@ public class SysConfigController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:config:query")
|
@SaCheckPermission("system:config:query")
|
||||||
@GetMapping(value = "/{configId}")
|
@GetMapping(value = "/{configId}")
|
||||||
public R<SysConfig> getInfo(@PathVariable Long configId) {
|
public R<SysConfigVo> getInfo(@PathVariable Long configId) {
|
||||||
return R.ok(configService.selectConfigById(configId));
|
return R.ok(configService.selectConfigById(configId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,11 +79,11 @@ public class SysConfigController extends BaseController {
|
|||||||
@SaCheckPermission("system:config:add")
|
@SaCheckPermission("system:config:add")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public R<Void> add(@Validated @RequestBody SysConfig config) {
|
public R<Void> add(@Validated @RequestBody SysConfigBo bo) {
|
||||||
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) {
|
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(bo))) {
|
||||||
return R.fail("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
return R.fail("新增参数'" + bo.getConfigName() + "'失败,参数键名已存在");
|
||||||
}
|
}
|
||||||
configService.insertConfig(config);
|
configService.insertConfig(bo);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,11 +93,11 @@ public class SysConfigController extends BaseController {
|
|||||||
@SaCheckPermission("system:config:edit")
|
@SaCheckPermission("system:config:edit")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public R<Void> edit(@Validated @RequestBody SysConfig config) {
|
public R<Void> edit(@Validated @RequestBody SysConfigBo bo) {
|
||||||
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) {
|
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(bo))) {
|
||||||
return R.fail("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
return R.fail("修改参数'" + bo.getConfigName() + "'失败,参数键名已存在");
|
||||||
}
|
}
|
||||||
configService.updateConfig(config);
|
configService.updateConfig(bo);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,8 +107,8 @@ public class SysConfigController extends BaseController {
|
|||||||
@SaCheckPermission("system:config:edit")
|
@SaCheckPermission("system:config:edit")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/updateByKey")
|
@PutMapping("/updateByKey")
|
||||||
public R<Void> updateByKey(@RequestBody SysConfig config) {
|
public R<Void> updateByKey(@RequestBody SysConfigBo bo) {
|
||||||
configService.updateConfig(config);
|
configService.updateConfig(bo);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,9 +6,10 @@ import com.ruoyi.common.log.annotation.Log;
|
|||||||
import com.ruoyi.common.core.constant.UserConstants;
|
import com.ruoyi.common.core.constant.UserConstants;
|
||||||
import com.ruoyi.common.web.core.BaseController;
|
import com.ruoyi.common.web.core.BaseController;
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.domain.R;
|
||||||
import com.ruoyi.system.domain.SysDept;
|
|
||||||
import com.ruoyi.common.log.enums.BusinessType;
|
import com.ruoyi.common.log.enums.BusinessType;
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
|
import com.ruoyi.system.domain.bo.SysDeptBo;
|
||||||
|
import com.ruoyi.system.domain.vo.SysDeptVo;
|
||||||
import com.ruoyi.system.service.ISysDeptService;
|
import com.ruoyi.system.service.ISysDeptService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -34,8 +35,8 @@ public class SysDeptController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:dept:list")
|
@SaCheckPermission("system:dept:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public R<List<SysDept>> list(SysDept dept) {
|
public R<List<SysDeptVo>> list(SysDeptBo bo) {
|
||||||
List<SysDept> depts = deptService.selectDeptList(dept);
|
List<SysDeptVo> depts = deptService.selectDeptList(bo);
|
||||||
return R.ok(depts);
|
return R.ok(depts);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,8 +47,8 @@ public class SysDeptController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:dept:list")
|
@SaCheckPermission("system:dept:list")
|
||||||
@GetMapping("/list/exclude/{deptId}")
|
@GetMapping("/list/exclude/{deptId}")
|
||||||
public R<List<SysDept>> excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) {
|
public R<List<SysDeptVo>> excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) {
|
||||||
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
List<SysDeptVo> depts = deptService.selectDeptList(new SysDeptBo());
|
||||||
depts.removeIf(d -> d.getDeptId().equals(deptId)
|
depts.removeIf(d -> d.getDeptId().equals(deptId)
|
||||||
|| ArrayUtil.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
|
|| ArrayUtil.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
|
||||||
return R.ok(depts);
|
return R.ok(depts);
|
||||||
@ -60,7 +61,7 @@ public class SysDeptController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:dept:query")
|
@SaCheckPermission("system:dept:query")
|
||||||
@GetMapping(value = "/{deptId}")
|
@GetMapping(value = "/{deptId}")
|
||||||
public R<SysDept> getInfo(@PathVariable Long deptId) {
|
public R<SysDeptVo> getInfo(@PathVariable Long deptId) {
|
||||||
deptService.checkDeptDataScope(deptId);
|
deptService.checkDeptDataScope(deptId);
|
||||||
return R.ok(deptService.selectDeptById(deptId));
|
return R.ok(deptService.selectDeptById(deptId));
|
||||||
}
|
}
|
||||||
@ -71,11 +72,11 @@ public class SysDeptController extends BaseController {
|
|||||||
@SaCheckPermission("system:dept:add")
|
@SaCheckPermission("system:dept:add")
|
||||||
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public R<Void> add(@Validated @RequestBody SysDept dept) {
|
public R<Void> add(@Validated @RequestBody SysDeptBo bo) {
|
||||||
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) {
|
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(bo))) {
|
||||||
return R.fail("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
return R.fail("新增部门'" + bo.getDeptName() + "'失败,部门名称已存在");
|
||||||
}
|
}
|
||||||
return toAjax(deptService.insertDept(dept));
|
return toAjax(deptService.insertDept(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -84,18 +85,18 @@ public class SysDeptController extends BaseController {
|
|||||||
@SaCheckPermission("system:dept:edit")
|
@SaCheckPermission("system:dept:edit")
|
||||||
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public R<Void> edit(@Validated @RequestBody SysDept dept) {
|
public R<Void> edit(@Validated @RequestBody SysDeptBo bo) {
|
||||||
Long deptId = dept.getDeptId();
|
Long deptId = bo.getDeptId();
|
||||||
deptService.checkDeptDataScope(deptId);
|
deptService.checkDeptDataScope(deptId);
|
||||||
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) {
|
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(bo))) {
|
||||||
return R.fail("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
return R.fail("修改部门'" + bo.getDeptName() + "'失败,部门名称已存在");
|
||||||
} else if (dept.getParentId().equals(deptId)) {
|
} else if (bo.getParentId().equals(deptId)) {
|
||||||
return R.fail("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
return R.fail("修改部门'" + bo.getDeptName() + "'失败,上级部门不能是自己");
|
||||||
} else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
|
} else if (StringUtils.equals(UserConstants.DEPT_DISABLE, bo.getStatus())
|
||||||
&& deptService.selectNormalChildrenDeptById(deptId) > 0) {
|
&& deptService.selectNormalChildrenDeptById(deptId) > 0) {
|
||||||
return R.fail("该部门包含未停用的子部门!");
|
return R.fail("该部门包含未停用的子部门!");
|
||||||
}
|
}
|
||||||
return toAjax(deptService.updateDept(dept));
|
return toAjax(deptService.updateDept(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,18 +1,11 @@
|
|||||||
package com.ruoyi.system.domain;
|
package com.ruoyi.system.domain;
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.ruoyi.common.mybatis.core.domain.BaseEntity;
|
import com.ruoyi.common.mybatis.core.domain.BaseEntity;
|
||||||
import com.ruoyi.common.excel.annotation.ExcelDictFormat;
|
|
||||||
import com.ruoyi.common.excel.convert.ExcelDictConvert;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
import jakarta.validation.constraints.Size;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 参数配置表 sys_config
|
* 参数配置表 sys_config
|
||||||
*
|
*
|
||||||
@ -22,45 +15,32 @@ import jakarta.validation.constraints.Size;
|
|||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName("sys_config")
|
@TableName("sys_config")
|
||||||
@ExcelIgnoreUnannotated
|
|
||||||
public class SysConfig extends BaseEntity {
|
public class SysConfig extends BaseEntity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 参数主键
|
* 参数主键
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "参数主键")
|
|
||||||
@TableId(value = "config_id")
|
@TableId(value = "config_id")
|
||||||
private Long configId;
|
private Long configId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 参数名称
|
* 参数名称
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "参数名称")
|
|
||||||
@NotBlank(message = "参数名称不能为空")
|
|
||||||
@Size(min = 0, max = 100, message = "参数名称不能超过{max}个字符")
|
|
||||||
private String configName;
|
private String configName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 参数键名
|
* 参数键名
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "参数键名")
|
|
||||||
@NotBlank(message = "参数键名长度不能为空")
|
|
||||||
@Size(min = 0, max = 100, message = "参数键名长度不能超过{max}个字符")
|
|
||||||
private String configKey;
|
private String configKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 参数键值
|
* 参数键值
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "参数键值")
|
|
||||||
@NotBlank(message = "参数键值不能为空")
|
|
||||||
@Size(min = 0, max = 500, message = "参数键值长度不能超过{max}个字符")
|
|
||||||
private String configValue;
|
private String configValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统内置(Y是 N否)
|
* 系统内置(Y是 N否)
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "系统内置", converter = ExcelDictConvert.class)
|
|
||||||
@ExcelDictFormat(dictType = "sys_yes_no")
|
|
||||||
private String configType;
|
private String configType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -36,14 +36,11 @@ public class SysDept extends TreeEntity<SysDept> {
|
|||||||
/**
|
/**
|
||||||
* 部门名称
|
* 部门名称
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "部门名称不能为空")
|
|
||||||
@Size(min = 0, max = 30, message = "部门名称长度不能超过{max}个字符")
|
|
||||||
private String deptName;
|
private String deptName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示顺序
|
* 显示顺序
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "显示顺序不能为空")
|
|
||||||
private Integer orderNum;
|
private Integer orderNum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -54,14 +51,11 @@ public class SysDept extends TreeEntity<SysDept> {
|
|||||||
/**
|
/**
|
||||||
* 联系电话
|
* 联系电话
|
||||||
*/
|
*/
|
||||||
@Size(min = 0, max = 11, message = "联系电话长度不能超过{max}个字符")
|
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 邮箱
|
* 邮箱
|
||||||
*/
|
*/
|
||||||
@Email(message = "邮箱格式不正确")
|
|
||||||
@Size(min = 0, max = 50, message = "邮箱长度不能超过{max}个字符")
|
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -0,0 +1,60 @@
|
|||||||
|
package com.ruoyi.system.domain.bo;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.validate.AddGroup;
|
||||||
|
import com.ruoyi.common.core.validate.EditGroup;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
|
import com.ruoyi.common.mybatis.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数配置业务对象 sys_config
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2023-01-31
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class SysConfigBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数主键
|
||||||
|
*/
|
||||||
|
@NotNull(message = "参数主键不能为空", groups = { EditGroup.class })
|
||||||
|
private Long configId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "参数名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
@Size(min = 0, max = 100, message = "参数名称不能超过{max}个字符")
|
||||||
|
private String configName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数键名
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "参数键名不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
@Size(min = 0, max = 100, message = "参数键名长度不能超过{max}个字符")
|
||||||
|
private String configKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数键值
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "参数键值不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
@Size(min = 0, max = 500, message = "参数键值长度不能超过{max}个字符")
|
||||||
|
private String configValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统内置(Y是 N否)
|
||||||
|
*/
|
||||||
|
private String configType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
package com.ruoyi.system.domain.bo;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.validate.AddGroup;
|
||||||
|
import com.ruoyi.common.core.validate.EditGroup;
|
||||||
|
import com.ruoyi.common.mybatis.core.domain.TreeEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门业务对象 sys_dept
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2023-01-31
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class SysDeptBo extends TreeEntity<SysDeptBo> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "部门id不能为空", groups = { EditGroup.class })
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "部门名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
@Size(min = 0, max = 30, message = "部门名称长度不能超过{max}个字符")
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示顺序
|
||||||
|
*/
|
||||||
|
@NotNull(message = "显示顺序不能为空")
|
||||||
|
private Long orderNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 负责人
|
||||||
|
*/
|
||||||
|
private String leader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系电话
|
||||||
|
*/
|
||||||
|
@Size(min = 0, max = 11, message = "联系电话长度不能超过{max}个字符")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
@Email(message = "邮箱格式不正确")
|
||||||
|
@Size(min = 0, max = 50, message = "邮箱长度不能超过{max}个字符")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
package com.ruoyi.system.domain.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.ruoyi.common.excel.annotation.ExcelDictFormat;
|
||||||
|
import com.ruoyi.common.excel.convert.ExcelDictConvert;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数配置视图对象 sys_config
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2023-01-31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class SysConfigVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数主键
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "参数主键")
|
||||||
|
private Long configId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "参数名称")
|
||||||
|
private String configName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数键名
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "参数键名")
|
||||||
|
private String configKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数键值
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "参数键值")
|
||||||
|
private String configValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统内置(Y是 N否)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "系统内置", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(dictType = "sys_yes_no")
|
||||||
|
private String configType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
package com.ruoyi.system.domain.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.ruoyi.common.excel.annotation.ExcelDictFormat;
|
||||||
|
import com.ruoyi.common.excel.convert.ExcelDictConvert;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门视图对象 sys_dept
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2023-01-31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class SysDeptVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "部门id")
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父部门id
|
||||||
|
*/
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父部门名称
|
||||||
|
*/
|
||||||
|
private String parentName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 祖级列表
|
||||||
|
*/
|
||||||
|
private String ancestors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "部门名称")
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示顺序
|
||||||
|
*/
|
||||||
|
private Long orderNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 负责人
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "负责人")
|
||||||
|
private String leader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系电话
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "联系电话")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "邮箱")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "部门状态", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(dictType = "sys_normal_disable")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -2,12 +2,13 @@ package com.ruoyi.system.mapper;
|
|||||||
|
|
||||||
import com.ruoyi.common.mybatis.core.mapper.BaseMapperPlus;
|
import com.ruoyi.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
import com.ruoyi.system.domain.SysConfig;
|
import com.ruoyi.system.domain.SysConfig;
|
||||||
|
import com.ruoyi.system.domain.vo.SysConfigVo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 参数配置 数据层
|
* 参数配置 数据层
|
||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
public interface SysConfigMapper extends BaseMapperPlus<SysConfigMapper, SysConfig, SysConfig> {
|
public interface SysConfigMapper extends BaseMapperPlus<SysConfigMapper, SysConfig, SysConfigVo> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import com.ruoyi.common.mybatis.annotation.DataColumn;
|
|||||||
import com.ruoyi.common.mybatis.annotation.DataPermission;
|
import com.ruoyi.common.mybatis.annotation.DataPermission;
|
||||||
import com.ruoyi.common.mybatis.core.mapper.BaseMapperPlus;
|
import com.ruoyi.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
import com.ruoyi.system.domain.SysDept;
|
import com.ruoyi.system.domain.SysDept;
|
||||||
|
import com.ruoyi.system.domain.vo.SysDeptVo;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -15,7 +16,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
public interface SysDeptMapper extends BaseMapperPlus<SysDeptMapper, SysDept, SysDept> {
|
public interface SysDeptMapper extends BaseMapperPlus<SysDeptMapper, SysDept, SysDeptVo> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询部门管理数据
|
* 查询部门管理数据
|
||||||
@ -26,7 +27,7 @@ public interface SysDeptMapper extends BaseMapperPlus<SysDeptMapper, SysDept, Sy
|
|||||||
@DataPermission({
|
@DataPermission({
|
||||||
@DataColumn(key = "deptName", value = "dept_id")
|
@DataColumn(key = "deptName", value = "dept_id")
|
||||||
})
|
})
|
||||||
List<SysDept> selectDeptList(@Param(Constants.WRAPPER) Wrapper<SysDept> queryWrapper);
|
List<SysDeptVo> selectDeptList(@Param(Constants.WRAPPER) Wrapper<SysDept> queryWrapper);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据角色ID查询部门树信息
|
* 根据角色ID查询部门树信息
|
||||||
|
|||||||
@ -2,7 +2,8 @@ package com.ruoyi.system.service;
|
|||||||
|
|
||||||
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
||||||
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||||
import com.ruoyi.system.domain.SysConfig;
|
import com.ruoyi.system.domain.bo.SysConfigBo;
|
||||||
|
import com.ruoyi.system.domain.vo.SysConfigVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -14,7 +15,7 @@ import java.util.List;
|
|||||||
public interface ISysConfigService {
|
public interface ISysConfigService {
|
||||||
|
|
||||||
|
|
||||||
TableDataInfo<SysConfig> selectPageConfigList(SysConfig config, PageQuery pageQuery);
|
TableDataInfo<SysConfigVo> selectPageConfigList(SysConfigBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询参数配置信息
|
* 查询参数配置信息
|
||||||
@ -22,7 +23,7 @@ public interface ISysConfigService {
|
|||||||
* @param configId 参数配置ID
|
* @param configId 参数配置ID
|
||||||
* @return 参数配置信息
|
* @return 参数配置信息
|
||||||
*/
|
*/
|
||||||
SysConfig selectConfigById(Long configId);
|
SysConfigVo selectConfigById(Long configId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据键名查询参数配置信息
|
* 根据键名查询参数配置信息
|
||||||
@ -42,26 +43,26 @@ public interface ISysConfigService {
|
|||||||
/**
|
/**
|
||||||
* 查询参数配置列表
|
* 查询参数配置列表
|
||||||
*
|
*
|
||||||
* @param config 参数配置信息
|
* @param bo 参数配置信息
|
||||||
* @return 参数配置集合
|
* @return 参数配置集合
|
||||||
*/
|
*/
|
||||||
List<SysConfig> selectConfigList(SysConfig config);
|
List<SysConfigVo> selectConfigList(SysConfigBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增参数配置
|
* 新增参数配置
|
||||||
*
|
*
|
||||||
* @param config 参数配置信息
|
* @param bo 参数配置信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
String insertConfig(SysConfig config);
|
String insertConfig(SysConfigBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改参数配置
|
* 修改参数配置
|
||||||
*
|
*
|
||||||
* @param config 参数配置信息
|
* @param bo 参数配置信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
String updateConfig(SysConfig config);
|
String updateConfig(SysConfigBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除参数信息
|
* 批量删除参数信息
|
||||||
@ -88,9 +89,9 @@ public interface ISysConfigService {
|
|||||||
/**
|
/**
|
||||||
* 校验参数键名是否唯一
|
* 校验参数键名是否唯一
|
||||||
*
|
*
|
||||||
* @param config 参数信息
|
* @param bo 参数信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
String checkConfigKeyUnique(SysConfig config);
|
String checkConfigKeyUnique(SysConfigBo bo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,8 @@ package com.ruoyi.system.service;
|
|||||||
|
|
||||||
import cn.hutool.core.lang.tree.Tree;
|
import cn.hutool.core.lang.tree.Tree;
|
||||||
import com.ruoyi.system.domain.SysDept;
|
import com.ruoyi.system.domain.SysDept;
|
||||||
|
import com.ruoyi.system.domain.bo.SysDeptBo;
|
||||||
|
import com.ruoyi.system.domain.vo.SysDeptVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -14,10 +16,10 @@ public interface ISysDeptService {
|
|||||||
/**
|
/**
|
||||||
* 查询部门管理数据
|
* 查询部门管理数据
|
||||||
*
|
*
|
||||||
* @param dept 部门信息
|
* @param bo 部门信息
|
||||||
* @return 部门信息集合
|
* @return 部门信息集合
|
||||||
*/
|
*/
|
||||||
List<SysDept> selectDeptList(SysDept dept);
|
List<SysDeptVo> selectDeptList(SysDeptBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询部门树结构信息
|
* 查询部门树结构信息
|
||||||
@ -49,7 +51,7 @@ public interface ISysDeptService {
|
|||||||
* @param deptId 部门ID
|
* @param deptId 部门ID
|
||||||
* @return 部门信息
|
* @return 部门信息
|
||||||
*/
|
*/
|
||||||
SysDept selectDeptById(Long deptId);
|
SysDeptVo selectDeptById(Long deptId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID查询所有子部门数(正常状态)
|
* 根据ID查询所有子部门数(正常状态)
|
||||||
@ -78,10 +80,10 @@ public interface ISysDeptService {
|
|||||||
/**
|
/**
|
||||||
* 校验部门名称是否唯一
|
* 校验部门名称是否唯一
|
||||||
*
|
*
|
||||||
* @param dept 部门信息
|
* @param bo 部门信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
String checkDeptNameUnique(SysDept dept);
|
String checkDeptNameUnique(SysDeptBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验部门是否有数据权限
|
* 校验部门是否有数据权限
|
||||||
@ -93,18 +95,18 @@ public interface ISysDeptService {
|
|||||||
/**
|
/**
|
||||||
* 新增保存部门信息
|
* 新增保存部门信息
|
||||||
*
|
*
|
||||||
* @param dept 部门信息
|
* @param bo 部门信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int insertDept(SysDept dept);
|
int insertDept(SysDeptBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改保存部门信息
|
* 修改保存部门信息
|
||||||
*
|
*
|
||||||
* @param dept 部门信息
|
* @param bo 部门信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int updateDept(SysDept dept);
|
int updateDept(SysDeptBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除部门管理信息
|
* 删除部门管理信息
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
package com.ruoyi.system.service.impl;
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.ruoyi.common.core.constant.CacheNames;
|
import com.ruoyi.common.core.constant.CacheNames;
|
||||||
import com.ruoyi.common.core.constant.UserConstants;
|
import com.ruoyi.common.core.constant.UserConstants;
|
||||||
@ -15,6 +17,8 @@ import com.ruoyi.common.core.utils.StringUtils;
|
|||||||
import com.ruoyi.common.redis.utils.CacheUtils;
|
import com.ruoyi.common.redis.utils.CacheUtils;
|
||||||
import com.ruoyi.common.core.utils.SpringUtils;
|
import com.ruoyi.common.core.utils.SpringUtils;
|
||||||
import com.ruoyi.system.domain.SysConfig;
|
import com.ruoyi.system.domain.SysConfig;
|
||||||
|
import com.ruoyi.system.domain.bo.SysConfigBo;
|
||||||
|
import com.ruoyi.system.domain.vo.SysConfigVo;
|
||||||
import com.ruoyi.system.mapper.SysConfigMapper;
|
import com.ruoyi.system.mapper.SysConfigMapper;
|
||||||
import com.ruoyi.system.service.ISysConfigService;
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -38,15 +42,9 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
|||||||
private final SysConfigMapper baseMapper;
|
private final SysConfigMapper baseMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<SysConfig> selectPageConfigList(SysConfig config, PageQuery pageQuery) {
|
public TableDataInfo<SysConfigVo> selectPageConfigList(SysConfigBo bo, PageQuery pageQuery) {
|
||||||
Map<String, Object> params = config.getParams();
|
LambdaQueryWrapper<SysConfig> lqw = buildQueryWrapper(bo);
|
||||||
LambdaQueryWrapper<SysConfig> lqw = new LambdaQueryWrapper<SysConfig>()
|
Page<SysConfigVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
.like(StringUtils.isNotBlank(config.getConfigName()), SysConfig::getConfigName, config.getConfigName())
|
|
||||||
.eq(StringUtils.isNotBlank(config.getConfigType()), SysConfig::getConfigType, config.getConfigType())
|
|
||||||
.like(StringUtils.isNotBlank(config.getConfigKey()), SysConfig::getConfigKey, config.getConfigKey())
|
|
||||||
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
|
||||||
SysConfig::getCreateTime, params.get("beginTime"), params.get("endTime"));
|
|
||||||
Page<SysConfig> page = baseMapper.selectPage(pageQuery.build(), lqw);
|
|
||||||
return TableDataInfo.build(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,8 +56,8 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@DS("master")
|
@DS("master")
|
||||||
public SysConfig selectConfigById(Long configId) {
|
public SysConfigVo selectConfigById(Long configId) {
|
||||||
return baseMapper.selectById(configId);
|
return baseMapper.selectVoById(configId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -96,30 +94,36 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
|||||||
/**
|
/**
|
||||||
* 查询参数配置列表
|
* 查询参数配置列表
|
||||||
*
|
*
|
||||||
* @param config 参数配置信息
|
* @param bo 参数配置信息
|
||||||
* @return 参数配置集合
|
* @return 参数配置集合
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysConfig> selectConfigList(SysConfig config) {
|
public List<SysConfigVo> selectConfigList(SysConfigBo bo) {
|
||||||
Map<String, Object> params = config.getParams();
|
LambdaQueryWrapper<SysConfig> lqw = buildQueryWrapper(bo);
|
||||||
LambdaQueryWrapper<SysConfig> lqw = new LambdaQueryWrapper<SysConfig>()
|
return baseMapper.selectVoList(lqw);
|
||||||
.like(StringUtils.isNotBlank(config.getConfigName()), SysConfig::getConfigName, config.getConfigName())
|
}
|
||||||
.eq(StringUtils.isNotBlank(config.getConfigType()), SysConfig::getConfigType, config.getConfigType())
|
|
||||||
.like(StringUtils.isNotBlank(config.getConfigKey()), SysConfig::getConfigKey, config.getConfigKey())
|
private LambdaQueryWrapper<SysConfig> buildQueryWrapper(SysConfigBo bo) {
|
||||||
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
Map<String, Object> params = bo.getParams();
|
||||||
SysConfig::getCreateTime, params.get("beginTime"), params.get("endTime"));
|
LambdaQueryWrapper<SysConfig> lqw = Wrappers.lambdaQuery();
|
||||||
return baseMapper.selectList(lqw);
|
lqw.like(StringUtils.isNotBlank(bo.getConfigName()), SysConfig::getConfigName, bo.getConfigName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getConfigType()), SysConfig::getConfigType, bo.getConfigType());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getConfigKey()), SysConfig::getConfigKey, bo.getConfigKey());
|
||||||
|
lqw.between(params.get("beginTime") != null && params.get("endTime") != null,
|
||||||
|
SysConfig::getCreateTime, params.get("beginTime"), params.get("endTime"));
|
||||||
|
return lqw;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增参数配置
|
* 新增参数配置
|
||||||
*
|
*
|
||||||
* @param config 参数配置信息
|
* @param bo 参数配置信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@CachePut(cacheNames = CacheNames.SYS_CONFIG, key = "#config.configKey")
|
@CachePut(cacheNames = CacheNames.SYS_CONFIG, key = "#bo.configKey")
|
||||||
@Override
|
@Override
|
||||||
public String insertConfig(SysConfig config) {
|
public String insertConfig(SysConfigBo bo) {
|
||||||
|
SysConfig config = BeanUtil.toBean(bo, SysConfig.class);
|
||||||
int row = baseMapper.insert(config);
|
int row = baseMapper.insert(config);
|
||||||
if (row > 0) {
|
if (row > 0) {
|
||||||
return config.getConfigValue();
|
return config.getConfigValue();
|
||||||
@ -130,13 +134,14 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
|||||||
/**
|
/**
|
||||||
* 修改参数配置
|
* 修改参数配置
|
||||||
*
|
*
|
||||||
* @param config 参数配置信息
|
* @param bo 参数配置信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@CachePut(cacheNames = CacheNames.SYS_CONFIG, key = "#config.configKey")
|
@CachePut(cacheNames = CacheNames.SYS_CONFIG, key = "#bo.configKey")
|
||||||
@Override
|
@Override
|
||||||
public String updateConfig(SysConfig config) {
|
public String updateConfig(SysConfigBo bo) {
|
||||||
int row = 0;
|
int row = 0;
|
||||||
|
SysConfig config = BeanUtil.toBean(bo, SysConfig.class);
|
||||||
if (config.getConfigId() != null) {
|
if (config.getConfigId() != null) {
|
||||||
SysConfig temp = baseMapper.selectById(config.getConfigId());
|
SysConfig temp = baseMapper.selectById(config.getConfigId());
|
||||||
if (!StringUtils.equals(temp.getConfigKey(), config.getConfigKey())) {
|
if (!StringUtils.equals(temp.getConfigKey(), config.getConfigKey())) {
|
||||||
@ -161,7 +166,7 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
|||||||
@Override
|
@Override
|
||||||
public void deleteConfigByIds(Long[] configIds) {
|
public void deleteConfigByIds(Long[] configIds) {
|
||||||
for (Long configId : configIds) {
|
for (Long configId : configIds) {
|
||||||
SysConfig config = selectConfigById(configId);
|
SysConfig config = baseMapper.selectById(configId);
|
||||||
if (StringUtils.equals(UserConstants.YES, config.getConfigType())) {
|
if (StringUtils.equals(UserConstants.YES, config.getConfigType())) {
|
||||||
throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
|
throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
|
||||||
}
|
}
|
||||||
@ -175,7 +180,7 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void loadingConfigCache() {
|
public void loadingConfigCache() {
|
||||||
List<SysConfig> configsList = selectConfigList(new SysConfig());
|
List<SysConfigVo> configsList = selectConfigList(new SysConfigBo());
|
||||||
configsList.forEach(config ->
|
configsList.forEach(config ->
|
||||||
CacheUtils.put(CacheNames.SYS_CONFIG, config.getConfigKey(), config.getConfigValue()));
|
CacheUtils.put(CacheNames.SYS_CONFIG, config.getConfigKey(), config.getConfigValue()));
|
||||||
}
|
}
|
||||||
@ -200,13 +205,13 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
|||||||
/**
|
/**
|
||||||
* 校验参数键名是否唯一
|
* 校验参数键名是否唯一
|
||||||
*
|
*
|
||||||
* @param config 参数配置信息
|
* @param bo 参数配置信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String checkConfigKeyUnique(SysConfig config) {
|
public String checkConfigKeyUnique(SysConfigBo bo) {
|
||||||
long configId = ObjectUtil.isNull(config.getConfigId()) ? -1L : config.getConfigId();
|
long configId = ObjectUtil.isNull(bo.getConfigId()) ? -1L : bo.getConfigId();
|
||||||
SysConfig info = baseMapper.selectOne(new LambdaQueryWrapper<SysConfig>().eq(SysConfig::getConfigKey, config.getConfigKey()));
|
SysConfig info = baseMapper.selectOne(new LambdaQueryWrapper<SysConfig>().eq(SysConfig::getConfigKey, bo.getConfigKey()));
|
||||||
if (ObjectUtil.isNotNull(info) && info.getConfigId() != configId) {
|
if (ObjectUtil.isNotNull(info) && info.getConfigId() != configId) {
|
||||||
return UserConstants.NOT_UNIQUE;
|
return UserConstants.NOT_UNIQUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
package com.ruoyi.system.service.impl;
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.lang.tree.Tree;
|
import cn.hutool.core.lang.tree.Tree;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.ruoyi.common.core.constant.UserConstants;
|
import com.ruoyi.common.core.constant.UserConstants;
|
||||||
import com.ruoyi.system.domain.SysDept;
|
import com.ruoyi.system.domain.SysDept;
|
||||||
import com.ruoyi.system.domain.SysRole;
|
import com.ruoyi.system.domain.SysRole;
|
||||||
@ -15,6 +17,8 @@ import com.ruoyi.common.mybatis.helper.DataBaseHelper;
|
|||||||
import com.ruoyi.common.satoken.utils.LoginHelper;
|
import com.ruoyi.common.satoken.utils.LoginHelper;
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
import com.ruoyi.common.core.utils.TreeBuildUtils;
|
import com.ruoyi.common.core.utils.TreeBuildUtils;
|
||||||
|
import com.ruoyi.system.domain.bo.SysDeptBo;
|
||||||
|
import com.ruoyi.system.domain.vo.SysDeptVo;
|
||||||
import com.ruoyi.system.mapper.SysDeptMapper;
|
import com.ruoyi.system.mapper.SysDeptMapper;
|
||||||
import com.ruoyi.system.mapper.SysRoleMapper;
|
import com.ruoyi.system.mapper.SysRoleMapper;
|
||||||
import com.ruoyi.system.mapper.SysUserMapper;
|
import com.ruoyi.system.mapper.SysUserMapper;
|
||||||
@ -42,19 +46,12 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
|||||||
/**
|
/**
|
||||||
* 查询部门管理数据
|
* 查询部门管理数据
|
||||||
*
|
*
|
||||||
* @param dept 部门信息
|
* @param bo 部门信息
|
||||||
* @return 部门信息集合
|
* @return 部门信息集合
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysDept> selectDeptList(SysDept dept) {
|
public List<SysDeptVo> selectDeptList(SysDeptBo bo) {
|
||||||
LambdaQueryWrapper<SysDept> lqw = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SysDept> lqw = buildQueryWrapper(bo);
|
||||||
lqw.eq(SysDept::getDelFlag, "0")
|
|
||||||
.eq(ObjectUtil.isNotNull(dept.getDeptId()), SysDept::getDeptId, dept.getDeptId())
|
|
||||||
.eq(ObjectUtil.isNotNull(dept.getParentId()), SysDept::getParentId, dept.getParentId())
|
|
||||||
.like(StringUtils.isNotBlank(dept.getDeptName()), SysDept::getDeptName, dept.getDeptName())
|
|
||||||
.eq(StringUtils.isNotBlank(dept.getStatus()), SysDept::getStatus, dept.getStatus())
|
|
||||||
.orderByAsc(SysDept::getParentId)
|
|
||||||
.orderByAsc(SysDept::getOrderNum);
|
|
||||||
return baseMapper.selectDeptList(lqw);
|
return baseMapper.selectDeptList(lqw);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,10 +63,24 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Tree<Long>> selectDeptTreeList(SysDept dept) {
|
public List<Tree<Long>> selectDeptTreeList(SysDept dept) {
|
||||||
List<SysDept> depts = this.selectDeptList(dept);
|
SysDeptBo bo = BeanUtil.toBean(dept, SysDeptBo.class);
|
||||||
|
LambdaQueryWrapper<SysDept> lqw = buildQueryWrapper(bo);
|
||||||
|
List<SysDept> depts = baseMapper.selectList(lqw);
|
||||||
return buildDeptTreeSelect(depts);
|
return buildDeptTreeSelect(depts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<SysDept> buildQueryWrapper(SysDeptBo bo) {
|
||||||
|
LambdaQueryWrapper<SysDept> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.eq(SysDept::getDelFlag, "0");
|
||||||
|
lqw.eq(ObjectUtil.isNotNull(bo.getDeptId()), SysDept::getDeptId, bo.getDeptId());
|
||||||
|
lqw.eq(ObjectUtil.isNotNull(bo.getParentId()), SysDept::getParentId, bo.getParentId());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getDeptName()), SysDept::getDeptName, bo.getDeptName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysDept::getStatus, bo.getStatus());
|
||||||
|
lqw.orderByAsc(SysDept::getParentId);
|
||||||
|
lqw.orderByAsc(SysDept::getOrderNum);
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建前端所需要下拉树结构
|
* 构建前端所需要下拉树结构
|
||||||
*
|
*
|
||||||
@ -107,9 +118,9 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
|||||||
* @return 部门信息
|
* @return 部门信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysDept selectDeptById(Long deptId) {
|
public SysDeptVo selectDeptById(Long deptId) {
|
||||||
SysDept dept = baseMapper.selectById(deptId);
|
SysDeptVo dept = baseMapper.selectVoById(deptId);
|
||||||
SysDept parentDept = baseMapper.selectOne(new LambdaQueryWrapper<SysDept>()
|
SysDeptVo parentDept = baseMapper.selectVoOne(new LambdaQueryWrapper<SysDept>()
|
||||||
.select(SysDept::getDeptName).eq(SysDept::getDeptId, dept.getParentId()));
|
.select(SysDept::getDeptName).eq(SysDept::getDeptId, dept.getParentId()));
|
||||||
dept.setParentName(ObjectUtil.isNotNull(parentDept) ? parentDept.getDeptName() : null);
|
dept.setParentName(ObjectUtil.isNotNull(parentDept) ? parentDept.getDeptName() : null);
|
||||||
return dept;
|
return dept;
|
||||||
@ -155,15 +166,15 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
|||||||
/**
|
/**
|
||||||
* 校验部门名称是否唯一
|
* 校验部门名称是否唯一
|
||||||
*
|
*
|
||||||
* @param dept 部门信息
|
* @param bo 部门信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String checkDeptNameUnique(SysDept dept) {
|
public String checkDeptNameUnique(SysDeptBo bo) {
|
||||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysDept>()
|
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysDept>()
|
||||||
.eq(SysDept::getDeptName, dept.getDeptName())
|
.eq(SysDept::getDeptName, bo.getDeptName())
|
||||||
.eq(SysDept::getParentId, dept.getParentId())
|
.eq(SysDept::getParentId, bo.getParentId())
|
||||||
.ne(ObjectUtil.isNotNull(dept.getDeptId()), SysDept::getDeptId, dept.getDeptId()));
|
.ne(ObjectUtil.isNotNull(bo.getDeptId()), SysDept::getDeptId, bo.getDeptId()));
|
||||||
if (exist) {
|
if (exist) {
|
||||||
return UserConstants.NOT_UNIQUE;
|
return UserConstants.NOT_UNIQUE;
|
||||||
}
|
}
|
||||||
@ -178,9 +189,9 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
|||||||
@Override
|
@Override
|
||||||
public void checkDeptDataScope(Long deptId) {
|
public void checkDeptDataScope(Long deptId) {
|
||||||
if (!LoginHelper.isAdmin()) {
|
if (!LoginHelper.isAdmin()) {
|
||||||
SysDept dept = new SysDept();
|
SysDeptBo dept = new SysDeptBo();
|
||||||
dept.setDeptId(deptId);
|
dept.setDeptId(deptId);
|
||||||
List<SysDept> depts = this.selectDeptList(dept);
|
List<SysDeptVo> depts = this.selectDeptList(dept);
|
||||||
if (CollUtil.isEmpty(depts)) {
|
if (CollUtil.isEmpty(depts)) {
|
||||||
throw new ServiceException("没有权限访问部门数据!");
|
throw new ServiceException("没有权限访问部门数据!");
|
||||||
}
|
}
|
||||||
@ -190,16 +201,17 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
|||||||
/**
|
/**
|
||||||
* 新增保存部门信息
|
* 新增保存部门信息
|
||||||
*
|
*
|
||||||
* @param dept 部门信息
|
* @param bo 部门信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertDept(SysDept dept) {
|
public int insertDept(SysDeptBo bo) {
|
||||||
SysDept info = baseMapper.selectById(dept.getParentId());
|
SysDept info = baseMapper.selectById(bo.getParentId());
|
||||||
// 如果父节点不为正常状态,则不允许新增子节点
|
// 如果父节点不为正常状态,则不允许新增子节点
|
||||||
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {
|
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {
|
||||||
throw new ServiceException("部门停用,不允许新增");
|
throw new ServiceException("部门停用,不允许新增");
|
||||||
}
|
}
|
||||||
|
SysDept dept = BeanUtil.toBean(bo, SysDept.class);
|
||||||
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
||||||
return baseMapper.insert(dept);
|
return baseMapper.insert(dept);
|
||||||
}
|
}
|
||||||
@ -207,11 +219,12 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
|||||||
/**
|
/**
|
||||||
* 修改保存部门信息
|
* 修改保存部门信息
|
||||||
*
|
*
|
||||||
* @param dept 部门信息
|
* @param bo 部门信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateDept(SysDept dept) {
|
public int updateDept(SysDeptBo bo) {
|
||||||
|
SysDept dept = BeanUtil.toBean(bo, SysDept.class);
|
||||||
SysDept newParentDept = baseMapper.selectById(dept.getParentId());
|
SysDept newParentDept = baseMapper.selectById(dept.getParentId());
|
||||||
SysDept oldDept = baseMapper.selectById(dept.getDeptId());
|
SysDept oldDept = baseMapper.selectById(dept.getDeptId());
|
||||||
if (ObjectUtil.isNotNull(newParentDept) && ObjectUtil.isNotNull(oldDept)) {
|
if (ObjectUtil.isNotNull(newParentDept) && ObjectUtil.isNotNull(oldDept)) {
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.ruoyi.system.mapper.SysDeptMapper">
|
<mapper namespace="com.ruoyi.system.mapper.SysDeptMapper">
|
||||||
|
|
||||||
<resultMap type="com.ruoyi.system.domain.SysDept" id="SysDeptResult">
|
<resultMap type="com.ruoyi.system.domain.vo.SysDeptVo" id="SysDeptResult">
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="selectDeptList" resultMap="SysDeptResult">
|
<select id="selectDeptList" resultMap="SysDeptResult">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user