Commit 8a39e625 by 袁伟铭

新增获取机构信息接口

parent c7017ef3
......@@ -6,6 +6,7 @@ import com.zq.common.vo.ResultVo;
import com.zq.resource.entity.OrgDept;
import com.zq.resource.service.DeptService;
import com.zq.resource.vo.OrgDeptFindVo;
import com.zq.resource.vo.OrgDeptVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
......@@ -31,6 +32,13 @@ public class DeptController {
return ResultVo.success(deptService.getDeptList(vo));
}
@ApiOperation("获取机构信息")
@GetMapping(value = "/getDeptInfo/{deptId}")
public ResultVo<OrgDeptVo> getDeptInfo(@PathVariable Long deptId) {
AssertUtils.notNull(deptId, "缺少机构ID");
return ResultVo.success(deptService.getDeptInfo(deptId));
}
@ApiOperation("根据部门PID查询子机构")
@GetMapping(value = "/getDeptByPid/{parentId}")
public ResultVo<List<OrgDept>> getDeptByPid(@PathVariable Long parentId) {
......
package com.zq.resource.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
......@@ -12,6 +13,7 @@ import com.zq.resource.entity.OrgDept;
import com.zq.resource.utils.TreeUtils;
import com.zq.resource.vo.DataTreeVo;
import com.zq.resource.vo.OrgDeptFindVo;
import com.zq.resource.vo.OrgDeptVo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
......@@ -102,4 +104,19 @@ public class DeptService {
return TreeUtils.buildTree(collect, "0");
}
public OrgDeptVo getDeptInfo(Long deptId) {
OrgDept orgDept = orgDeptDao.selectById(deptId);
AssertUtils.notNull(orgDept, "机构不存在");
OrgDeptVo orgDeptVo = BeanUtil.copyProperties(orgDept, OrgDeptVo.class);
if (orgDept.getParentId() != null && orgDept.getParentId() != 0) {
OrgDept parentDept = orgDeptDao.selectById(orgDept.getParentId());
if (parentDept != null) {
orgDeptVo.setParentName(parentDept.getDeptName());
}
}
return orgDeptVo;
}
}
package com.zq.resource.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 机构表(OrgDept)实体类
*
* @author makejava
* @since 2021-08-19 11:28:38
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class OrgDeptVo {
/**
* 自增
*/
@ApiModelProperty("自增")
private Long id;
/**
* 上级机构id
*/
@ApiModelProperty("上级机构id")
private Long parentId;
/**
* 机构(部门)名称
*/
@ApiModelProperty("机构(部门)名称")
private String deptName;
/**
* 机构类型:1 业务处室 2二层机构 3二层机构业务科室
*/
@ApiModelProperty("机构类型:1 业务处室 2二层机构 3二层机构业务科室")
private Integer deptType;
/**
* 行政区域编号
*/
@ApiModelProperty("行政区域编号")
private String areaCode;
/**
* 地址
*/
@ApiModelProperty("地址")
private String address;
/**
* 联系电话
*/
@ApiModelProperty("联系电话")
private String tel;
/**
* 编制(人员数量)
*/
@ApiModelProperty("编制(人员数量)")
private Integer totalOrgStaff;
/**
* 在编(人员数量)
*/
@ApiModelProperty("在编(人员数量)")
private Integer currOrgStaff;
/**
* 主要职责
*/
@ApiModelProperty("主要职责")
private String responsibility;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
/**
* 上级机构名称
*/
@ApiModelProperty("上级机构名称")
private String parentName;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment