fix:区划查询

master
wangxy 10 months ago
parent cead3320b1
commit 62be695f45

@ -1,5 +1,6 @@
package com.ruoyi.web.controller.manager; package com.ruoyi.web.controller.manager;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.SysArea; import com.ruoyi.system.domain.SysArea;
import com.ruoyi.system.service.SysAreaService; import com.ruoyi.system.service.SysAreaService;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -26,15 +27,15 @@ public class SysAreaManager {
public List<SysArea> getSysAreaList(Long parentId) { public List<SysArea> getSysAreaList(String parentId) {
return sysAreaService.lambdaQuery() return sysAreaService.lambdaQuery()
.eq(SysArea::getParentId, Objects.isNull(parentId) ? 29 : parentId) .eq(SysArea::getParentId, StringUtils.isEmpty(parentId) ? "29" : parentId)
.orderByAsc(SysArea::getAreaCode) .orderByAsc(SysArea::getAreaCode)
.list(); .list();
} }
public String getAreaName(Long id) { public String getAreaName(String id) {
return sysAreaService.lambdaQuery() return sysAreaService.lambdaQuery()
.eq(SysArea::getId,id).one().getName(); .eq(SysArea::getId,id).one().getName();
} }

@ -30,7 +30,7 @@ public class SysAreaController {
@ApiOperation("查询区划信息") @ApiOperation("查询区划信息")
@GetMapping("/getSysAreaList") @GetMapping("/getSysAreaList")
@ResponseBody @ResponseBody
public AjaxResult getSysAreaList(@RequestParam(required = false) Long parentId) { public AjaxResult getSysAreaList(@RequestParam(required = false) String parentId) {
return success(sysAreaManager.getSysAreaList(parentId)); return success(sysAreaManager.getSysAreaList(parentId));
} }
@ -38,7 +38,7 @@ public class SysAreaController {
@ApiOperation("获取区划名称") @ApiOperation("获取区划名称")
@GetMapping("/getAreaName") @GetMapping("/getAreaName")
@ResponseBody @ResponseBody
public AjaxResult getAreaName(@RequestParam Long id) { public AjaxResult getAreaName(@RequestParam String id) {
return success(sysAreaManager.getAreaName(id)); return success(sysAreaManager.getAreaName(id));
} }

@ -12,12 +12,12 @@ public class SysArea implements Serializable {
/** /**
* ID * ID
*/ */
private Integer id; private String id;
/** /**
* ID * ID
*/ */
private Integer parentId; private String parentId;
/** /**
* 1- 2- 3- 4- * 1- 2- 3- 4-

@ -5,8 +5,8 @@
<mapper namespace="com.ruoyi.system.mapper.SysAreaMapper"> <mapper namespace="com.ruoyi.system.mapper.SysAreaMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.system.domain.SysArea"> <resultMap id="BaseResultMap" type="com.ruoyi.system.domain.SysArea">
<id property="id" column="id" jdbcType="INTEGER"/> <id property="id" column="id" jdbcType="VARCHAR"/>
<result property="parentId" column="parent_id" jdbcType="INTEGER"/> <result property="parentId" column="parent_id" jdbcType="VARCHAR"/>
<result property="areaLevel" column="area_level" jdbcType="TINYINT"/> <result property="areaLevel" column="area_level" jdbcType="TINYINT"/>
<result property="name" column="name" jdbcType="VARCHAR"/> <result property="name" column="name" jdbcType="VARCHAR"/>
<result property="areaCode" column="area_code" jdbcType="VARCHAR"/> <result property="areaCode" column="area_code" jdbcType="VARCHAR"/>

Loading…
Cancel
Save