|
@@ -2,12 +2,10 @@ package com.zjugis.module.system.controller.admin.company;
|
|
|
|
|
|
import com.zjugis.framework.common.enums.CommonStatusEnum;
|
|
import com.zjugis.framework.common.enums.CommonStatusEnum;
|
|
import com.zjugis.framework.common.pojo.CommonResult;
|
|
import com.zjugis.framework.common.pojo.CommonResult;
|
|
-import com.zjugis.module.system.controller.admin.dept.vo.dept.*;
|
|
|
|
-import com.zjugis.module.system.convert.dept.DeptConvert;
|
|
|
|
-import com.zjugis.module.system.dal.dataobject.dept.DeptDO;
|
|
|
|
-import com.zjugis.module.system.dal.dataobject.user.AdminUserDO;
|
|
|
|
-import com.zjugis.module.system.service.dept.DeptService;
|
|
|
|
-import com.zjugis.module.system.service.user.AdminUserService;
|
|
|
|
|
|
+import com.zjugis.module.system.controller.admin.company.vo.*;
|
|
|
|
+import com.zjugis.module.system.convert.company.CompanyConvert;
|
|
|
|
+import com.zjugis.module.system.dal.dataobject.company.CompanyDO;
|
|
|
|
+import com.zjugis.module.system.service.company.CompanyService;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
@@ -27,69 +25,69 @@ import static com.zjugis.framework.common.pojo.CommonResult.success;
|
|
* @Date 2023/12/7 9:39
|
|
* @Date 2023/12/7 9:39
|
|
* @Version 1.0
|
|
* @Version 1.0
|
|
*/
|
|
*/
|
|
-@Tag(name = "管理后台 - 部门")
|
|
|
|
|
|
+@Tag(name = "管理后台 - 公司")
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/system/company")
|
|
@RequestMapping("/system/company")
|
|
@Validated
|
|
@Validated
|
|
public class CompanyController {
|
|
public class CompanyController {
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
- private DeptService deptService;
|
|
|
|
|
|
+ private CompanyService companyService;
|
|
|
|
|
|
@PostMapping("create")
|
|
@PostMapping("create")
|
|
- @Operation(summary = "创建部门")
|
|
|
|
- @PreAuthorize("@ss.hasPermission('system:dept:create')")
|
|
|
|
- public CommonResult<String> createDept(@Valid @RequestBody DeptCreateReqVO reqVO) {
|
|
|
|
- String deptId = deptService.createDept(reqVO);
|
|
|
|
- return success(deptId);
|
|
|
|
|
|
+ @Operation(summary = "创建公司")
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:Company:create')")
|
|
|
|
+ public CommonResult<String> createCompany(@Valid @RequestBody CompanyCreateReqVO reqVO) {
|
|
|
|
+ String companyId = companyService.createCompany(reqVO);
|
|
|
|
+ return success(companyId);
|
|
}
|
|
}
|
|
|
|
|
|
@PutMapping("update")
|
|
@PutMapping("update")
|
|
- @Operation(summary = "更新部门")
|
|
|
|
- @PreAuthorize("@ss.hasPermission('system:dept:update')")
|
|
|
|
- public CommonResult<Boolean> updateDept(@Valid @RequestBody DeptUpdateReqVO reqVO) {
|
|
|
|
- deptService.updateDept(reqVO);
|
|
|
|
|
|
+ @Operation(summary = "更新公司")
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:Company:update')")
|
|
|
|
+ public CommonResult<Boolean> updateCompany(@Valid @RequestBody CompanyUpdateReqVO reqVO) {
|
|
|
|
+ companyService.updateCompany(reqVO);
|
|
return success(true);
|
|
return success(true);
|
|
}
|
|
}
|
|
|
|
|
|
@DeleteMapping("delete")
|
|
@DeleteMapping("delete")
|
|
- @Operation(summary = "删除部门")
|
|
|
|
|
|
+ @Operation(summary = "删除公司")
|
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
- @PreAuthorize("@ss.hasPermission('system:dept:delete')")
|
|
|
|
- public CommonResult<Boolean> deleteDept(@RequestParam("id") String id) {
|
|
|
|
- deptService.deleteDept(id);
|
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:Company:delete')")
|
|
|
|
+ public CommonResult<Boolean> deleteCompany(@RequestParam("id") String id) {
|
|
|
|
+ companyService.deleteCompany(id);
|
|
return success(true);
|
|
return success(true);
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping("/list")
|
|
@GetMapping("/list")
|
|
- @Operation(summary = "获取部门列表")
|
|
|
|
- @PreAuthorize("@ss.hasPermission('system:dept:query')")
|
|
|
|
- public CommonResult<List<DeptRespVO>> getDeptList(DeptListReqVO reqVO) {
|
|
|
|
- List<DeptDO> list = deptService.getDeptList(reqVO);
|
|
|
|
- list.sort(Comparator.comparing(DeptDO::getSort));
|
|
|
|
- return success(DeptConvert.INSTANCE.convertList(list));
|
|
|
|
|
|
+ @Operation(summary = "获取公司列表")
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:Company:query')")
|
|
|
|
+ public CommonResult<List<CompanyRespVO>> getCompanyList(CompanyListReqVO reqVO) {
|
|
|
|
+ List<CompanyDO> list = companyService.getCompanyList(reqVO);
|
|
|
|
+ list.sort(Comparator.comparing(CompanyDO::getSort));
|
|
|
|
+ return success(CompanyConvert.INSTANCE.convertList(list));
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping("/list-all-simple")
|
|
@GetMapping("/list-all-simple")
|
|
- @Operation(summary = "获取部门精简信息列表", description = "只包含被开启的部门,主要用于前端的下拉选项")
|
|
|
|
- @PreAuthorize("@ss.hasPermission('system:dept:query')")
|
|
|
|
- public CommonResult<List<DeptSimpleRespVO>> getSimpleDeptList() {
|
|
|
|
- // 获得部门列表,只要开启状态的
|
|
|
|
- DeptListReqVO reqVO = new DeptListReqVO();
|
|
|
|
|
|
+ @Operation(summary = "获取公司精简信息列表", description = "只包含被开启的公司,主要用于前端的下拉选项")
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:Company:query')")
|
|
|
|
+ public CommonResult<List<CompanySimpleRespVO>> getSimpleCompanyList() {
|
|
|
|
+ // 获得公司列表,只要开启状态的
|
|
|
|
+ CompanyListReqVO reqVO = new CompanyListReqVO();
|
|
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
|
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
|
- List<DeptDO> list = deptService.getDeptList(reqVO);
|
|
|
|
|
|
+ List<CompanyDO> list = companyService.getCompanyList(reqVO);
|
|
// 排序后,返回给前端
|
|
// 排序后,返回给前端
|
|
- list.sort(Comparator.comparing(DeptDO::getSort));
|
|
|
|
- return success(DeptConvert.INSTANCE.convertList02(list));
|
|
|
|
|
|
+ list.sort(Comparator.comparing(CompanyDO::getSort));
|
|
|
|
+ return success(CompanyConvert.INSTANCE.convertList02(list));
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping("/get")
|
|
@GetMapping("/get")
|
|
- @Operation(summary = "获得部门信息")
|
|
|
|
|
|
+ @Operation(summary = "获得公司信息")
|
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
- @PreAuthorize("@ss.hasPermission('system:dept:query')")
|
|
|
|
- public CommonResult<DeptRespVO> getDept(@RequestParam("id") String id) {
|
|
|
|
- return success(DeptConvert.INSTANCE.convert(deptService.getDept(id)));
|
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:Company:query')")
|
|
|
|
+ public CommonResult<CompanyRespVO> getCompany(@RequestParam("id") String id) {
|
|
|
|
+ return success(CompanyConvert.INSTANCE.convert(companyService.getCompany(id)));
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|