科室信息修改

This commit is contained in:
zhangheng 2024-02-27 09:30:39 +08:00
parent a52bbd168e
commit f8b4e26afc
7 changed files with 120 additions and 68 deletions

View File

@ -38,6 +38,11 @@ public class DepartmentController extends BaseController {
return getDataTable(list);
}
@GetMapping("/getDepartmentList")
public AjaxResult getDepartmentList(Department department) {
return AjaxResult.success(departmentService.selectDepartmentList(department));
}
/**
* 导出科室信息列表
*/

View File

@ -21,6 +21,14 @@ public interface AgencyMapper {
*/
Agency selectAgencyById(Long id);
/**
* 查询机构信息
*
* @param id 机构信息主键
* @return 机构信息
*/
AgencyVO selectAgencyVOById(Long id);
/**
* 查询机构信息列表
*

View File

@ -1,7 +1,7 @@
package com.xinelu.manage.service.agency;
import com.xinelu.manage.domain.agency.Agency;
import com.xinelu.manage.vo.agency.AgencyVO;
import com.xinelu.manage.vo.agency.AgencyTreeVO;
import java.util.List;
@ -66,5 +66,5 @@ public interface IAgencyService {
*
* @return AgencyVO
*/
List<AgencyVO> agencyList();
List<AgencyTreeVO> agencyList();
}

View File

@ -5,7 +5,7 @@ import com.xinelu.common.utils.StringUtils;
import com.xinelu.manage.domain.agency.Agency;
import com.xinelu.manage.mapper.agency.AgencyMapper;
import com.xinelu.manage.service.agency.IAgencyService;
import com.xinelu.manage.vo.agency.AgencyVO;
import com.xinelu.manage.vo.agency.AgencyTreeVO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -100,10 +100,10 @@ public class AgencyServiceImpl implements IAgencyService {
* @return AgencyVO
*/
@Override
public List<AgencyVO> agencyList() {
public List<AgencyTreeVO> agencyList() {
List<Agency> agencies = agencyMapper.selectAgencyList(null);
List<Agency> agenciesTree = buildDeptTree(agencies);
return agenciesTree.stream().map(AgencyVO::new).collect(Collectors.toList());
return agenciesTree.stream().map(AgencyTreeVO::new).collect(Collectors.toList());
}
public List<Agency> buildDeptTree(List<Agency> agencies) {

View File

@ -0,0 +1,75 @@
package com.xinelu.manage.vo.agency;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.xinelu.common.core.domain.entity.SysMenu;
import com.xinelu.manage.domain.agency.Agency;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
/**
* 机构树图信息对象vo agency
*
* @author xinelu
* @date 2024-02-26
*/
public class AgencyTreeVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 节点ID
*/
private Long id;
/**
* 节点名称
*/
private String label;
/**
* 子节点
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<AgencyTreeVO> children;
public AgencyTreeVO() {
}
public AgencyTreeVO(Agency agency) {
this.id = agency.getId();
this.label = agency.getAgencyName();
this.children = agency.getChildren().stream().map(AgencyTreeVO::new).collect(Collectors.toList());
}
public AgencyTreeVO(SysMenu menu) {
this.id = menu.getMenuId();
this.label = menu.getMenuName();
this.children = menu.getChildren().stream().map(AgencyTreeVO::new).collect(Collectors.toList());
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public List<AgencyTreeVO> getChildren() {
return children;
}
public void setChildren(List<AgencyTreeVO> children) {
this.children = children;
}
}

View File

@ -1,75 +1,15 @@
package com.xinelu.manage.vo.agency;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.xinelu.common.core.domain.entity.SysMenu;
import com.xinelu.manage.domain.agency.Agency;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
/**
* 机构信息对象vo agency
* 机构树图信息对象vo agency
*
* @author xinelu
* @date 2024-02-26
*/
public class AgencyVO implements Serializable {
private static final long serialVersionUID = 1L;
public class AgencyVO extends Agency {
/**
* 节点ID
*/
private Long id;
/**
* 节点名称
*/
private String label;
/**
* 子节点
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<AgencyVO> children;
public AgencyVO() {
private String a;
}
public AgencyVO(Agency agency) {
this.id = agency.getId();
this.label = agency.getAgencyName();
this.children = agency.getChildren().stream().map(AgencyVO::new).collect(Collectors.toList());
}
public AgencyVO(SysMenu menu) {
this.id = menu.getMenuId();
this.label = menu.getMenuName();
this.children = menu.getChildren().stream().map(AgencyVO::new).collect(Collectors.toList());
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public List<AgencyVO> getChildren() {
return children;
}
public void setChildren(List<AgencyVO> children) {
this.children = children;
}
}

View File

@ -95,6 +95,30 @@
<include refid="selectAgencyVo"/>
where id = #{id}
</select>
<select id="selectAgencyVOById" resultType="com.xinelu.manage.vo.agency.AgencyVO">
select id,
parent_id,
agency_category_id,
agency_category_name,
area_code,
area_name,
agency_name,
agency_code,
agency_abbreviation,
agency_status,
node_type,
org_agency_code,
agency_category_manage_level,
agency_contacts,
agency_phone,
agency_address,
agency_remark,
agency_sort,
(select agency_name from agency where id = parent_id)
from agency
where id = #{id}
</select>
<insert id="insertAgency" parameterType="Agency" useGeneratedKeys="true"
keyProperty="id">