省市区修改

main
王宇航 2024-05-13 11:38:40 +08:00
parent 6150994d71
commit 7c081d82b0
4 changed files with 33 additions and 4 deletions

View File

@ -96,7 +96,7 @@ public class AppAreaController extends BaseController {
* id
*/
@GetMapping("/getTownById")
@ApiOperation(value = "省市区树状结构", notes = "省市区树状结构", httpMethod = "GET")
@ApiOperation(value = "区id查询区名称", notes = "区id查询区名称", httpMethod = "GET")
public AjaxResult getTownById(@RequestParam("townId") Integer townId) {
return AjaxResult.success(appTownService.getTownById(townId));
}

View File

@ -91,6 +91,11 @@ public class AppUser extends BaseEntity
@Excel(name = "在职时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date jobTime;
/** 在职结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "在职时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date jobEndTime;
/** 职位名称 */
@Excel(name = "职位名称")
private String jobName;

View File

@ -102,10 +102,9 @@ public class AppProvinceServiceImpl implements IAppProvinceService {
@Override
public List<AreaVo> selectAppProvinceTree() {
// 查询所有省级列表
List<AppProvince> appProvinces = appProvinceMapper.selectAppProvinceList(null);
return appProvinces.stream()
List<AreaVo> collect = appProvinces.stream()
.map(appProvince -> {
AreaVo areaVo = new AreaVo();
areaVo.setId(appProvince.getId());
@ -119,6 +118,7 @@ public class AppProvinceServiceImpl implements IAppProvinceService {
}
List<AreaVo> children = appCities.stream()
.filter(appCity -> !appCity.getId().equals(appCity.getId()))
.map(appCity -> {
AreaVo child = new AreaVo();
child.setId(appCity.getId());
@ -132,6 +132,7 @@ public class AppProvinceServiceImpl implements IAppProvinceService {
}
List<AreaVo> townChildren = appTowns.stream()
.filter(appTown -> !appTown.getId().equals(appCity.getId())) // Filter out where child id is same as parent id
.map(appTown -> {
AreaVo townChild = new AreaVo();
townChild.setId(appTown.getId());
@ -151,6 +152,29 @@ public class AppProvinceServiceImpl implements IAppProvinceService {
return areaVo;
})
.collect(Collectors.toList());
collect.stream().forEach(
areaVo -> {
if (areaVo.getChildren() == null || areaVo.getChildren().isEmpty()) {
areaVo.setIsLeaf(true);
}
if ( areaVo.getLevel() == 1 && areaVo.getChildren().isEmpty()) {
ArrayList<AreaVo> areaVos = new ArrayList<>();
AppTown appTown1 = new AppTown();
appTown1.setCityId(Long.valueOf(areaVo.getId()));
List<AppTown> appTowns1 = appTownMapper.selectAppTownList(appTown1);
List<AreaVo> townChildren = appTowns1.stream().map(appTown -> {
AreaVo townChild = new AreaVo();
townChild.setId(appTown.getId());
townChild.setName(appTown.getName());
townChild.setLevel(3);
townChild.setIsLeaf(true);
return townChild;
}).collect(Collectors.toList());
areaVo.setChildren(townChildren);
}
}
);
return collect;
}
}

View File

@ -83,7 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<sql id="selectAppUserVo">
select id, username, password, nickname, email, phone, address, create_time, update_time, avatar_url, education, school, major, start_time, end_time, experience, company_name, industry, job_time, job_name, job_type, skill_id, job_content, type,is_member,
select id, username, password, nickname, email, phone, address, create_time, update_time, avatar_url, education, school, major, start_time, end_time, experience, company_name, industry, job_time, job_name, job_type, skill_id, job_content, type,is_member,job_end_time,
order_id, order_start_time, order_end_time from app_user
</sql>