区域修改

This commit is contained in:
zhangheng 2024-02-27 18:03:31 +08:00
parent aff9c75d6b
commit 7e4e183993
10 changed files with 176 additions and 15 deletions

View File

@ -68,7 +68,7 @@ public class AgencyController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:agency:add')")
@Log(title = "机构信息", businessType = BusinessType.INSERT)
@PostMapping
@PostMapping("/add")
public AjaxResult add(@RequestBody Agency agency) {
return toAjax(agencyService.insertAgency(agency));
}
@ -78,7 +78,7 @@ public class AgencyController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:agency:edit')")
@Log(title = "机构信息", businessType = BusinessType.UPDATE)
@PutMapping
@PutMapping("/edit")
public AjaxResult edit(@RequestBody Agency agency) {
return toAjax(agencyService.updateAgency(agency));
}

View File

@ -65,7 +65,7 @@ public class AgencyCategoryController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:agencyCategory:add')")
@Log(title = "机构类别", businessType = BusinessType.INSERT)
@PostMapping
@PostMapping("/add")
public AjaxResult add(@RequestBody AgencyCategory agencyCategory) {
if (Objects.isNull(agencyCategory)) {
return AjaxResult.success();
@ -78,7 +78,7 @@ public class AgencyCategoryController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:agencyCategory:edit')")
@Log(title = "机构类别", businessType = BusinessType.UPDATE)
@PutMapping
@PutMapping("/edit")
public AjaxResult edit(@RequestBody AgencyCategory agencyCategory) {
return toAjax(agencyCategoryService.updateAgencyCategory(agencyCategory));
}

View File

@ -69,7 +69,7 @@ public class DepartmentController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:department:add')")
@Log(title = "科室信息", businessType = BusinessType.INSERT)
@PostMapping
@PostMapping("/add")
public AjaxResult add(@RequestBody Department department) {
return toAjax(departmentService.insertDepartment(department));
}
@ -79,7 +79,7 @@ public class DepartmentController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:department:edit')")
@Log(title = "科室信息", businessType = BusinessType.UPDATE)
@PutMapping
@PutMapping("/edit")
public AjaxResult edit(@RequestBody Department department) {
return toAjax(departmentService.updateDepartment(department));
}

View File

@ -64,7 +64,7 @@ public class DepartmentDiseaseTypeController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:departmentDisease:add')")
@Log(title = "科室病种信息", businessType = BusinessType.INSERT)
@PostMapping
@PostMapping("/add")
public AjaxResult add(@RequestBody DepartmentDiseaseType departmentDiseaseType) {
return toAjax(departmentDiseaseTypeService.insertDepartmentDiseaseType(departmentDiseaseType));
}
@ -74,7 +74,7 @@ public class DepartmentDiseaseTypeController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:departmentDisease:edit')")
@Log(title = "科室病种信息", businessType = BusinessType.UPDATE)
@PutMapping
@PutMapping("/edit")
public AjaxResult edit(@RequestBody DepartmentDiseaseType departmentDiseaseType) {
return toAjax(departmentDiseaseTypeService.updateDepartmentDiseaseType(departmentDiseaseType));
}

View File

@ -1,6 +1,8 @@
package com.xinelu.manage.mapper.sysarea;
import com.xinelu.manage.domain.sysarea.SysArea;
import com.xinelu.manage.vo.sysarea.SysAreaVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -19,4 +21,12 @@ public interface SysAreaMapper {
* @return 区域集合
*/
List<SysArea> selectSysAreaList(SysArea sysArea);
/**
* 下级区域寻找上级区域
*
* @param areaCode 区域编码
* @return com.xinyilu.base.domain.vo.sysarea.SysAreaVO
**/
SysAreaVO getSubordinateRegionsFindSuperiorRegions(@Param("areaCode") String areaCode);
}

View File

@ -1,19 +1,19 @@
package com.xinelu.manage.service.agency.impl;
import com.xinelu.common.constant.Constants;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.DateUtils;
import com.xinelu.common.utils.SecurityUtils;
import com.xinelu.common.utils.StringUtils;
import com.xinelu.common.utils.bean.BeanUtils;
import com.xinelu.common.utils.codes.GenerateSystemCodeUtil;
import com.xinelu.common.utils.regex.RegexUtil;
import com.xinelu.manage.domain.agency.Agency;
import com.xinelu.manage.mapper.agency.AgencyMapper;
import com.xinelu.manage.mapper.sysarea.SysAreaMapper;
import com.xinelu.manage.service.agency.IAgencyService;
import com.xinelu.manage.vo.agency.AgencyTreeVO;
import com.xinelu.manage.vo.agency.AgencyVO;
import com.xinelu.manage.vo.sysarea.SysAreaVO;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.springframework.stereotype.Service;
@ -40,7 +40,7 @@ public class AgencyServiceImpl implements IAgencyService {
@Resource
private RegexUtil regexUtil;
@Resource
private GenerateSystemCodeUtil generateSystemCodeUtil;
private SysAreaMapper sysAreaMapper;
/**
* 查询机构信息
@ -50,7 +50,19 @@ public class AgencyServiceImpl implements IAgencyService {
*/
@Override
public AgencyVO selectAgencyById(Long id) {
return agencyMapper.selectAgencyVOById(id);
AgencyVO agency = agencyMapper.selectAgencyVOById(id);
if (StringUtils.isNotBlank(agency.getAreaCode())) {
SysAreaVO nurseStationAndAreaCode = sysAreaMapper.getSubordinateRegionsFindSuperiorRegions(agency.getAreaCode());
agency.setProvinceCode(StringUtils.isBlank(nurseStationAndAreaCode.getProvinceCode()) ? "" : nurseStationAndAreaCode.getProvinceCode());
agency.setProvinceName(StringUtils.isBlank(nurseStationAndAreaCode.getProvinceName()) ? "" : nurseStationAndAreaCode.getProvinceName());
agency.setCityCode(StringUtils.isBlank(nurseStationAndAreaCode.getCityCode()) ? "" : nurseStationAndAreaCode.getCityCode());
agency.setCityName(StringUtils.isBlank(nurseStationAndAreaCode.getCityName()) ? "" : nurseStationAndAreaCode.getCityName());
agency.setRegionCode(StringUtils.isBlank(nurseStationAndAreaCode.getRegionCode()) ? "" : nurseStationAndAreaCode.getRegionCode());
agency.setRegionName(StringUtils.isBlank(nurseStationAndAreaCode.getRegionName()) ? "" : nurseStationAndAreaCode.getRegionName());
agency.setStreetCode(StringUtils.isBlank(nurseStationAndAreaCode.getStreetCode()) ? "" : nurseStationAndAreaCode.getStreetCode());
agency.setStreetName(StringUtils.isBlank(nurseStationAndAreaCode.getStreetName()) ? "" : nurseStationAndAreaCode.getStreetName());
}
return agency;
}
/**

View File

@ -18,6 +18,47 @@ import java.util.List;
@Data
public class AgencyVO extends Agency {
/**
* 主键id
*/
private String provinceName;
/**
* 父级id
*/
private String provinceCode;
/**
* 主键id
*/
private String cityName;
/**
* 父级id
*/
private String cityCode;
/**
* 主键id
*/
private String regionName;
/**
* 父级id
*/
private String regionCode;
/**
* 主键id
*/
private String streetName;
/**
* 父级id
*/
private String streetCode;
/**
* 上级机构
*/

View File

@ -0,0 +1,60 @@
package com.xinelu.manage.vo.sysarea;
import lombok.Data;
import java.io.Serializable;
/**
* @author ljh
* @version 1.0
* Create by 2022/9/20 17:58
*/
@Data
public class SysAreaVO implements Serializable {
private static final long serialVersionUID = -6098312186830650793L;
/**
* 省名称
*/
private String provinceName;
/**
* 省区域编码
*/
private String provinceCode;
/**
* 市名称
*/
private String cityName;
/**
* 市区域编码
*/
private String cityCode;
/**
* 区域名称
*/
private String regionName;
/**
* 区区域编码
*/
private String regionCode;
/**
* 街道名称
*/
private String streetName;
/**
* 街道区域编码
*/
private String streetCode;
/**
* 街道区域编码
*/
private String areaCode;
}

View File

@ -366,7 +366,6 @@
<insert id="insertAgencyImportList" parameterType="java.util.List">
insert into agency(
select
parent_id,
agency_category_id,
agency_category_name,
@ -383,7 +382,9 @@
agency_phone,
agency_address,
agency_remark,
agency_sort
agency_sort,
create_by,
create_time
) values
<foreach item="Agency" index="index" collection="list" separator=",">
(
@ -403,7 +404,9 @@
#{Agency.agencyPhone},
#{Agency.agencyAddress},
#{Agency.agencyRemark},
#{Agency.agencySort}
#{Agency.agencySort},
#{Agency.createBy},
#{Agency.createTime}
)
</foreach>
</insert>

View File

@ -57,4 +57,39 @@
</where>
order by sort
</select>
<select id="getSubordinateRegionsFindSuperiorRegions" parameterType="String"
resultType="com.xinelu.manage.vo.sysarea.SysAreaVO">
SELECT province.area_name province_name,
province.area_code province_code,
city.area_name city_name,
city.area_code city_code,
region.area_name region_name,
region.area_code region_code,
street.area_name street_name,
street.area_code street_code
FROM sys_area province,
sys_area city,
sys_area region,
sys_area street
WHERE city.parent_code = province.area_code
AND region.parent_code = city.area_code
AND street.parent_code = region.area_code
AND street.area_code = #{areaCode}
UNION ALL
SELECT province.area_name province_name,
province.area_code province_code,
city.area_name city_name,
city.area_code city_code,
region.area_name region_name,
region.area_code region_code,
'' street_name,
'' street_code
FROM sys_area province,
sys_area city,
sys_area region
WHERE city.parent_code = province.area_code
AND region.parent_code = city.area_code
AND region.area_code = #{areaCode} limit 1;
</select>
</mapper>