部门模块的迁移
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
### /department/create 成功
|
||||
POST {{baseUrl}}/department/create
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
Authorization: Bearer {{accessToken}}
|
||||
|
||||
name=测试部门&pid=0&sort=0
|
||||
|
||||
### /department/update 成功
|
||||
POST {{baseUrl}}/department/update
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
Authorization: Bearer {{accessToken}}
|
||||
|
||||
id=1&name=测试部门&pid=0&sort=0
|
||||
|
||||
### /resource/delete 成功
|
||||
POST {{baseUrl}}/department/delete
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
Authorization: Bearer {{accessToken}}
|
||||
|
||||
id=1
|
||||
|
||||
### /department/get 成功
|
||||
GET {{baseUrl}}/department/get?departmentId=1
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
Authorization: Bearer {{accessToken}}
|
||||
|
||||
### /department/list 成功
|
||||
GET {{baseUrl}}/department/list?departmentIds=1,13
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
Authorization: Bearer {{accessToken}}
|
||||
|
||||
### /department/tree 成功
|
||||
GET {{baseUrl}}/department/tree
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
Authorization: Bearer {{accessToken}}
|
||||
|
||||
###
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
package cn.iocoder.mall.managementweb.controller.admin;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.managementweb.controller.admin.dto.DepartmentCreateDTO;
|
||||
import cn.iocoder.mall.managementweb.controller.admin.dto.DepartmentUpdateDTO;
|
||||
import cn.iocoder.mall.managementweb.controller.admin.vo.DepartmentTreeNodeVO;
|
||||
import cn.iocoder.mall.managementweb.controller.admin.vo.DepartmentVO;
|
||||
import cn.iocoder.mall.managementweb.manager.admin.DepartmentManager;
|
||||
import cn.iocoder.security.annotations.RequiresPermissions;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* 部门 Controller
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/department")
|
||||
@Api(tags = "部门")
|
||||
@Validated
|
||||
public class DepartmentController {
|
||||
|
||||
@Autowired
|
||||
private DepartmentManager departmentManager;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("创建部门")
|
||||
@RequiresPermissions("system:department:create")
|
||||
public CommonResult<Integer> createDepartment(@Valid DepartmentCreateDTO createDTO) {
|
||||
return success(departmentManager.createDepartment(createDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("更新部门")
|
||||
@RequiresPermissions("system:department:update")
|
||||
public CommonResult<Boolean> updateDepartment(@Valid DepartmentUpdateDTO updateDTO) {
|
||||
departmentManager.updateDepartment(updateDTO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("删除部门")
|
||||
@ApiImplicitParam(name = "departmentId", value = "部门编号", required = true)
|
||||
@RequiresPermissions("system:department:delete")
|
||||
public CommonResult<Boolean> deleteDepartment(@RequestParam("departmentId") Integer departmentId) {
|
||||
departmentManager.deleteDepartment(departmentId);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获得部门")
|
||||
@ApiImplicitParam(name = "departmentId", value = "部门编号", required = true)
|
||||
@RequiresPermissions("system:department:tree")
|
||||
public CommonResult<DepartmentVO> getDepartment(@RequestParam("departmentId") Integer departmentId) {
|
||||
return success(departmentManager.getDepartment(departmentId));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("获得部门列表")
|
||||
@ApiImplicitParam(name = "departmentIds", value = "部门编号列表", required = true)
|
||||
@RequiresPermissions("system:department:tree")
|
||||
public CommonResult<List<DepartmentVO>> listDepartments(@RequestParam("departmentIds") List<Integer> departmentIds) {
|
||||
return success(departmentManager.listDepartments(departmentIds));
|
||||
}
|
||||
|
||||
@GetMapping("/tree")
|
||||
@ApiOperation("获得部门树")
|
||||
@RequiresPermissions("system:department:tree")
|
||||
public CommonResult<List<DepartmentTreeNodeVO>> treeDepartment() {
|
||||
return success(departmentManager.treeDepartment());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.iocoder.mall.managementweb.controller.admin.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("部门创建 DTO")
|
||||
@Data
|
||||
public class DepartmentCreateDTO {
|
||||
|
||||
@ApiModelProperty(value = "部门名称", required = true, example = "技术部")
|
||||
@NotEmpty(message = "部门名称不能为空")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "排序字段", required = true, example = "1024")
|
||||
@NotNull(message = "排序字段不能为空")
|
||||
private Integer sort;
|
||||
@ApiModelProperty(value = "父级部门编号", required = true, example = "2048")
|
||||
@NotNull(message = "父级部门编号不能为空")
|
||||
private Integer pid;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package cn.iocoder.mall.managementweb.controller.admin.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("部门更新 DTO")
|
||||
@Data
|
||||
public class DepartmentUpdateDTO {
|
||||
|
||||
@ApiModelProperty(value = "部门编号", required = true, example = "1")
|
||||
@NotNull(message = "部门编号不能为空")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "部门名称", required = true, example = "技术部")
|
||||
@NotEmpty(message = "部门名称不能为空")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "排序字段", required = true, example = "1024")
|
||||
@NotNull(message = "排序字段不能为空")
|
||||
private Integer sort;
|
||||
@ApiModelProperty(value = "父级部门编号", required = true, example = "2048")
|
||||
@NotNull(message = "父级部门编号不能为空")
|
||||
private Integer pid;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package cn.iocoder.mall.managementweb.controller.admin.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("部门树节点 VO")
|
||||
@Data
|
||||
public class DepartmentTreeNodeVO {
|
||||
|
||||
@ApiModelProperty(value = "部门编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "部门名称", required = true, example = "技术部")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "排序字段", required = true, example = "1024")
|
||||
private Integer sort;
|
||||
@ApiModelProperty(value = "父级部门编号", required = true, example = "2048")
|
||||
private Integer pid;
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 子节点
|
||||
*/
|
||||
private List<DepartmentTreeNodeVO> children;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package cn.iocoder.mall.managementweb.controller.admin.vo;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.*;
|
||||
|
||||
@ApiModel("部门 VO")
|
||||
@Data
|
||||
public class DepartmentVO {
|
||||
|
||||
@ApiModelProperty(value = "部门编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "部门名称", required = true, example = "技术部")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "排序字段", required = true, example = "1024")
|
||||
private Integer sort;
|
||||
@ApiModelProperty(value = "父级部门编号", required = true, example = "2048")
|
||||
private Integer pid;
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -22,6 +22,7 @@ Authorization: Bearer {{accessToken}}
|
||||
### /passport/list-admin-permission 成功
|
||||
GET {{baseUrl}}/passport/list-admin-permission
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
Authorization: Bearer {{accessToken}}
|
||||
#Authorization: Bearer {{accessToken}}
|
||||
Authorization: Bearer 36dce986276b4d6c8f9f4f3b89b22810
|
||||
|
||||
###
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
POST {{baseUrl}}/role/create
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
Authorization: Bearer {{accessToken}}
|
||||
#Authorization: Bearer 9d250d9b6c034a6c88bf4034cdf1d4cc
|
||||
|
||||
name=测试角色
|
||||
|
||||
|
||||
Reference in New Issue
Block a user