部门相关代码提交
This commit is contained in:
@@ -82,7 +82,9 @@ public enum UserResponseEnum {
|
|||||||
|
|
||||||
DEPT_NAME_REPEAT("A0116","部门名称重复"),
|
DEPT_NAME_REPEAT("A0116","部门名称重复"),
|
||||||
|
|
||||||
ROLE_NAME_REPEAT("A0117","角色名称重复");
|
ROLE_NAME_REPEAT("A0117","角色名称重复"),
|
||||||
|
DEPT_PID_EXCEPTION("A0118","新增部门父节点信息异常"),
|
||||||
|
;
|
||||||
|
|
||||||
private final String code;
|
private final String code;
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ public class DeptParam {
|
|||||||
@Pattern(regexp = PatternRegex.DEPT_NAME_REGEX, message = ValidMessage.NAME_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.DEPT_NAME_REGEX, message = ValidMessage.NAME_FORMAT_ERROR)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty("部门编号")
|
||||||
|
private String code;
|
||||||
|
|
||||||
@ApiModelProperty("排序")
|
@ApiModelProperty("排序")
|
||||||
@NotNull(message = ValidMessage.SORT_NOT_NULL)
|
@NotNull(message = ValidMessage.SORT_NOT_NULL)
|
||||||
@Min(value = 0, message = ValidMessage.SORT_FORMAT_ERROR)
|
@Min(value = 0, message = ValidMessage.SORT_FORMAT_ERROR)
|
||||||
@@ -39,6 +42,7 @@ public class DeptParam {
|
|||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
||||||
@ApiModelProperty("部门类型 0-非自定义;1-web自定义;2-App自定义")
|
@ApiModelProperty("部门类型 0-非自定义;1-web自定义;2-App自定义")
|
||||||
|
@NotNull(message = "部门类型不能为空")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
@ApiModelProperty("描述")
|
@ApiModelProperty("描述")
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.user.pojo.po;
|
package com.njcn.user.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.njcn.db.bo.BaseEntity;
|
import com.njcn.db.bo.BaseEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -37,6 +38,12 @@ public class Dept extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门编号
|
||||||
|
*/
|
||||||
|
@TableField(exist=false)
|
||||||
|
private String code;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (sys_Area)行政区域Id,自定义部门无需填写部门
|
* (sys_Area)行政区域Id,自定义部门无需填写部门
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ import java.util.List;
|
|||||||
@Data
|
@Data
|
||||||
public class DeptTreeVO extends BaseVO {
|
public class DeptTreeVO extends BaseVO {
|
||||||
|
|
||||||
|
@ApiModelProperty("部门编号")
|
||||||
|
private String code;
|
||||||
|
|
||||||
@ApiModelProperty("行政区域id")
|
@ApiModelProperty("行政区域id")
|
||||||
private String area;
|
private String area;
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,11 @@ public class DeptVO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门编号
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 行政区域name
|
* 行政区域name
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
SELECT sys_dept.pids pids
|
SELECT sys_dept.pids pids
|
||||||
FROM sys_dept sys_dept
|
FROM sys_dept sys_dept
|
||||||
WHERE sys_dept.id = #{id}
|
WHERE sys_dept.id = #{id}
|
||||||
|
and sys_dept.state = 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getDeptTree" resultType="DeptTreeVO">
|
<select id="getDeptTree" resultType="DeptTreeVO">
|
||||||
|
|||||||
@@ -90,13 +90,17 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
|||||||
BeanUtil.copyProperties(deptParam, dept);
|
BeanUtil.copyProperties(deptParam, dept);
|
||||||
//进行先解绑,再新增
|
//进行先解绑,再新增
|
||||||
Integer httpResult = deptLineFeignClient.removeBind(deptParam.getPid()).getData();
|
Integer httpResult = deptLineFeignClient.removeBind(deptParam.getPid()).getData();
|
||||||
System.out.println(httpResult);
|
|
||||||
if (deptParam.getPid().equals("-1")) {
|
if (deptParam.getPid().equals("-1")) {
|
||||||
//上层节点
|
//上层节点
|
||||||
dept.setPids("0");
|
dept.setPids("0");
|
||||||
} else {
|
} else {
|
||||||
String pids = "," + deptParam.getPid();
|
String pids = "," + deptParam.getPid();
|
||||||
String pid = this.baseMapper.getIdString(deptParam.getPid());
|
String pid = this.baseMapper.getIdString(deptParam.getPid());
|
||||||
|
if(StrUtil.isBlank(deptParam.getPid())){
|
||||||
|
throw new BusinessException(UserResponseEnum.DEPT_PID_EXCEPTION);
|
||||||
|
}
|
||||||
|
|
||||||
//上层节点
|
//上层节点
|
||||||
dept.setPids(pid + pids);
|
dept.setPids(pid + pids);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user