使用mybatis-flex重构“部门管理”模块代码
This commit is contained in:
parent
a73f311afc
commit
5285591fc5
@ -16,7 +16,7 @@ mybatis-flex:
|
|||||||
autoMappingBehavior: FULL
|
autoMappingBehavior: FULL
|
||||||
# MyBatis 自动映射时未知列或未知属性处理策
|
# MyBatis 自动映射时未知列或未知属性处理策
|
||||||
# NONE:不做处理 WARNING:打印相关警告 FAILING:抛出异常和详细信息
|
# NONE:不做处理 WARNING:打印相关警告 FAILING:抛出异常和详细信息
|
||||||
autoMappingUnknownColumnBehavior: WARNING
|
autoMappingUnknownColumnBehavior: NONE
|
||||||
# 更详细的日志输出 会有性能损耗 org.apache.ibatis.logging.stdout.StdOutImpl
|
# 更详细的日志输出 会有性能损耗 org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
# 关闭日志记录 org.apache.ibatis.logging.nologging.NoLoggingImpl
|
# 关闭日志记录 org.apache.ibatis.logging.nologging.NoLoggingImpl
|
||||||
# 默认日志输出 org.apache.ibatis.logging.slf4j.Slf4jImpl
|
# 默认日志输出 org.apache.ibatis.logging.slf4j.Slf4jImpl
|
||||||
|
@ -24,6 +24,12 @@ public class BaseEntity implements Serializable {
|
|||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户编号
|
||||||
|
*/
|
||||||
|
@Column(ignore = true)
|
||||||
|
private Long tenantId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 搜索值
|
* 搜索值
|
||||||
*/
|
*/
|
||||||
|
@ -2,6 +2,7 @@ package com.ruoyi.demo.domain;
|
|||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
@ -26,6 +27,8 @@ public class DemoStudent extends BaseEntity
|
|||||||
|
|
||||||
/** 年龄 */
|
/** 年龄 */
|
||||||
@Excel(name = "年龄")
|
@Excel(name = "年龄")
|
||||||
|
//@NotBlank
|
||||||
|
//private int studentAge;
|
||||||
private Long studentAge;
|
private Long studentAge;
|
||||||
|
|
||||||
/** 爱好(0代码 1音乐 2电影) */
|
/** 爱好(0代码 1音乐 2电影) */
|
||||||
|
@ -3,13 +3,16 @@ package com.ruoyi.system.controller.system;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import com.ruoyi.common.core.core.domain.R;
|
||||||
|
import com.ruoyi.common.core.core.text.Convert;
|
||||||
import com.ruoyi.common.log.annotation.Log;
|
import com.ruoyi.common.log.annotation.Log;
|
||||||
import com.ruoyi.common.log.enums.BusinessType;
|
import com.ruoyi.common.log.enums.BusinessType;
|
||||||
import com.ruoyi.common.security.utils.LoginHelper;
|
import com.ruoyi.common.security.utils.LoginHelper;
|
||||||
import com.ruoyi.system.domain.SysDept;
|
import com.ruoyi.system.domain.bo.SysDeptBo;
|
||||||
|
import com.ruoyi.system.domain.vo.SysDeptVo;
|
||||||
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@ -38,14 +41,17 @@ public class SysDeptController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private ISysDeptService deptService;
|
private ISysDeptService deptService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ISysUserService sysUserService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取部门列表
|
* 获取部门列表
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:dept:list")
|
@SaCheckPermission("system:dept:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public AjaxResult list(SysDept dept) {
|
public R<List<SysDeptVo>> list(SysDeptBo deptBo) {
|
||||||
List<SysDept> depts = deptService.selectDeptList(dept);
|
List<SysDeptVo> depts = deptService.selectDeptList(deptBo);
|
||||||
return success(depts);
|
return R.ok(depts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -53,10 +59,10 @@ public class SysDeptController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:dept:list")
|
@SaCheckPermission("system:dept:list")
|
||||||
@GetMapping("/list/exclude/{deptId}")
|
@GetMapping("/list/exclude/{deptId}")
|
||||||
public AjaxResult 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().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
|
depts.removeIf(d -> d.getDeptId().equals(deptId) || StringUtils.splitList(d.getAncestors()).contains(Convert.toStr(deptId)));
|
||||||
return success(depts);
|
return R.ok(depts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -65,9 +71,9 @@ public class SysDeptController extends BaseController {
|
|||||||
@SaCheckPermission("system:dept:query")
|
@SaCheckPermission("system:dept:query")
|
||||||
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||||
@GetMapping(value = "/{deptId}")
|
@GetMapping(value = "/{deptId}")
|
||||||
public AjaxResult getInfo(@PathVariable Long deptId) {
|
public R<SysDeptVo> getInfo(@PathVariable Long deptId) {
|
||||||
deptService.checkDeptDataScope(deptId);
|
deptService.checkDeptDataScope(deptId);
|
||||||
return success(deptService.selectDeptById(deptId));
|
return R.ok(deptService.selectDeptById(deptId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -75,12 +81,15 @@ public class SysDeptController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:dept:add")
|
@SaCheckPermission("system:dept:add")
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@Validated @RequestBody SysDept dept) {
|
public R<Void> add(@Validated @RequestBody SysDeptBo dept) {
|
||||||
if (!deptService.checkDeptNameUnique(dept)) {
|
if (!deptService.checkDeptNameUnique(dept)) {
|
||||||
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
return R.fail("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||||
}
|
}
|
||||||
dept.setCreateBy(LoginHelper.getUserId());
|
int inserted = deptService.insertDept(dept);
|
||||||
return toAjax(deptService.insertDept(dept));
|
if (inserted != 1) {
|
||||||
|
return R.fail("新增部门记录失败!");
|
||||||
|
}
|
||||||
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -89,22 +98,25 @@ 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 AjaxResult edit(@Validated @RequestBody SysDept dept) {
|
public R<Void> edit(@Validated @RequestBody SysDeptBo dept) {
|
||||||
Long deptId = dept.getDeptId();
|
Long deptId = dept.getDeptId();
|
||||||
deptService.checkDeptDataScope(deptId);
|
deptService.checkDeptDataScope(deptId);
|
||||||
if (!deptService.checkDeptNameUnique(dept)) {
|
if (!deptService.checkDeptNameUnique(dept)) {
|
||||||
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
return R.fail("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||||
} else if (dept.getParentId().equals(deptId)) {
|
} else if (dept.getParentId().equals(deptId)) {
|
||||||
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
return R.fail("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
||||||
} else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())) {
|
} else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())) {
|
||||||
if (deptService.selectNormalChildrenDeptById(deptId) > 0) {
|
if (deptService.selectNormalChildrenDeptById(deptId) > 0) {
|
||||||
return error("该部门包含未停用的子部门!");
|
return R.fail("该部门包含未停用的子部门!");
|
||||||
} else if (deptService.checkDeptExistUser(deptId)) {
|
} else if (sysUserService.checkDeptExistUser(deptId)) {
|
||||||
return error("该部门下存在已分配用户,不能禁用!");
|
return R.fail("该部门下存在已分配用户,不能禁用!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dept.setUpdateBy(LoginHelper.getUserId());
|
boolean updated = deptService.updateDept(dept);
|
||||||
return toAjax(deptService.updateDept(dept));
|
if (!updated) {
|
||||||
|
return R.fail("修改部门'" + dept.getDeptName() + "'失败");
|
||||||
|
}
|
||||||
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -113,14 +125,18 @@ public class SysDeptController extends BaseController {
|
|||||||
@SaCheckPermission("system:dept:remove")
|
@SaCheckPermission("system:dept:remove")
|
||||||
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{deptId}")
|
@DeleteMapping("/{deptId}")
|
||||||
public AjaxResult remove(@PathVariable Long deptId) {
|
public R<Void> remove(@PathVariable Long deptId) {
|
||||||
if (deptService.hasChildByDeptId(deptId)) {
|
if (deptService.hasChildByDeptId(deptId)) {
|
||||||
return warn("存在下级部门,不允许删除");
|
return R.warn("存在下级部门,不允许删除");
|
||||||
}
|
}
|
||||||
if (deptService.checkDeptExistUser(deptId)) {
|
if (sysUserService.checkDeptExistUser(deptId)) {
|
||||||
return warn("部门存在用户,不允许删除");
|
return R.warn("部门存在用户,不允许删除");
|
||||||
}
|
}
|
||||||
deptService.checkDeptDataScope(deptId);
|
deptService.checkDeptDataScope(deptId);
|
||||||
return toAjax(deptService.deleteDeptById(deptId));
|
boolean updated = deptService.deleteDeptById(deptId);
|
||||||
|
if (!updated) {
|
||||||
|
return R.fail("删除部门失败");
|
||||||
|
}
|
||||||
|
return R.ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import com.ruoyi.common.security.utils.LoginHelper;
|
|||||||
import com.ruoyi.system.domain.SysDept;
|
import com.ruoyi.system.domain.SysDept;
|
||||||
import com.ruoyi.system.domain.SysRole;
|
import com.ruoyi.system.domain.SysRole;
|
||||||
import com.ruoyi.system.domain.SysUser;
|
import com.ruoyi.system.domain.SysUser;
|
||||||
|
import com.ruoyi.system.domain.bo.SysDeptBo;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -244,7 +245,7 @@ public class SysRoleController extends BaseController
|
|||||||
{
|
{
|
||||||
AjaxResult ajax = AjaxResult.success();
|
AjaxResult ajax = AjaxResult.success();
|
||||||
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
|
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
|
||||||
ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));
|
ajax.put("depts", deptService.selectDeptTreeList(new SysDeptBo()));
|
||||||
return ajax;
|
return ajax;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import com.ruoyi.system.domain.SysDept;
|
|||||||
import com.ruoyi.system.domain.SysPost;
|
import com.ruoyi.system.domain.SysPost;
|
||||||
import com.ruoyi.system.domain.SysRole;
|
import com.ruoyi.system.domain.SysRole;
|
||||||
import com.ruoyi.system.domain.SysUser;
|
import com.ruoyi.system.domain.SysUser;
|
||||||
|
import com.ruoyi.system.domain.bo.SysDeptBo;
|
||||||
import com.ruoyi.system.domain.bo.SysPostBo;
|
import com.ruoyi.system.domain.bo.SysPostBo;
|
||||||
import com.ruoyi.system.service.*;
|
import com.ruoyi.system.service.*;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
@ -238,7 +239,7 @@ public class SysUserController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:user:list")
|
@SaCheckPermission("system:user:list")
|
||||||
@GetMapping("/deptTree")
|
@GetMapping("/deptTree")
|
||||||
public AjaxResult deptTree(SysDept dept) {
|
public AjaxResult deptTree(SysDeptBo dept) {
|
||||||
return success(deptService.selectDeptTreeList(dept));
|
return success(deptService.selectDeptTreeList(dept));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,9 +3,16 @@ package com.ruoyi.system.domain;
|
|||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
import jakarta.validation.constraints.Email;
|
import jakarta.validation.constraints.Email;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.common.orm.core.domain.BaseEntity;
|
import com.ruoyi.common.orm.core.domain.BaseEntity;
|
||||||
@ -15,12 +22,14 @@ import com.ruoyi.common.orm.core.domain.BaseEntity;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Table(value = "sys_dept")
|
||||||
public class SysDept extends BaseEntity
|
public class SysDept extends BaseEntity
|
||||||
{
|
{
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** 部门ID */
|
/** 部门ID */
|
||||||
|
@Id(keyType = KeyType.Auto)
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
/** 父部门ID */
|
/** 父部门ID */
|
||||||
@ -36,7 +45,7 @@ public class SysDept extends BaseEntity
|
|||||||
private String orderNum;
|
private String orderNum;
|
||||||
|
|
||||||
/** 负责人 */
|
/** 负责人 */
|
||||||
private String leader;
|
private String leader;//TODO:修改为Long类型
|
||||||
|
|
||||||
/** 联系电话 */
|
/** 联系电话 */
|
||||||
private String phone;
|
private String phone;
|
||||||
@ -51,154 +60,155 @@ public class SysDept extends BaseEntity
|
|||||||
private String delFlag;
|
private String delFlag;
|
||||||
|
|
||||||
/** 父部门名称 */
|
/** 父部门名称 */
|
||||||
|
@Column(ignore = true)
|
||||||
private String parentName;
|
private String parentName;
|
||||||
|
|
||||||
/** 子部门 */
|
/** 子部门 */
|
||||||
private List<SysDept> children = new ArrayList<SysDept>();
|
private List<SysDept> children = new ArrayList<SysDept>();
|
||||||
|
|
||||||
public Long getDeptId()
|
// public Long getDeptId()
|
||||||
{
|
// {
|
||||||
return deptId;
|
// return deptId;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setDeptId(Long deptId)
|
// public void setDeptId(Long deptId)
|
||||||
{
|
// {
|
||||||
this.deptId = deptId;
|
// this.deptId = deptId;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public Long getParentId()
|
// public Long getParentId()
|
||||||
{
|
// {
|
||||||
return parentId;
|
// return parentId;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setParentId(Long parentId)
|
// public void setParentId(Long parentId)
|
||||||
{
|
// {
|
||||||
this.parentId = parentId;
|
// this.parentId = parentId;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getAncestors()
|
// public String getAncestors()
|
||||||
{
|
// {
|
||||||
return ancestors;
|
// return ancestors;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setAncestors(String ancestors)
|
// public void setAncestors(String ancestors)
|
||||||
{
|
// {
|
||||||
this.ancestors = ancestors;
|
// this.ancestors = ancestors;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@NotBlank(message = "部门名称不能为空")
|
// @NotBlank(message = "部门名称不能为空")
|
||||||
@Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
|
// @Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
|
||||||
public String getDeptName()
|
// public String getDeptName()
|
||||||
{
|
// {
|
||||||
return deptName;
|
// return deptName;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setDeptName(String deptName)
|
// public void setDeptName(String deptName)
|
||||||
{
|
// {
|
||||||
this.deptName = deptName;
|
// this.deptName = deptName;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@NotBlank(message = "显示顺序不能为空")
|
// @NotBlank(message = "显示顺序不能为空")
|
||||||
public String getOrderNum()
|
// public String getOrderNum()
|
||||||
{
|
// {
|
||||||
return orderNum;
|
// return orderNum;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setOrderNum(String orderNum)
|
// public void setOrderNum(String orderNum)
|
||||||
{
|
// {
|
||||||
this.orderNum = orderNum;
|
// this.orderNum = orderNum;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getLeader()
|
// public String getLeader()
|
||||||
{
|
// {
|
||||||
return leader;
|
// return leader;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setLeader(String leader)
|
// public void setLeader(String leader)
|
||||||
{
|
// {
|
||||||
this.leader = leader;
|
// this.leader = leader;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
|
// @Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
|
||||||
public String getPhone()
|
// public String getPhone()
|
||||||
{
|
// {
|
||||||
return phone;
|
// return phone;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setPhone(String phone)
|
// public void setPhone(String phone)
|
||||||
{
|
// {
|
||||||
this.phone = phone;
|
// this.phone = phone;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Email(message = "邮箱格式不正确")
|
// @Email(message = "邮箱格式不正确")
|
||||||
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
|
// @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
|
||||||
public String getEmail()
|
// public String getEmail()
|
||||||
{
|
// {
|
||||||
return email;
|
// return email;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setEmail(String email)
|
// public void setEmail(String email)
|
||||||
{
|
// {
|
||||||
this.email = email;
|
// this.email = email;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getStatus()
|
// public String getStatus()
|
||||||
{
|
// {
|
||||||
return status;
|
// return status;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setStatus(String status)
|
// public void setStatus(String status)
|
||||||
{
|
// {
|
||||||
this.status = status;
|
// this.status = status;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getDelFlag()
|
// public String getDelFlag()
|
||||||
{
|
// {
|
||||||
return delFlag;
|
// return delFlag;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setDelFlag(String delFlag)
|
// public void setDelFlag(String delFlag)
|
||||||
{
|
// {
|
||||||
this.delFlag = delFlag;
|
// this.delFlag = delFlag;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String getParentName()
|
// public String getParentName()
|
||||||
{
|
// {
|
||||||
return parentName;
|
// return parentName;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setParentName(String parentName)
|
// public void setParentName(String parentName)
|
||||||
{
|
// {
|
||||||
this.parentName = parentName;
|
// this.parentName = parentName;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public List<SysDept> getChildren()
|
// public List<SysDept> getChildren()
|
||||||
{
|
// {
|
||||||
return children;
|
// return children;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setChildren(List<SysDept> children)
|
// public void setChildren(List<SysDept> children)
|
||||||
{
|
// {
|
||||||
this.children = children;
|
// this.children = children;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public String toString() {
|
// public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
// return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
.append("deptId", getDeptId())
|
// .append("deptId", getDeptId())
|
||||||
.append("parentId", getParentId())
|
// .append("parentId", getParentId())
|
||||||
.append("ancestors", getAncestors())
|
// .append("ancestors", getAncestors())
|
||||||
.append("deptName", getDeptName())
|
// .append("deptName", getDeptName())
|
||||||
.append("orderNum", getOrderNum())
|
// .append("orderNum", getOrderNum())
|
||||||
.append("leader", getLeader())
|
// .append("leader", getLeader())
|
||||||
.append("phone", getPhone())
|
// .append("phone", getPhone())
|
||||||
.append("email", getEmail())
|
// .append("email", getEmail())
|
||||||
.append("status", getStatus())
|
// .append("status", getStatus())
|
||||||
.append("delFlag", getDelFlag())
|
// .append("delFlag", getDelFlag())
|
||||||
.append("createBy", getCreateBy())
|
// .append("createBy", getCreateBy())
|
||||||
.append("createTime", getCreateTime())
|
// .append("createTime", getCreateTime())
|
||||||
.append("updateBy", getUpdateBy())
|
// .append("updateBy", getUpdateBy())
|
||||||
.append("updateTime", getUpdateTime())
|
// .append("updateTime", getUpdateTime())
|
||||||
.toString();
|
// .toString();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
package com.ruoyi.system.domain;
|
package com.ruoyi.system.domain;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.RelationManyToMany;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
@ -9,6 +16,7 @@ import com.ruoyi.common.core.annotation.Excel.ColumnType;
|
|||||||
import com.ruoyi.common.orm.core.domain.BaseEntity;
|
import com.ruoyi.common.orm.core.domain.BaseEntity;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -16,13 +24,15 @@ import java.util.Set;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Table(value = "sys_role")
|
||||||
public class SysRole extends BaseEntity
|
public class SysRole extends BaseEntity
|
||||||
{
|
{
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** 角色ID */
|
/** 角色ID */
|
||||||
@Excel(name = "角色序号", cellType = ColumnType.NUMERIC)
|
@Excel(name = "角色序号", cellType = ColumnType.NUMERIC)
|
||||||
|
@Id(keyType = KeyType.Auto)
|
||||||
private Long roleId;
|
private Long roleId;
|
||||||
|
|
||||||
/** 角色名称 */
|
/** 角色名称 */
|
||||||
@ -65,40 +75,35 @@ public class SysRole extends BaseEntity
|
|||||||
/** 菜单组 */
|
/** 菜单组 */
|
||||||
private Long[] menuIds;
|
private Long[] menuIds;
|
||||||
|
|
||||||
|
@RelationManyToMany(
|
||||||
|
selfField = "roleId",
|
||||||
|
targetField = "menuId",
|
||||||
|
joinTable = "sys_role_menu",
|
||||||
|
joinSelfColumn = "role_id",
|
||||||
|
joinTargetColumn = "menu_id"
|
||||||
|
)
|
||||||
|
private List<SysMenu> menuList;
|
||||||
|
|
||||||
/** 部门组(数据权限) */
|
/** 部门组(数据权限) */
|
||||||
private Long[] deptIds;
|
private Long[] deptIds;
|
||||||
|
|
||||||
|
@RelationManyToMany(
|
||||||
|
selfField = "roleId",
|
||||||
|
targetField = "deptId",
|
||||||
|
joinTable = "sys_role_dept",
|
||||||
|
joinSelfColumn = "role_id",
|
||||||
|
joinTargetColumn = "dept_id"
|
||||||
|
)
|
||||||
|
private List<SysDept> deptList;
|
||||||
|
|
||||||
/** 角色菜单权限 */
|
/** 角色菜单权限 */
|
||||||
private Set<String> permissions;
|
private Set<String> permissions;
|
||||||
|
|
||||||
public String getRemark() {
|
|
||||||
return remark;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRemark(String remark) {
|
|
||||||
this.remark = remark;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SysRole()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public SysRole(Long roleId)
|
public SysRole(Long roleId)
|
||||||
{
|
{
|
||||||
this.roleId = roleId;
|
this.roleId = roleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getRoleId()
|
|
||||||
{
|
|
||||||
return roleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRoleId(Long roleId)
|
|
||||||
{
|
|
||||||
this.roleId = roleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAdmin()
|
public boolean isAdmin()
|
||||||
{
|
{
|
||||||
return isAdmin(this.roleId);
|
return isAdmin(this.roleId);
|
||||||
@ -109,148 +114,4 @@ public class SysRole extends BaseEntity
|
|||||||
return roleId != null && 1L == roleId;
|
return roleId != null && 1L == roleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotBlank(message = "角色名称不能为空")
|
|
||||||
@Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符")
|
|
||||||
public String getRoleName()
|
|
||||||
{
|
|
||||||
return roleName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRoleName(String roleName)
|
|
||||||
{
|
|
||||||
this.roleName = roleName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotBlank(message = "权限字符不能为空")
|
|
||||||
@Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符")
|
|
||||||
public String getRoleKey()
|
|
||||||
{
|
|
||||||
return roleKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRoleKey(String roleKey)
|
|
||||||
{
|
|
||||||
this.roleKey = roleKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotBlank(message = "显示顺序不能为空")
|
|
||||||
public String getRoleSort()
|
|
||||||
{
|
|
||||||
return roleSort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRoleSort(String roleSort)
|
|
||||||
{
|
|
||||||
this.roleSort = roleSort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDataScope()
|
|
||||||
{
|
|
||||||
return dataScope;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDataScope(String dataScope)
|
|
||||||
{
|
|
||||||
this.dataScope = dataScope;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isMenuCheckStrictly()
|
|
||||||
{
|
|
||||||
return menuCheckStrictly;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMenuCheckStrictly(boolean menuCheckStrictly)
|
|
||||||
{
|
|
||||||
this.menuCheckStrictly = menuCheckStrictly;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDeptCheckStrictly()
|
|
||||||
{
|
|
||||||
return deptCheckStrictly;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDeptCheckStrictly(boolean deptCheckStrictly)
|
|
||||||
{
|
|
||||||
this.deptCheckStrictly = deptCheckStrictly;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatus()
|
|
||||||
{
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(String status)
|
|
||||||
{
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDelFlag()
|
|
||||||
{
|
|
||||||
return delFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDelFlag(String delFlag)
|
|
||||||
{
|
|
||||||
this.delFlag = delFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isFlag()
|
|
||||||
{
|
|
||||||
return flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFlag(boolean flag)
|
|
||||||
{
|
|
||||||
this.flag = flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long[] getMenuIds()
|
|
||||||
{
|
|
||||||
return menuIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMenuIds(Long[] menuIds)
|
|
||||||
{
|
|
||||||
this.menuIds = menuIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long[] getDeptIds()
|
|
||||||
{
|
|
||||||
return deptIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDeptIds(Long[] deptIds)
|
|
||||||
{
|
|
||||||
this.deptIds = deptIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<String> getPermissions()
|
|
||||||
{
|
|
||||||
return permissions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPermissions(Set<String> permissions)
|
|
||||||
{
|
|
||||||
this.permissions = permissions;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("roleId", getRoleId())
|
|
||||||
.append("roleName", getRoleName())
|
|
||||||
.append("roleKey", getRoleKey())
|
|
||||||
.append("roleSort", getRoleSort())
|
|
||||||
.append("dataScope", getDataScope())
|
|
||||||
.append("menuCheckStrictly", isMenuCheckStrictly())
|
|
||||||
.append("deptCheckStrictly", isDeptCheckStrictly())
|
|
||||||
.append("status", getStatus())
|
|
||||||
.append("delFlag", getDelFlag())
|
|
||||||
.append("createBy", getCreateBy())
|
|
||||||
.append("createTime", getCreateTime())
|
|
||||||
.append("updateBy", getUpdateBy())
|
|
||||||
.append("updateTime", getUpdateTime())
|
|
||||||
.append("remark", getRemark())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,29 @@
|
|||||||
package com.ruoyi.system.domain;
|
package com.ruoyi.system.domain;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色和菜单关联 sys_role_menu
|
* 角色和菜单关联 sys_role_menu
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@Table(value = "sys_role_menu")
|
||||||
public class SysRoleMenu
|
public class SysRoleMenu
|
||||||
{
|
{
|
||||||
/** 角色ID */
|
/** 角色ID */
|
||||||
|
@Id(keyType = KeyType.None)
|
||||||
private Long roleId;
|
private Long roleId;
|
||||||
|
|
||||||
/** 菜单ID */
|
/** 菜单ID */
|
||||||
|
@Id(keyType = KeyType.None)
|
||||||
private Long menuId;
|
private Long menuId;
|
||||||
|
|
||||||
public Long getRoleId()
|
public Long getRoleId()
|
||||||
|
@ -1,10 +1,18 @@
|
|||||||
package com.ruoyi.system.domain;
|
package com.ruoyi.system.domain;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ruoyi.common.tenant.core.TenantEntity;
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import com.ruoyi.common.core.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.orm.core.domain.BaseEntity;
|
||||||
import jakarta.validation.constraints.*;
|
import jakarta.validation.constraints.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
@ -13,7 +21,6 @@ import com.ruoyi.common.core.annotation.Excel;
|
|||||||
import com.ruoyi.common.core.annotation.Excel.ColumnType;
|
import com.ruoyi.common.core.annotation.Excel.ColumnType;
|
||||||
import com.ruoyi.common.core.annotation.Excel.Type;
|
import com.ruoyi.common.core.annotation.Excel.Type;
|
||||||
import com.ruoyi.common.core.annotation.Excels;
|
import com.ruoyi.common.core.annotation.Excels;
|
||||||
import com.ruoyi.common.orm.core.domain.BaseEntity;
|
|
||||||
import com.ruoyi.common.core.xss.Xss;
|
import com.ruoyi.common.core.xss.Xss;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,12 +28,13 @@ import com.ruoyi.common.core.xss.Xss;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class SysUser extends TenantEntity
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
|
@Table(value = "sys_user")
|
||||||
|
public class SysUser extends BaseEntity
|
||||||
|
{
|
||||||
/** 用户ID */
|
/** 用户ID */
|
||||||
@Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号")
|
@Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号")
|
||||||
|
@Id(keyType = KeyType.Auto)
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
/** 部门ID */
|
/** 部门ID */
|
||||||
@ -56,7 +64,7 @@ public class SysUser extends TenantEntity
|
|||||||
|
|
||||||
/** 用户性别 */
|
/** 用户性别 */
|
||||||
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
|
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
|
||||||
private String sex;
|
private String gender;
|
||||||
|
|
||||||
/** 用户头像 */
|
/** 用户头像 */
|
||||||
private String avatar;
|
private String avatar;
|
||||||
@ -202,14 +210,14 @@ public class SysUser extends TenantEntity
|
|||||||
this.phonenumber = phonenumber;
|
this.phonenumber = phonenumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSex()
|
public String getGender()
|
||||||
{
|
{
|
||||||
return sex;
|
return gender;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSex(String sex)
|
public void setGender(String gender)
|
||||||
{
|
{
|
||||||
this.sex = sex;
|
this.gender = gender;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAvatar()
|
public String getAvatar()
|
||||||
@ -352,7 +360,7 @@ public class SysUser extends TenantEntity
|
|||||||
.append("userType", getUserType())
|
.append("userType", getUserType())
|
||||||
.append("email", getEmail())
|
.append("email", getEmail())
|
||||||
.append("phonenumber", getPhonenumber())
|
.append("phonenumber", getPhonenumber())
|
||||||
.append("sex", getSex())
|
.append("sex", getGender())
|
||||||
.append("avatar", getAvatar())
|
.append("avatar", getAvatar())
|
||||||
.append("password", getPassword())
|
.append("password", getPassword())
|
||||||
.append("salt", getSalt())
|
.append("salt", getSalt())
|
||||||
@ -368,4 +376,9 @@ public class SysUser extends TenantEntity
|
|||||||
.append("dept", getDept())
|
.append("dept", getDept())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSuperAdmin() {
|
||||||
|
return UserConstants.SUPER_ADMIN_ID.equals(this.userId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.ruoyi.system.domain.bo;
|
package com.ruoyi.system.domain.bo;
|
||||||
|
|
||||||
import com.ruoyi.common.tenant.core.TenantEntity;
|
import com.ruoyi.common.orm.core.domain.BaseEntity;
|
||||||
import io.github.linpeilie.annotations.AutoMapper;
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
import jakarta.validation.constraints.Email;
|
import jakarta.validation.constraints.Email;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
@ -22,7 +22,7 @@ import com.ruoyi.system.domain.SysUser;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@AutoMapper(target = SysUser.class)
|
@AutoMapper(target = SysUser.class)
|
||||||
public class SysUserBo extends TenantEntity {
|
public class SysUserBo extends BaseEntity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户ID
|
* 用户ID
|
||||||
@ -70,7 +70,7 @@ public class SysUserBo extends TenantEntity {
|
|||||||
/**
|
/**
|
||||||
* 用户性别(0男 1女 2未知)
|
* 用户性别(0男 1女 2未知)
|
||||||
*/
|
*/
|
||||||
private String sex;
|
private String gender;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 密码
|
* 密码
|
||||||
|
@ -2,6 +2,7 @@ package com.ruoyi.system.domain.vo;
|
|||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
import com.ruoyi.common.excel.annotation.ExcelDictFormat;
|
import com.ruoyi.common.excel.annotation.ExcelDictFormat;
|
||||||
import com.ruoyi.common.excel.convert.ExcelDictConvert;
|
import com.ruoyi.common.excel.convert.ExcelDictConvert;
|
||||||
import com.ruoyi.system.domain.SysDept;
|
import com.ruoyi.system.domain.SysDept;
|
||||||
@ -39,6 +40,7 @@ public class SysDeptVo implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 父部门名称
|
* 父部门名称
|
||||||
*/
|
*/
|
||||||
|
@Column(ignore = true)
|
||||||
private String parentName;
|
private String parentName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,7 +73,7 @@ public class SysUserVo implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 用户性别(0男 1女 2未知)
|
* 用户性别(0男 1女 2未知)
|
||||||
*/
|
*/
|
||||||
private String sex;
|
private String gender;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 头像地址
|
* 头像地址
|
||||||
|
@ -2,7 +2,10 @@ package com.ruoyi.system.mapper;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
import com.ruoyi.system.domain.SysDept;
|
import com.ruoyi.system.domain.SysDept;
|
||||||
|
import com.ruoyi.system.domain.vo.SysDeptVo;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -10,15 +13,16 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface SysDeptMapper
|
@Mapper
|
||||||
|
public interface SysDeptMapper extends BaseMapper<SysDept>
|
||||||
{
|
{
|
||||||
/**
|
// /**
|
||||||
* 查询部门管理数据
|
// * 查询部门管理数据
|
||||||
*
|
// *
|
||||||
* @param dept 部门信息
|
// * @param dept 部门信息
|
||||||
* @return 部门信息集合
|
// * @return 部门信息集合
|
||||||
*/
|
// */
|
||||||
List<SysDept> selectDeptList(SysDept dept);
|
// List<SysDept> selectDeptList(SysDept dept);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据角色ID查询部门树信息
|
* 根据角色ID查询部门树信息
|
||||||
@ -29,91 +33,91 @@ public interface SysDeptMapper
|
|||||||
*/
|
*/
|
||||||
List<Long> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly);
|
List<Long> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly);
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 根据部门ID查询信息
|
// * 根据部门ID查询信息
|
||||||
*
|
// *
|
||||||
* @param deptId 部门ID
|
// * @param deptId 部门ID
|
||||||
* @return 部门信息
|
// * @return 部门信息
|
||||||
*/
|
// */
|
||||||
SysDept selectDeptById(Long deptId);
|
// SysDeptVo selectDeptById(Long deptId);
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 根据ID查询所有子部门
|
// * 根据ID查询所有子部门
|
||||||
*
|
// *
|
||||||
* @param deptId 部门ID
|
// * @param deptId 部门ID
|
||||||
* @return 部门列表
|
// * @return 部门列表
|
||||||
*/
|
// */
|
||||||
List<SysDept> selectChildrenDeptById(Long deptId);
|
// List<SysDept> selectChildrenDeptById(Long deptId);
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 根据ID查询所有子部门(正常状态)
|
// * 根据ID查询所有子部门(正常状态)
|
||||||
*
|
// *
|
||||||
* @param deptId 部门ID
|
// * @param deptId 部门ID
|
||||||
* @return 子部门数
|
// * @return 子部门数
|
||||||
*/
|
// */
|
||||||
int selectNormalChildrenDeptById(Long deptId);
|
// int selectNormalChildrenDeptById(Long deptId);
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 是否存在子节点
|
// * 是否存在子节点
|
||||||
*
|
// *
|
||||||
* @param deptId 部门ID
|
// * @param deptId 部门ID
|
||||||
* @return 结果
|
// * @return 结果
|
||||||
*/
|
// */
|
||||||
int hasChildByDeptId(Long deptId);
|
// int hasChildByDeptId(Long deptId);
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 查询部门是否存在用户
|
// * 查询部门是否存在用户
|
||||||
*
|
// *
|
||||||
* @param deptId 部门ID
|
// * @param deptId 部门ID
|
||||||
* @return 结果
|
// * @return 结果
|
||||||
*/
|
// */
|
||||||
int checkDeptExistUser(Long deptId);
|
// int checkDeptExistUser(Long deptId);
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 校验部门名称是否唯一
|
// * 校验部门名称是否唯一
|
||||||
*
|
// *
|
||||||
* @param deptName 部门名称
|
// * @param deptName 部门名称
|
||||||
* @param parentId 父部门ID
|
// * @param parentId 父部门ID
|
||||||
* @return 结果
|
// * @return 结果
|
||||||
*/
|
// */
|
||||||
SysDept checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId);
|
// SysDept checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId);
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 新增部门信息
|
||||||
|
// *
|
||||||
|
// * @param dept 部门信息
|
||||||
|
// * @return 结果
|
||||||
|
// */
|
||||||
|
// int insertDept(SysDept dept);
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 新增部门信息
|
// * 修改部门信息
|
||||||
*
|
// *
|
||||||
* @param dept 部门信息
|
// * @param dept 部门信息
|
||||||
* @return 结果
|
// * @return 结果
|
||||||
*/
|
// */
|
||||||
int insertDept(SysDept dept);
|
// int updateDept(SysDept dept);
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 修改部门信息
|
// * 修改所在部门正常状态
|
||||||
*
|
// *
|
||||||
* @param dept 部门信息
|
// * @param deptIds 部门ID组
|
||||||
* @return 结果
|
// */
|
||||||
*/
|
// void updateDeptStatusNormal(Long[] deptIds);
|
||||||
int updateDept(SysDept dept);
|
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 修改所在部门正常状态
|
// * 修改子元素关系
|
||||||
*
|
// *
|
||||||
* @param deptIds 部门ID组
|
// * @param depts 子元素
|
||||||
*/
|
// * @return 结果
|
||||||
void updateDeptStatusNormal(Long[] deptIds);
|
// */
|
||||||
|
// int updateDeptChildren(@Param("depts") List<SysDept> depts);
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 修改子元素关系
|
// * 删除部门管理信息
|
||||||
*
|
// *
|
||||||
* @param depts 子元素
|
// * @param deptId 部门ID
|
||||||
* @return 结果
|
// * @return 结果
|
||||||
*/
|
// */
|
||||||
int updateDeptChildren(@Param("depts") List<SysDept> depts);
|
// int deleteDeptById(Long deptId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除部门管理信息
|
|
||||||
*
|
|
||||||
* @param deptId 部门ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int deleteDeptById(Long deptId);
|
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,8 @@ package com.ruoyi.system.mapper;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
import com.ruoyi.system.domain.SysUser;
|
import com.ruoyi.system.domain.SysUser;
|
||||||
import com.ruoyi.system.domain.vo.SysUserVo;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -11,7 +11,7 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface SysUserMapper
|
public interface SysUserMapper extends BaseMapper<SysUser>
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 根据条件分页查询用户列表
|
* 根据条件分页查询用户列表
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
package com.ruoyi.system.service;
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.ruoyi.system.domain.TreeSelect;
|
|
||||||
|
import cn.hutool.core.lang.tree.Tree;
|
||||||
|
import com.ruoyi.common.orm.core.service.IBaseService;
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门管理 服务层
|
* 部门管理 服务层
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface ISysDeptService
|
public interface ISysDeptService extends IBaseService<SysDept>
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 查询部门管理数据
|
* 查询部门管理数据
|
||||||
@ -17,7 +21,7 @@ public interface ISysDeptService
|
|||||||
* @param dept 部门信息
|
* @param dept 部门信息
|
||||||
* @return 部门信息集合
|
* @return 部门信息集合
|
||||||
*/
|
*/
|
||||||
List<SysDept> selectDeptList(SysDept dept);
|
List<SysDeptVo> selectDeptList(SysDeptBo dept);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询部门树结构信息
|
* 查询部门树结构信息
|
||||||
@ -25,15 +29,7 @@ public interface ISysDeptService
|
|||||||
* @param dept 部门信息
|
* @param dept 部门信息
|
||||||
* @return 部门树信息集合
|
* @return 部门树信息集合
|
||||||
*/
|
*/
|
||||||
List<TreeSelect> selectDeptTreeList(SysDept dept);
|
List<Tree<Long>> selectDeptTreeList(SysDeptBo dept) ;
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建前端所需要树结构
|
|
||||||
*
|
|
||||||
* @param depts 部门列表
|
|
||||||
* @return 树结构列表
|
|
||||||
*/
|
|
||||||
List<SysDept> buildDeptTree(List<SysDept> depts);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建前端所需要下拉树结构
|
* 构建前端所需要下拉树结构
|
||||||
@ -41,7 +37,7 @@ public interface ISysDeptService
|
|||||||
* @param depts 部门列表
|
* @param depts 部门列表
|
||||||
* @return 下拉树结构列表
|
* @return 下拉树结构列表
|
||||||
*/
|
*/
|
||||||
List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts);
|
List<Tree<Long>> buildDeptTreeSelect(List<SysDeptVo> depts);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据角色ID查询部门树信息
|
* 根据角色ID查询部门树信息
|
||||||
@ -57,7 +53,7 @@ public interface ISysDeptService
|
|||||||
* @param deptId 部门ID
|
* @param deptId 部门ID
|
||||||
* @return 部门信息
|
* @return 部门信息
|
||||||
*/
|
*/
|
||||||
SysDept selectDeptById(Long deptId);
|
SysDeptVo selectDeptById(Long deptId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID查询所有子部门(正常状态)
|
* 根据ID查询所有子部门(正常状态)
|
||||||
@ -75,21 +71,13 @@ public interface ISysDeptService
|
|||||||
*/
|
*/
|
||||||
boolean hasChildByDeptId(Long deptId);
|
boolean hasChildByDeptId(Long deptId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询部门是否存在用户
|
|
||||||
*
|
|
||||||
* @param deptId 部门ID
|
|
||||||
* @return 结果 true 存在 false 不存在
|
|
||||||
*/
|
|
||||||
boolean checkDeptExistUser(Long deptId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验部门名称是否唯一
|
* 校验部门名称是否唯一
|
||||||
*
|
*
|
||||||
* @param dept 部门信息
|
* @param dept 部门信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
boolean checkDeptNameUnique(SysDept dept);
|
boolean checkDeptNameUnique(SysDeptBo dept);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验部门是否有数据权限
|
* 校验部门是否有数据权限
|
||||||
@ -101,10 +89,10 @@ public interface ISysDeptService
|
|||||||
/**
|
/**
|
||||||
* 新增保存部门信息
|
* 新增保存部门信息
|
||||||
*
|
*
|
||||||
* @param dept 部门信息
|
* @param deptBo 部门信息
|
||||||
* @return 结果
|
* @return 受影响的行数
|
||||||
*/
|
*/
|
||||||
int insertDept(SysDept dept);
|
int insertDept(SysDeptBo deptBo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改保存部门信息
|
* 修改保存部门信息
|
||||||
@ -112,7 +100,7 @@ public interface ISysDeptService
|
|||||||
* @param dept 部门信息
|
* @param dept 部门信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int updateDept(SysDept dept);
|
boolean updateDept(SysDeptBo dept);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除部门管理信息
|
* 删除部门管理信息
|
||||||
@ -120,5 +108,5 @@ public interface ISysDeptService
|
|||||||
* @param deptId 部门ID
|
* @param deptId 部门ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int deleteDeptById(Long deptId);
|
boolean deleteDeptById(Long deptId);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.ruoyi.system.service;
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
|
import com.ruoyi.common.orm.core.service.IBaseService;
|
||||||
import com.ruoyi.system.domain.SysUser;
|
import com.ruoyi.system.domain.SysUser;
|
||||||
import com.ruoyi.system.domain.bo.SysUserBo;
|
import com.ruoyi.system.domain.bo.SysUserBo;
|
||||||
import com.ruoyi.system.domain.vo.SysUserVo;
|
import com.ruoyi.system.domain.vo.SysUserVo;
|
||||||
@ -11,7 +12,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface ISysUserService
|
public interface ISysUserService extends IBaseService<SysUser>
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 根据条件分页查询用户列表
|
* 根据条件分页查询用户列表
|
||||||
@ -107,6 +108,14 @@ public interface ISysUserService
|
|||||||
*/
|
*/
|
||||||
void checkUserDataScope(Long userId);
|
void checkUserDataScope(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部门是否存在用户
|
||||||
|
*
|
||||||
|
* @param deptId 部门ID
|
||||||
|
* @return 结果 true 存在 false 不存在
|
||||||
|
*/
|
||||||
|
boolean checkDeptExistUser(Long deptId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增用户信息
|
* 新增用户信息
|
||||||
*
|
*
|
||||||
|
@ -5,17 +5,31 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.lang.tree.Tree;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.mybatisflex.core.query.QueryMethods;
|
||||||
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
|
import com.mybatisflex.core.update.UpdateChain;
|
||||||
|
import com.ruoyi.common.core.constant.CacheNames;
|
||||||
|
import com.ruoyi.common.core.core.page.PageDomain;
|
||||||
|
import com.ruoyi.common.core.core.page.TableSupport;
|
||||||
import com.ruoyi.common.core.service.DeptService;
|
import com.ruoyi.common.core.service.DeptService;
|
||||||
|
import com.ruoyi.common.core.utils.MapstructUtils;
|
||||||
|
import com.ruoyi.common.core.utils.TreeBuildUtils;
|
||||||
|
import com.ruoyi.common.core.utils.sql.SqlUtil;
|
||||||
|
import com.ruoyi.common.orm.core.service.impl.BaseServiceImpl;
|
||||||
import com.ruoyi.common.security.utils.LoginHelper;
|
import com.ruoyi.common.security.utils.LoginHelper;
|
||||||
import com.ruoyi.system.domain.SysDept;
|
import com.ruoyi.system.domain.*;
|
||||||
import com.ruoyi.system.domain.SysRole;
|
import com.ruoyi.system.domain.bo.SysDeptBo;
|
||||||
|
import com.ruoyi.system.domain.vo.SysDeptVo;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.common.core.annotation.DataScope;
|
import com.ruoyi.common.core.annotation.DataScope;
|
||||||
import com.ruoyi.common.core.constant.UserConstants;
|
import com.ruoyi.common.core.constant.UserConstants;
|
||||||
import com.ruoyi.system.domain.TreeSelect;
|
|
||||||
import com.ruoyi.common.core.core.text.Convert;
|
import com.ruoyi.common.core.core.text.Convert;
|
||||||
import com.ruoyi.common.core.exception.ServiceException;
|
import com.ruoyi.common.core.exception.ServiceException;
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
@ -23,6 +37,9 @@ import com.ruoyi.common.core.utils.SpringUtils;
|
|||||||
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.service.ISysDeptService;
|
import com.ruoyi.system.service.ISysDeptService;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import static com.ruoyi.system.domain.table.SysDeptTableDef.SYS_DEPT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门管理 服务实现
|
* 部门管理 服务实现
|
||||||
@ -31,25 +48,57 @@ import com.ruoyi.system.service.ISysDeptService;
|
|||||||
*/
|
*/
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Service
|
@Service
|
||||||
public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptMapper, SysDept> implements ISysDeptService, DeptService {
|
||||||
@Resource
|
@Resource
|
||||||
private SysDeptMapper deptMapper;
|
private SysDeptMapper deptMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private SysRoleMapper roleMapper;
|
private SysRoleMapper roleMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public QueryWrapper query() {
|
||||||
|
return super.query().from(SYS_DEPT);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ndeptBo构建QueryWrapper查询条件
|
||||||
|
*
|
||||||
|
* @param deptBo
|
||||||
|
* @return 查询条件
|
||||||
|
*/
|
||||||
|
private QueryWrapper buildQueryWrapper(SysDeptBo deptBo) {
|
||||||
|
QueryWrapper queryWrapper = super.buildBaseQueryWrapper();
|
||||||
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||||
|
queryWrapper.where(SYS_DEPT.DEL_FLAG.eq("0"));
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotNull(deptBo.getDeptId())) {
|
||||||
|
queryWrapper.and(SYS_DEPT.DEPT_ID.eq(deptBo.getDeptId()));
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotNull(deptBo.getParentId())) {
|
||||||
|
queryWrapper.and(SYS_DEPT.PARENT_ID.eq(deptBo.getParentId()));
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(deptBo.getDeptName())) {
|
||||||
|
queryWrapper.and(SYS_DEPT.DEPT_NAME.like(deptBo.getDeptName()));
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(deptBo.getStatus())) {
|
||||||
|
queryWrapper.and(SYS_DEPT.STATUS.eq(deptBo.getStatus()));
|
||||||
|
}
|
||||||
|
queryWrapper.orderBy(SYS_DEPT.PARENT_ID.asc(),SYS_DEPT.ORDER_NUM.asc());
|
||||||
|
|
||||||
|
return queryWrapper;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询部门管理数据
|
* 查询部门管理数据
|
||||||
*
|
*
|
||||||
* @param dept 部门信息
|
* @param deptBo 部门信息
|
||||||
* @return 部门信息集合
|
* @return 部门信息集合
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@DataScope(deptAlias = "d")
|
@DataScope(deptAlias = "d")
|
||||||
public List<SysDept> selectDeptList(SysDept dept) {
|
public List<SysDeptVo> selectDeptList(SysDeptBo deptBo) {
|
||||||
// 只查询未禁用部门
|
QueryWrapper queryWrapper = buildQueryWrapper(deptBo);
|
||||||
//dept.setStatus(UserConstants.DEPT_NORMAL);
|
return this.listAs(queryWrapper, SysDeptVo.class);
|
||||||
return deptMapper.selectDeptList(dept);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,36 +108,13 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
* @return 部门树信息集合
|
* @return 部门树信息集合
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<TreeSelect> selectDeptTreeList(SysDept dept) {
|
public List<Tree<Long>> selectDeptTreeList(SysDeptBo dept) {
|
||||||
// 只查询未禁用部门
|
// 只查询未禁用部门
|
||||||
dept.setStatus(UserConstants.DEPT_NORMAL);
|
dept.setStatus(UserConstants.DEPT_NORMAL);
|
||||||
List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
|
List<SysDeptVo> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
|
||||||
return buildDeptTreeSelect(depts);
|
return buildDeptTreeSelect(depts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建前端所需要树结构
|
|
||||||
*
|
|
||||||
* @param depts 部门列表
|
|
||||||
* @return 树结构列表
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<SysDept> buildDeptTree(List<SysDept> depts) {
|
|
||||||
List<SysDept> returnList = new ArrayList<>();
|
|
||||||
List<Long> tempList = depts.stream().map(SysDept::getDeptId).collect(Collectors.toList());
|
|
||||||
for (SysDept dept : depts) {
|
|
||||||
// 如果是顶级节点, 遍历该父节点的所有子节点
|
|
||||||
if (!tempList.contains(dept.getParentId())) {
|
|
||||||
recursionFn(depts, dept);
|
|
||||||
returnList.add(dept);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (returnList.isEmpty()) {
|
|
||||||
returnList = depts;
|
|
||||||
}
|
|
||||||
return returnList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建前端所需要下拉树结构
|
* 构建前端所需要下拉树结构
|
||||||
*
|
*
|
||||||
@ -96,9 +122,15 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
* @return 下拉树结构列表
|
* @return 下拉树结构列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts) {
|
public List<Tree<Long>> buildDeptTreeSelect(List<SysDeptVo> depts) {
|
||||||
List<SysDept> deptTrees = buildDeptTree(depts);
|
if (CollUtil.isEmpty(depts)) {
|
||||||
return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
|
return CollUtil.newArrayList();
|
||||||
|
}
|
||||||
|
return TreeBuildUtils.build(depts, (dept, tree) ->
|
||||||
|
tree.setId(dept.getDeptId())
|
||||||
|
.setParentId(dept.getParentId())
|
||||||
|
.setName(dept.getDeptName())
|
||||||
|
.setWeight(dept.getOrderNum()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -119,9 +151,12 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
* @param deptId 部门ID
|
* @param deptId 部门ID
|
||||||
* @return 部门信息
|
* @return 部门信息
|
||||||
*/
|
*/
|
||||||
|
@Cacheable(cacheNames = CacheNames.SYS_DEPT, key = "#deptId")
|
||||||
@Override
|
@Override
|
||||||
public SysDept selectDeptById(Long deptId) {
|
public SysDeptVo selectDeptById(Long deptId) {
|
||||||
return deptMapper.selectDeptById(deptId);
|
QueryWrapper queryWrapper = query().where(SYS_DEPT.DEL_FLAG.eq("0"));
|
||||||
|
queryWrapper.and(SYS_DEPT.DEPT_ID.eq(deptId));
|
||||||
|
return this.getOneAs(queryWrapper, SysDeptVo.class);//TODO:缺少parent_name
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -132,7 +167,15 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int selectNormalChildrenDeptById(Long deptId) {
|
public int selectNormalChildrenDeptById(Long deptId) {
|
||||||
return deptMapper.selectNormalChildrenDeptById(deptId);
|
// return deptMapper.selectNormalChildrenDeptById(deptId);
|
||||||
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||||
|
.select(QueryMethods.count(SYS_DEPT.DEPT_ID))
|
||||||
|
.from(SYS_DEPT)
|
||||||
|
.where(SYS_DEPT.STATUS.eq("0"))
|
||||||
|
.and(SYS_DEPT.DEL_FLAG.eq("0"))
|
||||||
|
.and(QueryMethods.findInSet(QueryMethods.number(deptId),SYS_DEPT.ANCESTORS).gt(0));
|
||||||
|
|
||||||
|
return deptMapper.selectObjectByQueryAs(queryWrapper,Integer.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -143,21 +186,16 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean hasChildByDeptId(Long deptId) {
|
public boolean hasChildByDeptId(Long deptId) {
|
||||||
int result = deptMapper.hasChildByDeptId(deptId);
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||||
|
.select(QueryMethods.count(SYS_DEPT.DEPT_ID))
|
||||||
|
.from(SYS_DEPT)
|
||||||
|
.where(SYS_DEPT.DEL_FLAG.eq("0"))
|
||||||
|
.and(SYS_DEPT.PARENT_ID.eq(deptId));
|
||||||
|
|
||||||
|
int result = deptMapper.selectObjectByQueryAs(queryWrapper,Integer.class);
|
||||||
return result > 0;
|
return result > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询部门是否存在用户
|
|
||||||
*
|
|
||||||
* @param deptId 部门ID
|
|
||||||
* @return 结果 true 存在 false 不存在
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean checkDeptExistUser(Long deptId) {
|
|
||||||
int result = deptMapper.checkDeptExistUser(deptId);
|
|
||||||
return result > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验部门名称是否唯一
|
* 校验部门名称是否唯一
|
||||||
@ -166,9 +204,14 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkDeptNameUnique(SysDept dept) {
|
public boolean checkDeptNameUnique(SysDeptBo dept) {
|
||||||
Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
|
Long deptId = ObjectUtil.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
|
||||||
SysDept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId());
|
|
||||||
|
QueryWrapper queryWrapper = query().where(SYS_DEPT.DEL_FLAG.eq("0"));
|
||||||
|
queryWrapper.and(SYS_DEPT.DEPT_NAME.eq(dept.getDeptName()));
|
||||||
|
queryWrapper.and(SYS_DEPT.PARENT_ID.eq(dept.getParentId()));
|
||||||
|
SysDeptVo info = this.getOneAs(queryWrapper, SysDeptVo.class);
|
||||||
|
|
||||||
if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue()) {
|
if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue()) {
|
||||||
return UserConstants.NOT_UNIQUE;
|
return UserConstants.NOT_UNIQUE;
|
||||||
}
|
}
|
||||||
@ -189,9 +232,9 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SysDept dept = new SysDept();
|
SysDeptBo dept = new SysDeptBo();
|
||||||
dept.setDeptId(deptId);
|
dept.setDeptId(deptId);
|
||||||
List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
|
List<SysDeptVo> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
|
||||||
if (ObjectUtil.isNull(depts)) {
|
if (ObjectUtil.isNull(depts)) {
|
||||||
throw new ServiceException("没有权限访问部门数据!");
|
throw new ServiceException("没有权限访问部门数据!");
|
||||||
}
|
}
|
||||||
@ -200,37 +243,42 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
/**
|
/**
|
||||||
* 新增保存部门信息
|
* 新增保存部门信息
|
||||||
*
|
*
|
||||||
* @param dept 部门信息
|
* @param deptBo 部门信息
|
||||||
* @return 结果
|
* @return 受影响的行数
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertDept(SysDept dept) {
|
public int insertDept(SysDeptBo deptBo) {
|
||||||
SysDept info = deptMapper.selectDeptById(dept.getParentId());
|
SysDeptVo info = selectDeptById(deptBo.getParentId());
|
||||||
// 如果父节点不为正常状态,则不允许新增子节点
|
// 如果父节点不为正常状态,则不允许新增子节点
|
||||||
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {
|
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {
|
||||||
throw new ServiceException("部门停用,不允许新增");
|
throw new ServiceException("部门停用,不允许新增");
|
||||||
}
|
}
|
||||||
|
SysDept dept = MapstructUtils.convert(deptBo, SysDept.class);
|
||||||
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
||||||
return deptMapper.insertDept(dept);
|
dept.setDelFlag("0");//0代表存在
|
||||||
|
return deptMapper.insert(dept, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改保存部门信息
|
* 修改保存部门信息
|
||||||
*
|
*
|
||||||
* @param dept 部门信息
|
* @param deptBo 部门信息
|
||||||
* @return 结果
|
* @return 结果:true 更新成功,false 更新失败
|
||||||
*/
|
*/
|
||||||
|
@Transactional
|
||||||
|
@CacheEvict(cacheNames = CacheNames.SYS_DEPT, key = "#deptBo.deptId")
|
||||||
@Override
|
@Override
|
||||||
public int updateDept(SysDept dept) {
|
public boolean updateDept(SysDeptBo deptBo) {
|
||||||
SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId());
|
SysDept dept = MapstructUtils.convert(deptBo, SysDept.class);
|
||||||
SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId());
|
SysDeptVo newParentDept = selectDeptById(dept.getParentId());
|
||||||
|
SysDeptVo oldDept = selectDeptById(dept.getDeptId());
|
||||||
if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) {
|
if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) {
|
||||||
String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
|
String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
|
||||||
String oldAncestors = oldDept.getAncestors();
|
String oldAncestors = oldDept.getAncestors();
|
||||||
dept.setAncestors(newAncestors);
|
dept.setAncestors(newAncestors);
|
||||||
updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
|
updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
|
||||||
}
|
}
|
||||||
int result = deptMapper.updateDept(dept);
|
boolean result = this.updateById(dept);
|
||||||
if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors())
|
if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors())
|
||||||
&& !StringUtils.equals("0", dept.getAncestors())) {
|
&& !StringUtils.equals("0", dept.getAncestors())) {
|
||||||
// 如果该部门是启用状态,则启用该部门的所有上级部门
|
// 如果该部门是启用状态,则启用该部门的所有上级部门
|
||||||
@ -247,7 +295,11 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
private void updateParentDeptStatusNormal(SysDept dept) {
|
private void updateParentDeptStatusNormal(SysDept dept) {
|
||||||
String ancestors = dept.getAncestors();
|
String ancestors = dept.getAncestors();
|
||||||
Long[] deptIds = Convert.toLongArray(ancestors);
|
Long[] deptIds = Convert.toLongArray(ancestors);
|
||||||
deptMapper.updateDeptStatusNormal(deptIds);
|
|
||||||
|
UpdateChain.of(SysDept.class)
|
||||||
|
.set(SysDept::getStatus, "0")
|
||||||
|
.where(SysDept::getDeptId).in(deptIds)
|
||||||
|
.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -258,13 +310,22 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
* @param oldAncestors 旧的父ID集合
|
* @param oldAncestors 旧的父ID集合
|
||||||
*/
|
*/
|
||||||
public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors) {
|
public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors) {
|
||||||
List<SysDept> children = deptMapper.selectChildrenDeptById(deptId);
|
//select * from sys_dept where find_in_set(#{deptId}, ancestors)
|
||||||
for (SysDept child : children) {
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||||
|
.from(SYS_DEPT)
|
||||||
|
.where(QueryMethods.findInSet(QueryMethods.number(deptId),SYS_DEPT.ANCESTORS).gt(0));
|
||||||
|
|
||||||
|
List<SysDeptVo> children = this.listAs(queryWrapper, SysDeptVo.class);
|
||||||
|
|
||||||
|
for (SysDeptVo child : children) {
|
||||||
child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors));
|
child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors));
|
||||||
|
|
||||||
|
UpdateChain.of(SysDept.class)
|
||||||
|
.set(SysDept::getAncestors, child.getAncestors())
|
||||||
|
.where(SysDept::getDeptId).eq(child.getDeptId())
|
||||||
|
.update();
|
||||||
}
|
}
|
||||||
if (children.size() > 0) {
|
return;
|
||||||
deptMapper.updateDeptChildren(children);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -274,45 +335,49 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteDeptById(Long deptId) {
|
public boolean deleteDeptById(Long deptId) {
|
||||||
return deptMapper.deleteDeptById(deptId);
|
//update sys_dept set del_flag = '1' where dept_id = #{deptId}
|
||||||
|
SysDept sysDept = new SysDept();
|
||||||
|
sysDept.setDeptId(deptId);
|
||||||
|
sysDept.setDelFlag("1");
|
||||||
|
return this.updateById(sysDept);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 递归列表
|
// * 递归列表
|
||||||
*/
|
// */
|
||||||
private void recursionFn(List<SysDept> list, SysDept t) {
|
// private void recursionFn(List<SysDept> list, SysDept t) {
|
||||||
// 得到子节点列表
|
// // 得到子节点列表
|
||||||
List<SysDept> childList = getChildList(list, t);
|
// List<SysDept> childList = getChildList(list, t);
|
||||||
t.setChildren(childList);
|
// t.setChildren(childList);
|
||||||
for (SysDept tChild : childList) {
|
// for (SysDept tChild : childList) {
|
||||||
if (hasChild(list, tChild)) {
|
// if (hasChild(list, tChild)) {
|
||||||
recursionFn(list, tChild);
|
// recursionFn(list, tChild);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 得到子节点列表
|
// * 得到子节点列表
|
||||||
*/
|
// */
|
||||||
private List<SysDept> getChildList(List<SysDept> list, SysDept t) {
|
// private List<SysDept> getChildList(List<SysDept> list, SysDept t) {
|
||||||
List<SysDept> tlist = new ArrayList<>();
|
// List<SysDept> tlist = new ArrayList<>();
|
||||||
Iterator<SysDept> it = list.iterator();
|
// Iterator<SysDept> it = list.iterator();
|
||||||
while (it.hasNext()) {
|
// while (it.hasNext()) {
|
||||||
SysDept n = (SysDept) it.next();
|
// SysDept n = (SysDept) it.next();
|
||||||
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue()) {
|
// if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue()) {
|
||||||
tlist.add(n);
|
// tlist.add(n);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return tlist;
|
// return tlist;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 判断是否有子节点
|
// * 判断是否有子节点
|
||||||
*/
|
// */
|
||||||
private boolean hasChild(List<SysDept> list, SysDept t) {
|
// private boolean hasChild(List<SysDept> list, SysDept t) {
|
||||||
return getChildList(list, t).size() > 0;
|
// return getChildList(list, t).size() > 0;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过部门ID查询部门名称
|
* 通过部门ID查询部门名称
|
||||||
@ -324,7 +389,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||||||
public String selectDeptNameByIds(String deptIds) {
|
public String selectDeptNameByIds(String deptIds) {
|
||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
for (Long id : StringUtils.splitTo(deptIds, Convert::toLong)) {
|
for (Long id : StringUtils.splitTo(deptIds, Convert::toLong)) {
|
||||||
SysDept dept = SpringUtils.getAopProxy(this).selectDeptById(id);
|
SysDeptVo dept = SpringUtils.getAopProxy(this).selectDeptById(id);
|
||||||
if (ObjectUtil.isNotNull(dept)) {
|
if (ObjectUtil.isNotNull(dept)) {
|
||||||
list.add(dept.getDeptName());
|
list.add(dept.getDeptName());
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.ruoyi.system.service.impl;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import com.ruoyi.common.core.core.page.PageDomain;
|
import com.ruoyi.common.core.core.page.PageDomain;
|
||||||
@ -65,7 +66,7 @@ public class SysNoticeServiceImpl extends BaseServiceImpl<SysNoticeMapper, SysNo
|
|||||||
if (StringUtils.isNotEmpty(noticeBo.getNoticeType())) {
|
if (StringUtils.isNotEmpty(noticeBo.getNoticeType())) {
|
||||||
queryWrapper.and(SYS_NOTICE.NOTICE_TYPE.eq(noticeBo.getNoticeType()));
|
queryWrapper.and(SYS_NOTICE.NOTICE_TYPE.eq(noticeBo.getNoticeType()));
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotNull(noticeBo.getCreateBy())) {
|
if (ObjectUtil.isNotNull(noticeBo.getCreateBy())) {
|
||||||
queryWrapper.and(SYS_NOTICE.CREATE_BY.like(noticeBo.getCreateBy()));
|
queryWrapper.and(SYS_NOTICE.CREATE_BY.like(noticeBo.getCreateBy()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,12 +6,16 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import cn.dev33.satoken.secure.BCrypt;
|
import cn.dev33.satoken.secure.BCrypt;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.mybatisflex.core.query.QueryMethods;
|
||||||
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import com.ruoyi.common.core.constant.CacheNames;
|
import com.ruoyi.common.core.constant.CacheNames;
|
||||||
import com.ruoyi.common.core.service.UserService;
|
import com.ruoyi.common.core.service.UserService;
|
||||||
import com.ruoyi.common.core.utils.MapstructUtils;
|
import com.ruoyi.common.core.utils.MapstructUtils;
|
||||||
|
import com.ruoyi.common.orm.core.service.impl.BaseServiceImpl;
|
||||||
import com.ruoyi.common.security.utils.LoginHelper;
|
import com.ruoyi.common.security.utils.LoginHelper;
|
||||||
import com.ruoyi.system.domain.*;
|
import com.ruoyi.system.domain.*;
|
||||||
import com.ruoyi.system.domain.bo.SysUserBo;
|
import com.ruoyi.system.domain.bo.SysUserBo;
|
||||||
|
import com.ruoyi.system.mapper.*;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.validation.Validator;
|
import jakarta.validation.Validator;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -26,21 +30,19 @@ import com.ruoyi.common.core.exception.ServiceException;
|
|||||||
import com.ruoyi.common.core.utils.StringUtils;
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
import com.ruoyi.common.core.utils.bean.BeanValidators;
|
import com.ruoyi.common.core.utils.bean.BeanValidators;
|
||||||
import com.ruoyi.common.core.utils.SpringUtils;
|
import com.ruoyi.common.core.utils.SpringUtils;
|
||||||
import com.ruoyi.system.mapper.SysPostMapper;
|
|
||||||
import com.ruoyi.system.mapper.SysRoleMapper;
|
|
||||||
import com.ruoyi.system.mapper.SysUserMapper;
|
|
||||||
import com.ruoyi.system.mapper.SysUserPostMapper;
|
|
||||||
import com.ruoyi.system.mapper.SysUserRoleMapper;
|
|
||||||
import com.ruoyi.system.service.ISysConfigService;
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
import com.ruoyi.system.service.ISysUserService;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
|
||||||
|
import static com.ruoyi.system.domain.table.SysDeptTableDef.SYS_DEPT;
|
||||||
|
import static com.ruoyi.system.domain.table.SysUserTableDef.SYS_USER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户 业务层处理
|
* 用户 业务层处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SysUserServiceImpl implements ISysUserService, UserService {
|
public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser> implements ISysUserService, UserService {
|
||||||
private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
|
private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@ -234,6 +236,24 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部门是否存在用户
|
||||||
|
*
|
||||||
|
* @param deptId 部门ID
|
||||||
|
* @return 结果 true 存在 false 不存在
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean checkDeptExistUser(Long deptId) {
|
||||||
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||||
|
.select(QueryMethods.count(SYS_USER.USER_ID))
|
||||||
|
.from(SYS_USER)
|
||||||
|
.where(SYS_USER.DEPT_ID.eq(deptId))
|
||||||
|
.and(SYS_USER.DEL_FLAG.eq("0"));
|
||||||
|
|
||||||
|
int result = userMapper.selectObjectByQueryAs(queryWrapper,Integer.class);
|
||||||
|
return result > 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增保存用户信息
|
* 新增保存用户信息
|
||||||
*
|
*
|
||||||
|
@ -21,32 +21,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectDeptVo">
|
<sql id="selectDeptVo">
|
||||||
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
|
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
|
||||||
from sys_dept d
|
from sys_dept d
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
|
<!-- <select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">-->
|
||||||
<include refid="selectDeptVo"/>
|
<!-- <include refid="selectDeptVo"/>-->
|
||||||
where d.del_flag = '0'
|
<!-- where d.del_flag = '0'-->
|
||||||
<if test="deptId != null and deptId != 0">
|
<!-- <if test="deptId != null and deptId != 0">-->
|
||||||
AND dept_id = #{deptId}
|
<!-- AND dept_id = #{deptId}-->
|
||||||
</if>
|
<!-- </if>-->
|
||||||
<if test="parentId != null and parentId != 0">
|
<!-- <if test="parentId != null and parentId != 0">-->
|
||||||
AND parent_id = #{parentId}
|
<!-- AND parent_id = #{parentId}-->
|
||||||
</if>
|
<!-- </if>-->
|
||||||
<if test="deptName != null and deptName != ''">
|
<!-- <if test="deptName != null and deptName != ''">-->
|
||||||
AND dept_name like concat('%', #{deptName}, '%')
|
<!-- AND dept_name like concat('%', #{deptName}, '%')-->
|
||||||
</if>
|
<!-- </if>-->
|
||||||
<if test="status != null and status != ''">
|
<!-- <if test="status != null and status != ''">-->
|
||||||
AND status = #{status}
|
<!-- AND status = #{status}-->
|
||||||
</if>
|
<!-- </if>-->
|
||||||
<!-- 数据范围过滤 -->
|
<!-- <!– 数据范围过滤 –>-->
|
||||||
${params.dataScope}
|
<!-- ${params.dataScope}-->
|
||||||
order by d.parent_id, d.order_num
|
<!-- order by d.parent_id, d.order_num-->
|
||||||
</select>
|
<!-- </select>-->
|
||||||
|
|
||||||
<select id="selectDeptListByRoleId" resultType="Long">
|
<select id="selectDeptListByRoleId" resultType="Long">
|
||||||
select d.dept_id
|
select d.dept_id
|
||||||
from sys_dept d
|
from sys_dept d
|
||||||
@ -57,103 +57,103 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</if>
|
</if>
|
||||||
order by d.parent_id, d.order_num
|
order by d.parent_id, d.order_num
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
|
|
||||||
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,
|
|
||||||
(select dept_name from sys_dept where dept_id = d.parent_id) parent_name
|
|
||||||
from sys_dept d
|
|
||||||
where d.dept_id = #{deptId}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
|
|
||||||
select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="hasChildByDeptId" parameterType="Long" resultType="int">
|
|
||||||
select count(1) from sys_dept
|
|
||||||
where del_flag = '0' and parent_id = #{deptId} limit 1
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
|
|
||||||
select * from sys_dept where find_in_set(#{deptId}, ancestors)
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
|
|
||||||
select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="checkDeptNameUnique" resultMap="SysDeptResult">
|
|
||||||
<include refid="selectDeptVo"/>
|
|
||||||
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<insert id="insertDept" parameterType="SysDept">
|
|
||||||
insert into sys_dept(
|
|
||||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
|
||||||
<if test="parentId != null and parentId != 0">parent_id,</if>
|
|
||||||
<if test="deptName != null and deptName != ''">dept_name,</if>
|
|
||||||
<if test="ancestors != null and ancestors != ''">ancestors,</if>
|
|
||||||
<if test="orderNum != null">order_num,</if>
|
|
||||||
<if test="leader != null and leader != ''">leader,</if>
|
|
||||||
<if test="phone != null and phone != ''">phone,</if>
|
|
||||||
<if test="email != null and email != ''">email,</if>
|
|
||||||
<if test="status != null">status,</if>
|
|
||||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
||||||
create_time
|
|
||||||
)values(
|
|
||||||
<if test="deptId != null and deptId != 0">#{deptId},</if>
|
|
||||||
<if test="parentId != null and parentId != 0">#{parentId},</if>
|
|
||||||
<if test="deptName != null and deptName != ''">#{deptName},</if>
|
|
||||||
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
|
|
||||||
<if test="orderNum != null">#{orderNum},</if>
|
|
||||||
<if test="leader != null and leader != ''">#{leader},</if>
|
|
||||||
<if test="phone != null and phone != ''">#{phone},</if>
|
|
||||||
<if test="email != null and email != ''">#{email},</if>
|
|
||||||
<if test="status != null">#{status},</if>
|
|
||||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
||||||
sysdate()
|
|
||||||
)
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<update id="updateDept" parameterType="SysDept">
|
|
||||||
update sys_dept
|
|
||||||
<set>
|
|
||||||
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
|
|
||||||
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
|
|
||||||
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
|
|
||||||
<if test="orderNum != null">order_num = #{orderNum},</if>
|
|
||||||
<if test="leader != null">leader = #{leader},</if>
|
|
||||||
<if test="phone != null">phone = #{phone},</if>
|
|
||||||
<if test="email != null">email = #{email},</if>
|
|
||||||
<if test="status != null and status != ''">status = #{status},</if>
|
|
||||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
||||||
update_time = sysdate()
|
|
||||||
</set>
|
|
||||||
where dept_id = #{deptId}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<update id="updateDeptChildren" parameterType="java.util.List">
|
|
||||||
update sys_dept set ancestors =
|
|
||||||
<foreach collection="depts" item="item" index="index"
|
|
||||||
separator=" " open="case dept_id" close="end">
|
|
||||||
when #{item.deptId} then #{item.ancestors}
|
|
||||||
</foreach>
|
|
||||||
where dept_id in
|
|
||||||
<foreach collection="depts" item="item" index="index"
|
|
||||||
separator="," open="(" close=")">
|
|
||||||
#{item.deptId}
|
|
||||||
</foreach>
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<update id="updateDeptStatusNormal" parameterType="Long">
|
|
||||||
update sys_dept set status = '0' where dept_id in
|
|
||||||
<foreach collection="array" item="deptId" open="(" separator="," close=")">
|
|
||||||
#{deptId}
|
|
||||||
</foreach>
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<delete id="deleteDeptById" parameterType="Long">
|
|
||||||
update sys_dept set del_flag = '1' where dept_id = #{deptId}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
</mapper>
|
<!-- <select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">-->
|
||||||
|
<!-- select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,-->
|
||||||
|
<!-- (select dept_name from sys_dept where dept_id = d.parent_id) parent_name-->
|
||||||
|
<!-- from sys_dept d-->
|
||||||
|
<!-- where d.dept_id = #{deptId}-->
|
||||||
|
<!-- </select>-->
|
||||||
|
|
||||||
|
<!-- <select id="checkDeptExistUser" parameterType="Long" resultType="int">-->
|
||||||
|
<!-- select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'-->
|
||||||
|
<!-- </select>-->
|
||||||
|
|
||||||
|
<!-- <select id="hasChildByDeptId" parameterType="Long" resultType="int">-->
|
||||||
|
<!-- select count(1) from sys_dept-->
|
||||||
|
<!-- where del_flag = '0' and parent_id = #{deptId} limit 1-->
|
||||||
|
<!-- </select>-->
|
||||||
|
|
||||||
|
<!-- <select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">-->
|
||||||
|
<!-- select * from sys_dept where find_in_set(#{deptId}, ancestors)-->
|
||||||
|
<!-- </select>-->
|
||||||
|
|
||||||
|
<!-- <select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">-->
|
||||||
|
<!-- select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)-->
|
||||||
|
<!-- </select>-->
|
||||||
|
|
||||||
|
<!-- <select id="checkDeptNameUnique" resultMap="SysDeptResult">-->
|
||||||
|
<!-- <include refid="selectDeptVo"/>-->
|
||||||
|
<!-- where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1-->
|
||||||
|
<!-- </select>-->
|
||||||
|
|
||||||
|
<!-- <insert id="insertDept" parameterType="SysDept">-->
|
||||||
|
<!-- insert into sys_dept(-->
|
||||||
|
<!-- <if test="deptId != null and deptId != 0">dept_id,</if>-->
|
||||||
|
<!-- <if test="parentId != null and parentId != 0">parent_id,</if>-->
|
||||||
|
<!-- <if test="deptName != null and deptName != ''">dept_name,</if>-->
|
||||||
|
<!-- <if test="ancestors != null and ancestors != ''">ancestors,</if>-->
|
||||||
|
<!-- <if test="orderNum != null">order_num,</if>-->
|
||||||
|
<!-- <if test="leader != null and leader != ''">leader,</if>-->
|
||||||
|
<!-- <if test="phone != null and phone != ''">phone,</if>-->
|
||||||
|
<!-- <if test="email != null and email != ''">email,</if>-->
|
||||||
|
<!-- <if test="status != null">status,</if>-->
|
||||||
|
<!-- <if test="createBy != null and createBy != ''">create_by,</if>-->
|
||||||
|
<!-- create_time-->
|
||||||
|
<!-- )values(-->
|
||||||
|
<!-- <if test="deptId != null and deptId != 0">#{deptId},</if>-->
|
||||||
|
<!-- <if test="parentId != null and parentId != 0">#{parentId},</if>-->
|
||||||
|
<!-- <if test="deptName != null and deptName != ''">#{deptName},</if>-->
|
||||||
|
<!-- <if test="ancestors != null and ancestors != ''">#{ancestors},</if>-->
|
||||||
|
<!-- <if test="orderNum != null">#{orderNum},</if>-->
|
||||||
|
<!-- <if test="leader != null and leader != ''">#{leader},</if>-->
|
||||||
|
<!-- <if test="phone != null and phone != ''">#{phone},</if>-->
|
||||||
|
<!-- <if test="email != null and email != ''">#{email},</if>-->
|
||||||
|
<!-- <if test="status != null">#{status},</if>-->
|
||||||
|
<!-- <if test="createBy != null and createBy != ''">#{createBy},</if>-->
|
||||||
|
<!-- sysdate()-->
|
||||||
|
<!-- )-->
|
||||||
|
<!-- </insert>-->
|
||||||
|
|
||||||
|
<!-- <update id="updateDept" parameterType="SysDept">-->
|
||||||
|
<!-- update sys_dept-->
|
||||||
|
<!-- <set>-->
|
||||||
|
<!-- <if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>-->
|
||||||
|
<!-- <if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>-->
|
||||||
|
<!-- <if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>-->
|
||||||
|
<!-- <if test="orderNum != null">order_num = #{orderNum},</if>-->
|
||||||
|
<!-- <if test="leader != null">leader = #{leader},</if>-->
|
||||||
|
<!-- <if test="phone != null">phone = #{phone},</if>-->
|
||||||
|
<!-- <if test="email != null">email = #{email},</if>-->
|
||||||
|
<!-- <if test="status != null and status != ''">status = #{status},</if>-->
|
||||||
|
<!-- <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>-->
|
||||||
|
<!-- update_time = sysdate()-->
|
||||||
|
<!-- </set>-->
|
||||||
|
<!-- where dept_id = #{deptId}-->
|
||||||
|
<!-- </update>-->
|
||||||
|
|
||||||
|
<!-- <update id="updateDeptChildren" parameterType="java.util.List">-->
|
||||||
|
<!-- update sys_dept set ancestors =-->
|
||||||
|
<!-- <foreach collection="depts" item="item" index="index"-->
|
||||||
|
<!-- separator=" " open="case dept_id" close="end">-->
|
||||||
|
<!-- when #{item.deptId} then #{item.ancestors}-->
|
||||||
|
<!-- </foreach>-->
|
||||||
|
<!-- where dept_id in-->
|
||||||
|
<!-- <foreach collection="depts" item="item" index="index"-->
|
||||||
|
<!-- separator="," open="(" close=")">-->
|
||||||
|
<!-- #{item.deptId}-->
|
||||||
|
<!-- </foreach>-->
|
||||||
|
<!-- </update>-->
|
||||||
|
|
||||||
|
<!-- <update id="updateDeptStatusNormal" parameterType="Long">-->
|
||||||
|
<!-- update sys_dept set status = '0' where dept_id in-->
|
||||||
|
<!-- <foreach collection="array" item="deptId" open="(" separator="," close=")">-->
|
||||||
|
<!-- #{deptId}-->
|
||||||
|
<!-- </foreach>-->
|
||||||
|
<!-- </update>-->
|
||||||
|
|
||||||
|
<!-- <delete id="deleteDeptById" parameterType="Long">-->
|
||||||
|
<!-- update sys_dept set del_flag = '1' where dept_id = #{deptId}-->
|
||||||
|
<!-- </delete>-->
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
@ -13,7 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="userType" column="user_type" />
|
<result property="userType" column="user_type" />
|
||||||
<result property="email" column="email" />
|
<result property="email" column="email" />
|
||||||
<result property="phonenumber" column="phonenumber" />
|
<result property="phonenumber" column="phonenumber" />
|
||||||
<result property="sex" column="sex" />
|
<result property="gender" column="gender" />
|
||||||
<result property="avatar" column="avatar" />
|
<result property="avatar" column="avatar" />
|
||||||
<result property="password" column="password" />
|
<result property="password" column="password" />
|
||||||
<result property="status" column="status" />
|
<result property="status" column="status" />
|
||||||
@ -49,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectUserVo">
|
<sql id="selectUserVo">
|
||||||
select u.user_id, u.tenant_id,u.dept_id, u.user_name, u.nick_name, u.user_type, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
|
select u.user_id, u.tenant_id,u.dept_id, u.user_name, u.nick_name, u.user_type, u.email, u.avatar, u.phonenumber, u.password, u.gender, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
|
||||||
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
|
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
|
||||||
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
|
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
|
||||||
from sys_user u
|
from sys_user u
|
||||||
@ -59,7 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
|
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
|
||||||
select u.user_id, u.tenant_id, u.dept_id, u.nick_name, u.user_name, u.user_type, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
|
select u.user_id, u.tenant_id, u.dept_id, u.nick_name, u.user_name, u.user_type, u.email, u.avatar, u.phonenumber, u.gender, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
|
||||||
left join sys_dept d on u.dept_id = d.dept_id
|
left join sys_dept d on u.dept_id = d.dept_id
|
||||||
where u.del_flag = '0'
|
where u.del_flag = '0'
|
||||||
<if test="userId != null and userId != 0">
|
<if test="userId != null and userId != 0">
|
||||||
@ -157,7 +157,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="email != null and email != ''">email,</if>
|
<if test="email != null and email != ''">email,</if>
|
||||||
<if test="avatar != null and avatar != ''">avatar,</if>
|
<if test="avatar != null and avatar != ''">avatar,</if>
|
||||||
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
|
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
|
||||||
<if test="sex != null and sex != ''">sex,</if>
|
<if test="gender != null and gender != ''">gender,</if>
|
||||||
<if test="password != null and password != ''">password,</if>
|
<if test="password != null and password != ''">password,</if>
|
||||||
<if test="status != null and status != ''">status,</if>
|
<if test="status != null and status != ''">status,</if>
|
||||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
@ -171,7 +171,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="email != null and email != ''">#{email},</if>
|
<if test="email != null and email != ''">#{email},</if>
|
||||||
<if test="avatar != null and avatar != ''">#{avatar},</if>
|
<if test="avatar != null and avatar != ''">#{avatar},</if>
|
||||||
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
|
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
|
||||||
<if test="sex != null and sex != ''">#{sex},</if>
|
<if test="gender != null and gender != ''">#{gender},</if>
|
||||||
<if test="password != null and password != ''">#{password},</if>
|
<if test="password != null and password != ''">#{password},</if>
|
||||||
<if test="status != null and status != ''">#{status},</if>
|
<if test="status != null and status != ''">#{status},</if>
|
||||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
@ -188,7 +188,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
|
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
|
||||||
<if test="email != null ">email = #{email},</if>
|
<if test="email != null ">email = #{email},</if>
|
||||||
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
|
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
|
||||||
<if test="sex != null and sex != ''">sex = #{sex},</if>
|
<if test="gender != null and gender != ''">gender = #{gender},</if>
|
||||||
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
|
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
|
||||||
<if test="password != null and password != ''">password = #{password},</if>
|
<if test="password != null and password != ''">password = #{password},</if>
|
||||||
<if test="status != null and status != ''">status = #{status},</if>
|
<if test="status != null and status != ''">status = #{status},</if>
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<el-form-item label="客户性别" prop="sex">
|
<el-form-item label="客户性别" prop="sex">
|
||||||
<el-select v-model="queryParams.sex" placeholder="请选择客户性别" clearable>
|
<el-select v-model="queryParams.sex" placeholder="请选择客户性别" clearable>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in sys_user_sex"
|
v-for="dict in sys_user_gender"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
:label="dict.label"
|
:label="dict.label"
|
||||||
:value="dict.value"
|
:value="dict.value"
|
||||||
@ -91,7 +91,7 @@
|
|||||||
<el-table-column label="手机号码" align="center" prop="phonenumber" />
|
<el-table-column label="手机号码" align="center" prop="phonenumber" />
|
||||||
<el-table-column label="客户性别" align="center" prop="sex">
|
<el-table-column label="客户性别" align="center" prop="sex">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :options="sys_user_sex" :value="scope.row.sex"/>
|
<dict-tag :options="sys_user_gender" :value="scope.row.sex"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="客户生日" align="center" prop="birthday" width="180">
|
<el-table-column label="客户生日" align="center" prop="birthday" width="180">
|
||||||
@ -138,7 +138,7 @@
|
|||||||
<el-form-item label="客户性别" prop="sex">
|
<el-form-item label="客户性别" prop="sex">
|
||||||
<el-select v-model="form.sex" placeholder="请选择客户性别">
|
<el-select v-model="form.sex" placeholder="请选择客户性别">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in sys_user_sex"
|
v-for="dict in sys_user_gender"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
:label="dict.label"
|
:label="dict.label"
|
||||||
:value="dict.value"
|
:value="dict.value"
|
||||||
@ -216,7 +216,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { listCustomer, getCustomer, delCustomer, addCustomer, updateCustomer } from "@/api/demo/customer";
|
import { listCustomer, getCustomer, delCustomer, addCustomer, updateCustomer } from "@/api/demo/customer";
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const {sys_goods_type, sys_user_sex } = proxy.useDict('sys_goods_type', 'sys_user_sex');
|
const {sys_goods_type, sys_user_gender } = proxy.useDict('sys_goods_type', 'sys_user_gender');
|
||||||
|
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="性别" align="center" prop="studentSex">
|
<el-table-column label="性别" align="center" prop="studentSex">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :options="sys_user_sex" :value="scope.row.studentSex"/>
|
<dict-tag :options="sys_user_gender" :value="scope.row.studentSex"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="状态" align="center" prop="studentStatus">
|
<el-table-column label="状态" align="center" prop="studentStatus">
|
||||||
@ -138,7 +138,7 @@
|
|||||||
<el-form-item label="性别" prop="studentSex">
|
<el-form-item label="性别" prop="studentSex">
|
||||||
<el-select v-model="form.studentSex" placeholder="请选择性别">
|
<el-select v-model="form.studentSex" placeholder="请选择性别">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in sys_user_sex"
|
v-for="dict in sys_user_gender"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
:label="dict.label"
|
:label="dict.label"
|
||||||
:value="dict.value"
|
:value="dict.value"
|
||||||
@ -179,7 +179,7 @@ import { listStudent, getStudent, delStudent, addStudent, updateStudent } from "
|
|||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const { sys_student_hobby, sys_user_sex, sys_student_status } = proxy.useDict("sys_student_hobby", "sys_user_sex","sys_student_status");
|
const { sys_student_hobby, sys_user_gender, sys_student_status } = proxy.useDict("sys_student_hobby", "sys_user_gender","sys_student_status");
|
||||||
|
|
||||||
|
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
|
@ -249,7 +249,7 @@
|
|||||||
<el-form-item label="用户性别">
|
<el-form-item label="用户性别">
|
||||||
<el-select v-model="form.sex" placeholder="请选择">
|
<el-select v-model="form.sex" placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in sys_user_sex"
|
v-for="dict in sys_user_gender"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
:label="dict.label"
|
:label="dict.label"
|
||||||
:value="dict.value"
|
:value="dict.value"
|
||||||
@ -355,7 +355,7 @@ import { getToken } from "@/utils/auth";
|
|||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const { sys_normal_disable, sys_user_sex } = proxy.useDict("sys_normal_disable", "sys_user_sex");
|
const { sys_normal_disable, sys_user_gender } = proxy.useDict("sys_normal_disable", "sys_user_gender");
|
||||||
|
|
||||||
const userList = ref([]);
|
const userList = ref([]);
|
||||||
const open = ref(false);
|
const open = ref(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user