新增公司部门信息接口和相关字段
- 在 DeptApi 中添加 getCompanyDept 接口,用于获取部门类型为公司的部门信息 - 在 DeptRespDTO、DeptDO、DeptListReqVO、DeptRespVO、DeptSaveReqVO 和 DeptSimpleRespVO 中添加 shortName 字段,用于存储部门简称 - 修改 LogInstanceMapper 中的 SQL 查询,移除不必要的左连接条件 - 在 LogReadDo 中删除 deleted 字段,简化数据结构
This commit is contained in:
parent
87d56c9d0b
commit
79ea91641f
@ -91,4 +91,8 @@ public interface DeptApi {
|
|||||||
@PostMapping(PREFIX + "/getDeptListByFactoryIds")
|
@PostMapping(PREFIX + "/getDeptListByFactoryIds")
|
||||||
@Operation(summary = "根据工厂ids获取部门ids")
|
@Operation(summary = "根据工厂ids获取部门ids")
|
||||||
CommonResult<Map<Long, Long>> getDeptListByFactoryIds(@RequestBody List<Long> factoryIds);
|
CommonResult<Map<Long, Long>> getDeptListByFactoryIds(@RequestBody List<Long> factoryIds);
|
||||||
|
|
||||||
|
@GetMapping("/getCompanyDept")
|
||||||
|
@Operation(summary = "获取部门类型为公司的部门信息")
|
||||||
|
CommonResult<List<DeptRespDTO>> getCompanyDept();
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,9 @@ public class DeptRespDTO {
|
|||||||
@Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "研发部")
|
@Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "研发部")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "部门简称", example = "芋道")
|
||||||
|
private String shortName;
|
||||||
|
|
||||||
@Schema(description = "父部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
@Schema(description = "父部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
|
@ -127,4 +127,11 @@ public class DeptApiImpl implements DeptApi {
|
|||||||
Map<Long, Long> map = deptDOS.stream().collect(Collectors.toMap(DeptDO::getFactoryId, DeptDO::getId));
|
Map<Long, Long> map = deptDOS.stream().collect(Collectors.toMap(DeptDO::getFactoryId, DeptDO::getId));
|
||||||
return success(map);
|
return success(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@DataPermission(enable = false)
|
||||||
|
public CommonResult<List<DeptRespDTO>> getCompanyDept() {
|
||||||
|
List<DeptDO> deptDOS = deptService.getCompanyDept();
|
||||||
|
return success(BeanUtils.toBean(deptDOS, DeptRespDTO.class));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,9 @@ public class DeptListReqVO {
|
|||||||
@Schema(description = "部门名称,模糊匹配", example = "芋道")
|
@Schema(description = "部门名称,模糊匹配", example = "芋道")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "部门简称", example = "芋道")
|
||||||
|
private String shortName;
|
||||||
|
|
||||||
@Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1")
|
@Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
@ -15,6 +15,9 @@ public class DeptRespVO {
|
|||||||
@Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
|
@Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "部门简称", example = "芋道")
|
||||||
|
private String shortName;
|
||||||
|
|
||||||
@Schema(description = "父部门 ID", example = "1024")
|
@Schema(description = "父部门 ID", example = "1024")
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
|
@ -22,6 +22,9 @@ public class DeptSaveReqVO {
|
|||||||
@Size(max = 30, message = "部门名称长度不能超过 30 个字符")
|
@Size(max = 30, message = "部门名称长度不能超过 30 个字符")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "部门简称", example = "芋道")
|
||||||
|
private String shortName;
|
||||||
|
|
||||||
@Schema(description = "父部门 ID", example = "1024")
|
@Schema(description = "父部门 ID", example = "1024")
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
|
@ -17,6 +17,9 @@ public class DeptSimpleRespVO {
|
|||||||
@Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
|
@Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "部门简称", example = "芋道")
|
||||||
|
private String shortName;
|
||||||
|
|
||||||
@Schema(description = "父部门 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
@Schema(description = "父部门 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
|
@ -32,6 +32,10 @@ public class DeptDO extends TenantBaseDO {
|
|||||||
* 部门名称
|
* 部门名称
|
||||||
*/
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
|
/**
|
||||||
|
* 简称
|
||||||
|
*/
|
||||||
|
private String shortName;
|
||||||
/**
|
/**
|
||||||
* 父部门ID
|
* 父部门ID
|
||||||
* 关联 {@link #id}
|
* 关联 {@link #id}
|
||||||
|
@ -51,9 +51,4 @@ public class LogReadDo extends BaseDO {
|
|||||||
* 1:已读
|
* 1:已读
|
||||||
*/
|
*/
|
||||||
private Integer readStatus;
|
private Integer readStatus;
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否删除
|
|
||||||
*/
|
|
||||||
private Boolean deleted;
|
|
||||||
}
|
}
|
||||||
|
@ -62,10 +62,11 @@ public interface LogInstanceMapper extends BaseMapperX<LogInstanceDO> {
|
|||||||
queryWrapper.innerJoin(UserPostDO.class, "userPost", UserPostDO::getUserId, LogInstanceDO::getStartUserId);
|
queryWrapper.innerJoin(UserPostDO.class, "userPost", UserPostDO::getUserId, LogInstanceDO::getStartUserId);
|
||||||
queryWrapper.innerJoin(DeptDO.class, "dept", DeptDO::getId, LogInstanceDO::getDeptId);
|
queryWrapper.innerJoin(DeptDO.class, "dept", DeptDO::getId, LogInstanceDO::getDeptId);
|
||||||
queryWrapper.innerJoin(PostDO.class, "post", PostDO::getId, UserPostDO::getPostId);
|
queryWrapper.innerJoin(PostDO.class, "post", PostDO::getId, UserPostDO::getPostId);
|
||||||
queryWrapper.leftJoin(LogReadDo.class, "e", on -> on
|
// queryWrapper.leftJoin(LogReadDo.class, "e", on -> on
|
||||||
.eq(LogReadDo::getLogInstanceId, LogInstanceDO::getId)
|
// .eq(LogReadDo::getLogInstanceId, LogInstanceDO::getId)
|
||||||
.eq(LogReadDo::getReadUserId, userId)
|
// .eq(LogReadDo::getReadUserId, userId)
|
||||||
.eq(LogReadDo::getDeleted, 0));
|
// .eq(LogReadDo::getDeleted, 0));
|
||||||
|
queryWrapper.leftJoin("work_log_read e on e.log_instance_id = t.id and e.deleted = 0 and e.read_user_id = " + userId);
|
||||||
queryWrapper.leftJoin("(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) c on t.id = c.log_instance_id");
|
queryWrapper.leftJoin("(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) c on t.id = c.log_instance_id");
|
||||||
queryWrapper.leftJoin("(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 t.id = d.log_instance_id");
|
queryWrapper.leftJoin("(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 t.id = d.log_instance_id");
|
||||||
queryWrapper.leftJoin("(SELECT work_log_id, COUNT(work_log_id) AS comment FROM work_log_comment GROUP BY work_log_id) AS b ON t.id = b.work_log_id");
|
queryWrapper.leftJoin("(SELECT work_log_id, COUNT(work_log_id) AS comment FROM work_log_comment GROUP BY work_log_id) AS b ON t.id = b.work_log_id");
|
||||||
|
Loading…
Reference in New Issue
Block a user