Browse Source

# 机构-班次类型-班次选择树接口

zhongwei
haungxing 9 months ago
parent
commit
e791102581
  1. 29
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/vo/DutyClassTypeTree.java
  2. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyClassController.java
  3. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsDutyClassMapper.java
  4. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyClassService.java
  5. 15
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyClassServiceImpl.java

29
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<DutyClassTypeTree> {
@ApiModelProperty("树ID")
private Long id;
@ApiModelProperty("父节点树ID")
@JsonIgnore
private Long parentId;
@ApiModelProperty("节点名称")
private String name;
@ApiModelProperty("子节点")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<DutyClassTypeTree> children;
}

10
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<List<DutyClassTypeTree>> getDutyClassTree(@RequestParam(required = false) @ApiParam(value = "机构id") Long deptId) {
return R.data(imsDutyClassService.getDutyClassTree(deptId));
}

8
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<ImsDutyClass
String getClassTypeIds(@Param("createDept") Long createDept,@Param("classTypeId") Long classTypeId);
List<DutyClassTypeTree> getDutyClassTree(@Param("deptId")Long deptId);
List<DutyClassTypeTree> getDutyClassByType(@Param("class_type_id") Long classTypeId);
List<DutyClassTypeTree> getDutyClassTypeByDept(@Param("create_dept") Long deptId);
}

4
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<ImsDutyClassEntity> {
R typeRemove(Long classTypeId);
List<DutyClassTypeTree> getDutyClassTree(Long deptId);
}

15
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;
/**
@ -26,6 +30,8 @@ public class ImsDutyClassServiceImpl extends BaseServiceImpl<ImsDutyClassMapper,
@Autowired
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<ImsDutyClassMapper,
return R.status(bool);
}
@Override
public List<DutyClassTypeTree> getDutyClassTree(Long deptId) {
List<DutyClassTypeTree> dutyClassTrees = this.baseMapper.getDutyClassTree(deptId);
dutyClassTrees.forEach(node -> {
node.setName(Optional.ofNullable(sysClient.getDeptName(node.getId())).map(R::getData).orElse(null));
});
return dutyClassTrees;
}
}

Loading…
Cancel
Save