Merge branch 'dev' of http://git.znkjfw.com/zn-cloud/server into dev
This commit is contained in:
commit
16a6f35602
@ -10,6 +10,8 @@ import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.PostApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.PostRespVO;
|
||||
import cn.iocoder.yudao.module.system.api.position.PositionApi;
|
||||
import cn.iocoder.yudao.module.system.api.position.dto.PositionDTO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@ -42,6 +44,9 @@ public class BpmOAEntryController {
|
||||
@Resource
|
||||
private PostApi postApi;
|
||||
|
||||
@Resource
|
||||
private PositionApi positionApi;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建请求申请")
|
||||
@PermitAll
|
||||
@ -60,8 +65,10 @@ public class BpmOAEntryController {
|
||||
BpmOAEntryRespVO respVO = BpmOAEntryConvert.INSTANCE.convert(entry);
|
||||
// 设备部门名称
|
||||
respVO.setEntryDeptName(getDept(entry.getEntryDeptId()).getName());
|
||||
// 设备岗位名称
|
||||
// 设置职称
|
||||
respVO.setEntryPostName(getPost(entry.getEntryPostId()).getName());
|
||||
// 设置岗位名称
|
||||
respVO.setEntryPositionName(getPosition(entry.getEntryPositionId()).getName());
|
||||
|
||||
return success(respVO);
|
||||
}
|
||||
@ -78,6 +85,8 @@ public class BpmOAEntryController {
|
||||
respVO.setEntryDeptName(getDept(entry.getEntryDeptId()).getName());
|
||||
// 设备岗位名称
|
||||
respVO.setEntryPostName(getPost(entry.getEntryPostId()).getName());
|
||||
// 设置岗位名称
|
||||
respVO.setEntryPositionName(getPosition(entry.getEntryPositionId()).getName());
|
||||
|
||||
return success(respVO);
|
||||
}
|
||||
@ -107,4 +116,11 @@ public class BpmOAEntryController {
|
||||
}
|
||||
return postApi.getPost(postId).getCheckedData();
|
||||
}
|
||||
|
||||
public PositionDTO getPosition(Long positionId) {
|
||||
if (positionId == null) {
|
||||
return new PositionDTO();
|
||||
}
|
||||
return positionApi.getPosition(positionId).getCheckedData();
|
||||
}
|
||||
}
|
||||
|
@ -23,9 +23,12 @@ public class BpmOAEntryCreateReqVO {
|
||||
@Schema(description = "新入职用户部门编号", example = "10237")
|
||||
private Long entryDeptId;
|
||||
|
||||
@Schema(description = "新入职用户岗位编号", example = "10237")
|
||||
@Schema(description = "新入职用户职称编号", example = "10237")
|
||||
private Long entryPostId;
|
||||
|
||||
@Schema(description = "新入职用户岗位编号", example = "10237")
|
||||
private Long entryPositionId;
|
||||
|
||||
@Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@NotNull(message = "用户昵称不能为空")
|
||||
private String nickname;
|
||||
|
@ -30,12 +30,18 @@ public class BpmOAEntryRespVO extends BpmOABaseRespVO {
|
||||
@Schema(description = "新入职用户部门名称", example = "研发部")
|
||||
private String entryDeptName;
|
||||
|
||||
@Schema(description = "新入职用户岗位编号", example = "10237")
|
||||
@Schema(description = "新入职用户职称编号", example = "10237")
|
||||
private Long entryPostId;
|
||||
|
||||
@Schema(description = "新入职用户岗位名称", example = "职工")
|
||||
@Schema(description = "新入职用户职称名称", example = "职工")
|
||||
private String entryPostName;
|
||||
|
||||
@Schema(description = "新入职用户岗位编号", example = "10237")
|
||||
private Long entryPositionId;
|
||||
|
||||
@Schema(description = "新入职用户岗位名称", example = "职工")
|
||||
private String entryPositionName;
|
||||
|
||||
@Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@NotEmpty(message = "用户昵称不能为空")
|
||||
private String nickname;
|
||||
|
@ -44,9 +44,13 @@ public class BpmOAEntryDO extends BaseDO {
|
||||
*/
|
||||
private Long entryDeptId;
|
||||
/**
|
||||
* 新入职用户部门编号
|
||||
* 新入职用户职称编号
|
||||
*/
|
||||
private Long entryPostId;
|
||||
/**
|
||||
* 新入职用户岗位编号
|
||||
*/
|
||||
private Long entryPositionId;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
|
@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
|
||||
import cn.iocoder.yudao.module.system.api.equipment.UsersExtApi;
|
||||
import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi;
|
||||
import cn.iocoder.yudao.module.system.api.permission.RoleApi;
|
||||
import cn.iocoder.yudao.module.system.api.position.PositionApi;
|
||||
import cn.iocoder.yudao.module.system.api.sms.SmsSendApi;
|
||||
import cn.iocoder.yudao.module.system.api.social.SocialClientApi;
|
||||
import cn.iocoder.yudao.module.system.api.subscribe.SubscribeMessageSendApi;
|
||||
@ -19,7 +20,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {FileApi.class, RoleApi.class, DeptApi.class, PostApi.class, AdminUserApi.class, SmsSendApi.class, DictDataApi.class, NotifyMessageSendApi.class,
|
||||
SubscribeMessageSendApi.class, SocialClientApi.class, UsersExtApi.class, AttendanceApi.class, BankApi.class, ConfigApi.class
|
||||
SubscribeMessageSendApi.class, SocialClientApi.class, UsersExtApi.class, AttendanceApi.class, BankApi.class, ConfigApi.class, PositionApi.class
|
||||
})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
@ -113,6 +113,7 @@ public class BpmOAEntryServiceImpl implements BpmOAEntryService{
|
||||
UserSaveRespDTO saveRespDTO = BeanUtils.toBean(entry, UserSaveRespDTO.class);
|
||||
saveRespDTO.setId(null);
|
||||
saveRespDTO.setDeptId(entry.getEntryDeptId());
|
||||
saveRespDTO.setPositionId(entry.getEntryPositionId());
|
||||
saveRespDTO.setPostIds(Collections.singleton(entry.getEntryPostId()));
|
||||
saveRespDTO.setPassword("123456");
|
||||
|
||||
|
@ -31,4 +31,7 @@ public class DeptRespDTO {
|
||||
@Schema(description = "部门状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer status; // 参见 CommonStatusEnum 枚举
|
||||
|
||||
@Schema(description = "是否为虚机构 | 0否 1是")
|
||||
private Integer virtuallyStatus;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.system.api.position;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.api.position.dto.PositionDTO;
|
||||
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 岗位")
|
||||
public interface PositionApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/position";
|
||||
|
||||
@GetMapping(PREFIX + "/get")
|
||||
@Operation(summary = "获得部门信息")
|
||||
@Parameter(name = "id", description = "岗位编号", example = "1024", required = true)
|
||||
CommonResult<PositionDTO> getPosition(@RequestParam("id") Long id);
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.system.api.position.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "RPC 服务 - 岗位 Response DTO")
|
||||
@Data
|
||||
public class PositionDTO {
|
||||
|
||||
@Schema(description = "岗位ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "岗位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "JAVA开发")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "状态(0正常 1停用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", example = "你说的对")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
}
|
@ -27,9 +27,12 @@ public class UserSaveRespDTO {
|
||||
@Schema(description = "部门ID", example = "我是一个用户")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "岗位编号数组", example = "1")
|
||||
@Schema(description = "职称编号数组", example = "1")
|
||||
private Set<Long> postIds;
|
||||
|
||||
@Schema(description = "岗位编号数", example = "1")
|
||||
private Long positionId;
|
||||
|
||||
@Schema(description = "手机号码", example = "15601691300")
|
||||
@Mobile
|
||||
private String mobile;
|
||||
|
@ -54,11 +54,12 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode DEPT_NOT_ENABLE = new ErrorCode(1_002_004_006, "部门({})不处于开启状态,不允许选择");
|
||||
ErrorCode DEPT_PARENT_IS_CHILD = new ErrorCode(1_002_004_007, "不能设置自己的子部门为父部门");
|
||||
|
||||
// ========== 岗位模块 1-002-005-000 ==========
|
||||
ErrorCode POST_NOT_FOUND = new ErrorCode(1_002_005_000, "当前岗位不存在");
|
||||
ErrorCode POST_NOT_ENABLE = new ErrorCode(1_002_005_001, "岗位({}) 不处于开启状态,不允许选择");
|
||||
ErrorCode POST_NAME_DUPLICATE = new ErrorCode(1_002_005_002, "已经存在该名字的岗位");
|
||||
ErrorCode POST_CODE_DUPLICATE = new ErrorCode(1_002_005_003, "已经存在该标识的岗位");
|
||||
// ========== 职称模块 1-002-005-000 ==========
|
||||
ErrorCode POST_NOT_FOUND = new ErrorCode(1_002_005_000, "当前职称不存在");
|
||||
ErrorCode POST_NOT_ENABLE = new ErrorCode(1_002_005_001, "职称({}) 不处于开启状态,不允许选择");
|
||||
ErrorCode POST_NAME_DUPLICATE = new ErrorCode(1_002_005_002, "已经存在该名字的职称");
|
||||
ErrorCode POST_CODE_DUPLICATE = new ErrorCode(1_002_005_003, "已经存在该标识的职称");
|
||||
ErrorCode POSITION_NOT_EXISTS = new ErrorCode(1_002_005_004, "岗位信息不存在");
|
||||
|
||||
// ========== 字典类型 1-002-006-000 ==========
|
||||
ErrorCode DICT_TYPE_NOT_EXISTS = new ErrorCode(1_002_006_001, "当前字典类型不存在");
|
||||
|
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.system.api.position;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.api.position.dto.PositionDTO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.position.PositionDO;
|
||||
import cn.iocoder.yudao.module.system.service.position.PositionService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class PositionApiImpl implements PositionApi {
|
||||
|
||||
@Resource
|
||||
private PositionService positionService;
|
||||
|
||||
@Override
|
||||
public CommonResult<PositionDTO> getPosition(Long id) {
|
||||
PositionDO positionDO = positionService.getPosition(id);
|
||||
return success(BeanUtils.toBean(positionDO, PositionDTO.class));
|
||||
}
|
||||
}
|
@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
||||
@ -68,6 +69,27 @@ public class DeptController {
|
||||
@PreAuthorize("@ss.hasPermission('system:dept:query')")
|
||||
public CommonResult<List<DeptRespVO>> getDeptList(DeptListReqVO reqVO) {
|
||||
List<DeptDO> list = deptService.getDeptList(reqVO);
|
||||
|
||||
if (reqVO.getVirtuallyStatus() == 1) {
|
||||
|
||||
// 获得所有得虚机构部门信息
|
||||
List<DeptDO> virtuallyDeptId = list.stream()
|
||||
.filter(dept -> dept.getVirtuallyStatus() == 1)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 移除虚机构,不展示
|
||||
list.removeIf(dept -> dept.getVirtuallyStatus() == 1);
|
||||
|
||||
virtuallyDeptId.forEach(data -> {
|
||||
|
||||
// 将虚机构的子部门,父部门设置为虚机构的父部门
|
||||
list.stream().filter(dept -> dept.getParentId().equals(data.getId()))
|
||||
.map(dept -> dept.setParentId(data.getParentId()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
return success(BeanUtils.toBean(list, DeptRespVO.class));
|
||||
}
|
||||
|
||||
@ -76,6 +98,24 @@ public class DeptController {
|
||||
public CommonResult<List<DeptSimpleRespVO>> getSimpleDeptList() {
|
||||
List<DeptDO> list = deptService.getDeptList(
|
||||
new DeptListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus()));
|
||||
|
||||
// 获得所有得虚机构部门信息
|
||||
List<DeptDO> virtuallyDeptId = list.stream()
|
||||
.filter(dept -> dept.getVirtuallyStatus() == 1)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 移除虚机构,不展示
|
||||
list.removeIf(dept -> dept.getVirtuallyStatus() == 1);
|
||||
|
||||
virtuallyDeptId.forEach(data -> {
|
||||
|
||||
// 将虚机构的子部门,父部门设置为虚机构的父部门
|
||||
list.stream().filter(dept -> dept.getParentId().equals(data.getId()))
|
||||
.map(dept -> dept.setParentId(data.getParentId()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
});
|
||||
|
||||
return success(BeanUtils.toBean(list, DeptSimpleRespVO.class));
|
||||
}
|
||||
|
||||
@ -85,6 +125,24 @@ public class DeptController {
|
||||
public CommonResult<List<DeptSimpleRespVO>> getAllDeptList() {
|
||||
List<DeptDO> list = deptService.getDeptList(
|
||||
new DeptListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus()));
|
||||
|
||||
// 获得所有得虚机构部门信息
|
||||
List<DeptDO> virtuallyDeptId = list.stream()
|
||||
.filter(dept -> dept.getVirtuallyStatus() == 1)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 移除虚机构,不展示
|
||||
list.removeIf(dept -> dept.getVirtuallyStatus() == 1);
|
||||
|
||||
virtuallyDeptId.forEach(data -> {
|
||||
|
||||
// 将虚机构的子部门,父部门设置为虚机构的父部门
|
||||
list.stream().filter(dept -> dept.getParentId().equals(data.getId()))
|
||||
.map(dept -> dept.setParentId(data.getParentId()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
});
|
||||
|
||||
return success(BeanUtils.toBean(list, DeptSimpleRespVO.class));
|
||||
}
|
||||
|
||||
|
@ -13,4 +13,6 @@ public class DeptListReqVO {
|
||||
@Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "是否为虚机构 | 0否 1是")
|
||||
private Integer virtuallyStatus;
|
||||
}
|
||||
|
@ -36,6 +36,9 @@ public class DeptRespVO {
|
||||
@Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "是否为虚机构 | 0否 1是")
|
||||
private Integer virtuallyStatus;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
@ -49,4 +49,7 @@ public class DeptSaveReqVO {
|
||||
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "是否为虚机构 | 0否 1是")
|
||||
private Integer virtuallyStatus;
|
||||
|
||||
}
|
||||
|
@ -20,4 +20,6 @@ public class DeptSimpleRespVO {
|
||||
@Schema(description = "父部门 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "是否为虚机构 | 0否 1是")
|
||||
private Integer virtuallyStatus;
|
||||
}
|
||||
|
@ -0,0 +1,104 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.position;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.position.vo.PositionPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.position.vo.PositionRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.position.vo.PositionSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.position.PositionDO;
|
||||
import cn.iocoder.yudao.module.system.service.position.PositionService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 岗位信息")
|
||||
@RestController
|
||||
@RequestMapping("/system/position")
|
||||
@Validated
|
||||
public class PositionController {
|
||||
|
||||
@Resource
|
||||
private PositionService positionService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建岗位信息")
|
||||
@PreAuthorize("@ss.hasPermission('system:position:create')")
|
||||
public CommonResult<Long> createPosition(@Valid @RequestBody PositionSaveReqVO createReqVO) {
|
||||
return success(positionService.createPosition(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新岗位信息")
|
||||
@PreAuthorize("@ss.hasPermission('system:position:update')")
|
||||
public CommonResult<Boolean> updatePosition(@Valid @RequestBody PositionSaveReqVO updateReqVO) {
|
||||
positionService.updatePosition(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除岗位信息")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('system:position:delete')")
|
||||
public CommonResult<Boolean> deletePosition(@RequestParam("id") Long id) {
|
||||
positionService.deletePosition(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得岗位信息")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('system:position:query')")
|
||||
public CommonResult<PositionRespVO> getPosition(@RequestParam("id") Long id) {
|
||||
PositionDO position = positionService.getPosition(id);
|
||||
return success(BeanUtils.toBean(position, PositionRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/get-list")
|
||||
@Operation(summary = "获得岗位信息")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('system:position:query')")
|
||||
@DataPermission(enable = false)
|
||||
public CommonResult<List<PositionRespVO>> getPositionList() {
|
||||
List<PositionDO> positions = positionService.getPositionList();
|
||||
return success(BeanUtils.toBean(positions, PositionRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得岗位信息分页")
|
||||
@PreAuthorize("@ss.hasPermission('system:position:query')")
|
||||
public CommonResult<PageResult<PositionRespVO>> getPositionPage(@Valid PositionPageReqVO pageReqVO) {
|
||||
PageResult<PositionDO> pageResult = positionService.getPositionPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, PositionRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出岗位信息 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('system:position:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportPositionExcel(@Valid PositionPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<PositionDO> list = positionService.getPositionPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "岗位信息.xls", "数据", PositionRespVO.class,
|
||||
BeanUtils.toBean(list, PositionRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.position.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 岗位信息分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PositionPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "岗位名称", example = "JAVA开发")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "状态(0正常 1停用)", example = "0")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", example = "你说的对")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.position.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 岗位信息 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class PositionRespVO {
|
||||
|
||||
@Schema(description = "岗位ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("岗位ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "岗位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "JAVA开发")
|
||||
@ExcelProperty("岗位名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "状态(0正常 1停用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
|
||||
@ExcelProperty("状态(0正常 1停用)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", example = "你说的对")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.position.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 岗位信息新增/修改 Request VO")
|
||||
@Data
|
||||
public class PositionSaveReqVO {
|
||||
|
||||
@Schema(description = "岗位ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "岗位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "JAVA开发")
|
||||
@NotEmpty(message = "岗位名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "状态(0正常 1停用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
|
||||
@NotNull(message = "状态(0正常 1停用)不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", example = "你说的对")
|
||||
private String remark;
|
||||
|
||||
}
|
@ -76,7 +76,7 @@ public class FactoryUserController {
|
||||
return success("true");
|
||||
}else {
|
||||
|
||||
return error(-1, msg);
|
||||
return error(-1, "照片下发异常!");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,9 +15,11 @@ import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*;
|
||||
import cn.iocoder.yudao.module.system.convert.user.UserConvert;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.PostDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.position.PositionDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
||||
import cn.iocoder.yudao.module.system.service.dept.PostService;
|
||||
import cn.iocoder.yudao.module.system.service.position.PositionService;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -37,6 +39,7 @@ import java.util.*;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 用户")
|
||||
@ -53,6 +56,9 @@ public class UserController {
|
||||
@Resource
|
||||
private PostService postService;
|
||||
|
||||
@Resource
|
||||
private PositionService positionService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "新增用户")
|
||||
@PreAuthorize("@ss.hasPermission('system:user:create')")
|
||||
@ -122,8 +128,10 @@ public class UserController {
|
||||
// 拼接数据
|
||||
Map<Long, DeptDO> deptMap = deptService.getDeptMap(convertList(pageResult.getList(), AdminUserDO::getDeptId));
|
||||
Map<Long, PostDO> postMap = postService.getDeptMap(convertList(pageResult.getList(), AdminUserDO::getPostIds));
|
||||
List<PositionDO> positionDOs = positionService.getPositionList(convertList(pageResult.getList(), AdminUserDO::getPositionId));
|
||||
Map<Long, PositionDO> positionMap = convertMap(positionDOs, PositionDO::getId);
|
||||
|
||||
return success(new PageResult<>(UserConvert.INSTANCE.convertList(pageResult.getList(), deptMap, postMap),
|
||||
return success(new PageResult<>(UserConvert.INSTANCE.convertList(pageResult.getList(), deptMap, postMap, positionMap),
|
||||
pageResult.getTotal()));
|
||||
}
|
||||
|
||||
@ -140,8 +148,10 @@ public class UserController {
|
||||
// 拼接数据
|
||||
Map<Long, DeptDO> deptMap = deptService.getDeptMap(convertList(pageResult.getList(), AdminUserDO::getDeptId));
|
||||
Map<Long, PostDO> postMap = postService.getDeptMap(convertList(pageResult.getList(), AdminUserDO::getPostIds));
|
||||
List<PositionDO> positionDOs = positionService.getPositionList(convertList(pageResult.getList(), AdminUserDO::getPositionId));
|
||||
Map<Long, PositionDO> positionMap = convertMap(positionDOs, PositionDO::getId);
|
||||
|
||||
return success(new PageResult<>(UserConvert.INSTANCE.convertList(pageResult.getList(), deptMap, postMap),
|
||||
return success(new PageResult<>(UserConvert.INSTANCE.convertList(pageResult.getList(), deptMap, postMap, positionMap),
|
||||
pageResult.getTotal()));
|
||||
}
|
||||
|
||||
@ -197,7 +207,7 @@ public class UserController {
|
||||
post = postService.getPost(postId);
|
||||
}
|
||||
|
||||
return success(UserConvert.INSTANCE.convert(user, dept, post));
|
||||
return success(UserConvert.INSTANCE.convert(user, dept));
|
||||
}
|
||||
|
||||
@PostMapping("/getByDeptIds")
|
||||
@ -262,6 +272,8 @@ public class UserController {
|
||||
|
||||
Map<Long, DeptDO> deptMap = deptService.getDeptMap(convertList(list, AdminUserDO::getDeptId));
|
||||
Map<Long, PostDO> postMap = postService.getDeptMap(convertList(list, AdminUserDO::getPostIds));
|
||||
List<PositionDO> positionDOs = positionService.getPositionList(convertList(list, AdminUserDO::getPositionId));
|
||||
Map<Long, PositionDO> positionMap = convertMap(positionDOs, PositionDO::getId);
|
||||
|
||||
//获取部门名称
|
||||
List<DeptDO> deptDO = deptService.getDeptTree();
|
||||
@ -272,7 +284,7 @@ public class UserController {
|
||||
|
||||
// 输出 Excel
|
||||
ExcelUtils.write(response, "用户数据.xls", "数据", UserRespVO.class,
|
||||
UserConvert.INSTANCE.convertList(list, deptMap, postMap),
|
||||
UserConvert.INSTANCE.convertList(list, deptMap, postMap, positionMap),
|
||||
1, getDeptNameFun(deptDO),
|
||||
2, getPostNameFun(postDO));
|
||||
}
|
||||
|
@ -42,13 +42,20 @@ public class UserRespVO{
|
||||
@ExcelProperty("部门名称")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "岗位编号数组", example = "1")
|
||||
@Schema(description = "职称编号数组", example = "1")
|
||||
private Set<Long> postIds;
|
||||
|
||||
@Schema(description = "岗位名称", example = "总裁")
|
||||
@ExcelProperty("岗位")
|
||||
@Schema(description = "职称名称", example = "总裁")
|
||||
@ExcelProperty("职称")
|
||||
private String postName;
|
||||
|
||||
@Schema(description = "岗位编号数", example = "1")
|
||||
private Long positionId;
|
||||
|
||||
@Schema(description = "岗位名称", example = "1")
|
||||
@ExcelProperty("岗位")
|
||||
private String positionName;
|
||||
|
||||
@Schema(description = "手机号码", example = "15601691300")
|
||||
@ExcelProperty("手机号码")
|
||||
private String mobile;
|
||||
@ -83,6 +90,12 @@ public class UserRespVO{
|
||||
@DictFormat(DictTypeConstants.COMMON_STATUS)
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "用户性质 | 字典值system_user_type", example = "1")
|
||||
private Integer userNature;
|
||||
|
||||
@Schema(description = "用户编制 | 字典值system_user_type", example = "2")
|
||||
private Integer userStaffing;
|
||||
|
||||
@Schema(description = "最后登录 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "192.168.1.1")
|
||||
// @ExcelProperty("最后登录IP")
|
||||
private String loginIp;
|
||||
@ -93,5 +106,4 @@ public class UserRespVO{
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
|
@ -39,9 +39,12 @@ public class UserSaveReqVO {
|
||||
@Schema(description = "部门ID", example = "我是一个用户")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "岗位编号数组", example = "1")
|
||||
@Schema(description = "职称编号数组", example = "1")
|
||||
private Set<Long> postIds;
|
||||
|
||||
@Schema(description = "岗位编号数", example = "1")
|
||||
private Long positionId;
|
||||
|
||||
@Schema(description = "用户邮箱", example = "yudao@iocoder.cn")
|
||||
@Email(message = "邮箱格式不正确")
|
||||
@Size(max = 50, message = "邮箱长度不能超过 50 个字符")
|
||||
|
@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSimpleRe
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.PostDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.position.PositionDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import org.mapstruct.Mapper;
|
||||
@ -25,9 +26,11 @@ public interface UserConvert {
|
||||
|
||||
UserConvert INSTANCE = Mappers.getMapper(UserConvert.class);
|
||||
|
||||
default List<UserRespVO> convertList(List<AdminUserDO> list, Map<Long, DeptDO> deptMap, Map<Long, PostDO> postMap) {
|
||||
default List<UserRespVO> convertList(List<AdminUserDO> list, Map<Long, DeptDO> deptMap,
|
||||
Map<Long, PostDO> postMap, Map<Long, PositionDO> positionMap) {
|
||||
|
||||
return CollectionUtils.convertList(list, user -> convert(user, deptMap.get(user.getDeptId()), postMap.get(user.getPostIds().stream().findFirst().orElse(null))));
|
||||
return CollectionUtils.convertList(list, user -> convert(user, deptMap.get(user.getDeptId()),
|
||||
postMap.get(user.getPostIds().stream().findFirst().orElse(null)), positionMap.get(user.getPositionId())));
|
||||
}
|
||||
|
||||
default UserRespVO convert(AdminUserDO user, DeptDO dept) {
|
||||
@ -39,7 +42,7 @@ public interface UserConvert {
|
||||
return userVO;
|
||||
}
|
||||
|
||||
default UserRespVO convert(AdminUserDO user, DeptDO dept, PostDO postDO) {
|
||||
default UserRespVO convert(AdminUserDO user, DeptDO dept, PostDO postDO, PositionDO position) {
|
||||
UserRespVO userVO = BeanUtils.toBean(user, UserRespVO.class);
|
||||
if (dept != null) {
|
||||
userVO.setDeptName(dept.getName());
|
||||
@ -47,6 +50,9 @@ public interface UserConvert {
|
||||
if (postDO != null) {
|
||||
userVO.setPostName(postDO.getName());
|
||||
}
|
||||
if (position != null) {
|
||||
userVO.setPositionName(position.getName());
|
||||
}
|
||||
return userVO;
|
||||
}
|
||||
|
||||
|
@ -75,4 +75,9 @@ public class DeptDO extends TenantBaseDO {
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 是否为虚机构 | 0否 1是
|
||||
*/
|
||||
private Integer virtuallyStatus;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,42 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.position;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 岗位信息 DO
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@TableName("system_position")
|
||||
@KeySequence("system_position_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PositionDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 岗位ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 岗位名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 状态(0正常 1停用)
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
@ -55,10 +55,14 @@ public class AdminUserDO extends TenantBaseDO {
|
||||
*/
|
||||
private Long deptId;
|
||||
/**
|
||||
* 岗位编号数组
|
||||
* 职称编号数组
|
||||
*/
|
||||
@TableField(typeHandler = JsonLongSetTypeHandler.class)
|
||||
private Set<Long> postIds;
|
||||
/**
|
||||
* 岗位编号
|
||||
*/
|
||||
private Long positionId;
|
||||
/**
|
||||
* 用户邮箱
|
||||
*/
|
||||
|
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.system.dal.mysql.position;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.position.vo.PositionPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.position.PositionDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 岗位信息 Mapper
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Mapper
|
||||
public interface PositionMapper extends BaseMapperX<PositionDO> {
|
||||
|
||||
default PageResult<PositionDO> selectPage(PositionPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<PositionDO>()
|
||||
.likeIfPresent(PositionDO::getName, reqVO.getName())
|
||||
.eqIfPresent(PositionDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(PositionDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(PositionDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(PositionDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -51,7 +51,7 @@ public class DeptServiceImpl implements DeptService {
|
||||
DeptDO dept = BeanUtils.toBean(createReqVO, DeptDO.class);
|
||||
deptMapper.insert(dept);
|
||||
|
||||
if (dept.getParentId().toString().equals("0")) {
|
||||
if ("0".equals(dept.getParentId().toString())) {
|
||||
|
||||
dept.setLevel(0);
|
||||
dept.setFlag(dept.getId().toString());
|
||||
|
@ -0,0 +1,69 @@
|
||||
package cn.iocoder.yudao.module.system.service.position;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.position.vo.PositionPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.position.vo.PositionSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.position.PositionDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 岗位信息 Service 接口
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
public interface PositionService {
|
||||
|
||||
/**
|
||||
* 创建岗位信息
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createPosition(@Valid PositionSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新岗位信息
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updatePosition(@Valid PositionSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除岗位信息
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deletePosition(Long id);
|
||||
|
||||
/**
|
||||
* 获得岗位信息
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 岗位信息
|
||||
*/
|
||||
PositionDO getPosition(Long id);
|
||||
|
||||
/**
|
||||
* 获得岗位信息分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 岗位信息分页
|
||||
*/
|
||||
PageResult<PositionDO> getPositionPage(PositionPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得开启得 岗位列表
|
||||
* @return 岗位列表
|
||||
*/
|
||||
List<PositionDO> getPositionList();
|
||||
|
||||
/**
|
||||
* 获得指定得岗位列表
|
||||
*
|
||||
* @param ids 岗位编号数组
|
||||
* @return 岗位列表
|
||||
*/
|
||||
List<PositionDO> getPositionList(List<Long> ids);
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package cn.iocoder.yudao.module.system.service.position;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.position.vo.PositionPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.position.vo.PositionSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.position.PositionDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.position.PositionMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.POSITION_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 岗位信息 Service 实现类
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class PositionServiceImpl implements PositionService {
|
||||
|
||||
@Resource
|
||||
private PositionMapper positionMapper;
|
||||
|
||||
@Override
|
||||
public Long createPosition(PositionSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
PositionDO position = BeanUtils.toBean(createReqVO, PositionDO.class);
|
||||
positionMapper.insert(position);
|
||||
// 返回
|
||||
return position.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePosition(PositionSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validatePositionExists(updateReqVO.getId());
|
||||
// 更新
|
||||
PositionDO updateObj = BeanUtils.toBean(updateReqVO, PositionDO.class);
|
||||
positionMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePosition(Long id) {
|
||||
// 校验存在
|
||||
validatePositionExists(id);
|
||||
// 删除
|
||||
positionMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validatePositionExists(Long id) {
|
||||
if (positionMapper.selectById(id) == null) {
|
||||
throw exception(POSITION_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionDO getPosition(Long id) {
|
||||
return positionMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PositionDO> getPositionPage(PositionPageReqVO pageReqVO) {
|
||||
return positionMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionDO> getPositionList() {
|
||||
return positionMapper.selectList(PositionDO::getStatus, CommonStatusEnum.ENABLE.getStatus());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionDO> getPositionList(List<Long> ids) {
|
||||
return positionMapper.selectList(new LambdaQueryWrapperX<PositionDO>()
|
||||
.eq(PositionDO::getStatus, CommonStatusEnum.ENABLE.getStatus())
|
||||
.inIfPresent(PositionDO::getId, ids));
|
||||
}
|
||||
}
|
@ -62,7 +62,7 @@ public class FactoryUserServiceImpl implements FactoryUserService{
|
||||
private WebsocketService websocketService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class) // 异常回滚
|
||||
// @Transactional(rollbackFor = Exception.class) // 异常回滚
|
||||
public String createUser(FactoryUserSaveReqVO createReqVO){
|
||||
|
||||
// 校验账户配合
|
||||
@ -119,7 +119,7 @@ public class FactoryUserServiceImpl implements FactoryUserService{
|
||||
} catch (Exception ex) {
|
||||
|
||||
// 手动回滚
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return ex.getMessage();
|
||||
}
|
||||
|
||||
|
@ -104,10 +104,11 @@
|
||||
FROM
|
||||
work_log_instance_ext as a
|
||||
LEFT JOIN work_log_read as e ON a.id = e.log_instance_id and e.read_user_id = #{userId}
|
||||
LEFT JOIN (SELECT log_instance_id, COUNT(log_instance_id) AS readCount FROM work_log_read where read_status = 1 GROUP BY log_instance_id ) AS c ON a.id = c.log_instance_id
|
||||
LEFT JOIN (SELECT log_instance_id, COUNT(log_instance_id) AS unReadCount FROM work_log_read where read_status = 0 GROUP BY log_instance_id ) AS d ON a.id = d.log_instance_id
|
||||
LEFT JOIN (SELECT work_log_id, COUNT(work_log_id) AS comment FROM work_log_comment GROUP BY work_log_id) AS b ON a.id = b.work_log_id
|
||||
LEFT JOIN (SELECT log_instance_id, COUNT(log_instance_id) AS readCount FROM work_log_read where read_status = 1 AND deleted = 0 GROUP BY log_instance_id ) AS c ON a.id = c.log_instance_id
|
||||
LEFT JOIN (SELECT log_instance_id, COUNT(log_instance_id) AS unReadCount FROM work_log_read where read_status = 0 AND deleted = 0 GROUP BY log_instance_id ) AS d ON a.id = d.log_instance_id
|
||||
LEFT JOIN (SELECT work_log_id, COUNT(work_log_id) AS comment FROM work_log_comment where deleted = 0 GROUP BY work_log_id) AS b ON a.id = b.work_log_id
|
||||
<where>
|
||||
a.deleted = 0
|
||||
<if test="reqVO.type != null">
|
||||
and a.type = #{reqVO.type}
|
||||
</if>
|
||||
|
Loading…
Reference in New Issue
Block a user