diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/vo/DutyClassTypeTree.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/vo/DutyClassTypeTree.java new file mode 100644 index 0000000..ce95232 --- /dev/null +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/vo/DutyClassTypeTree.java @@ -0,0 +1,29 @@ +package com.hnac.hzims.operational.duty.vo; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.hnac.hzims.common.pojo.Tree; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +@ApiModel(value = "机构-值班班次类型-班次树",description = "机构-值班班次类型-班次树") +public class DutyClassTypeTree implements Tree { + @ApiModelProperty("树ID") + private Long id; + + @ApiModelProperty("父节点树ID") + @JsonIgnore + private Long parentId; + + @ApiModelProperty("节点名称") + private String name; + + @ApiModelProperty("子节点") + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private List children; + +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyClassController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyClassController.java index e0f3b55..c4fc34f 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyClassController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyClassController.java @@ -6,12 +6,15 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.hzims.common.logs.annotation.OperationAnnotation; import com.hnac.hzims.common.logs.enums.BusinessType; import com.hnac.hzims.common.logs.enums.OperatorType; +import com.hnac.hzims.common.pojo.Tree; import com.hnac.hzims.operational.duty.entity.ImsDutyClassEntity; import com.hnac.hzims.operational.duty.service.IImsDutyClassService; +import com.hnac.hzims.operational.duty.vo.DutyClassTypeTree; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; +import lombok.Value; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; @@ -139,7 +142,12 @@ public class ImsDutyClassController extends BladeController { return imsDutyClassService.typeRemove(classTypeId); } - + @GetMapping("/getDutyClassTree") + @ApiOperationSupport(order = 10) + @ApiOperation(value = "获取机构-班次类型-班次树") + public R> getDutyClassTree(@RequestParam(required = false) @ApiParam(value = "机构id") Long deptId) { + return R.data(imsDutyClassService.getDutyClassTree(deptId)); + } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyClassMapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyClassMapper.java index 5a5771a..fc302a5 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyClassMapper.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyClassMapper.java @@ -1,5 +1,7 @@ package com.hnac.hzims.operational.duty.mapper; +import com.hnac.hzims.common.pojo.Tree; +import com.hnac.hzims.operational.duty.vo.DutyClassTypeTree; import org.apache.ibatis.annotations.Param; import org.springblade.core.datascope.annotation.UserDataAuth; import com.hnac.hzims.operational.duty.entity.ImsDutyClassEntity; @@ -32,4 +34,10 @@ public interface ImsDutyClassMapper extends UserDataScopeBaseMapper getDutyClassTree(@Param("deptId")Long deptId); + + List getDutyClassByType(@Param("class_type_id") Long classTypeId); + + List getDutyClassTypeByDept(@Param("create_dept") Long deptId); + } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyClassService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyClassService.java index 76c7d53..9a502aa 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyClassService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyClassService.java @@ -1,6 +1,8 @@ package com.hnac.hzims.operational.duty.service; +import com.hnac.hzims.common.pojo.Tree; import com.hnac.hzims.operational.duty.entity.ImsDutyClassEntity; +import com.hnac.hzims.operational.duty.vo.DutyClassTypeTree; import org.springblade.core.mp.base.BaseService; import org.springblade.core.tool.api.R; @@ -32,6 +34,6 @@ public interface IImsDutyClassService extends BaseService { R typeRemove(Long classTypeId); - + List getDutyClassTree(Long deptId); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyClassServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyClassServiceImpl.java index cb31c38..a923cc2 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyClassServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyClassServiceImpl.java @@ -1,19 +1,23 @@ package com.hnac.hzims.operational.duty.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.hnac.hzims.common.pojo.Tree; import com.hnac.hzims.operational.duty.entity.ImsDutyClassEntity; import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity; import com.hnac.hzims.operational.duty.mapper.ImsDutyClassMapper; import com.hnac.hzims.operational.duty.mapper.ImsDutyMainMapper; import com.hnac.hzims.operational.duty.service.IImsDutyClassService; +import com.hnac.hzims.operational.duty.vo.DutyClassTypeTree; import org.apache.commons.lang3.StringUtils; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.system.feign.ISysClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; /** @@ -25,7 +29,9 @@ import java.util.stream.Collectors; public class ImsDutyClassServiceImpl extends BaseServiceImpl implements IImsDutyClassService { @Autowired - private ImsDutyMainMapper imsDutyMainMapper; + private ImsDutyMainMapper imsDutyMainMapper; + @Autowired + private ISysClient sysClient; @Override public R saveOrUpdateImsDutyClass(ImsDutyClassEntity imsDutyClass) { if (null == imsDutyClass.getClassTypeId()) { @@ -104,4 +110,13 @@ public class ImsDutyClassServiceImpl extends BaseServiceImpl getDutyClassTree(Long deptId) { + List dutyClassTrees = this.baseMapper.getDutyClassTree(deptId); + dutyClassTrees.forEach(node -> { + node.setName(Optional.ofNullable(sysClient.getDeptName(node.getId())).map(R::getData).orElse(null)); + }); + return dutyClassTrees; + } + }