fix:区划查询

master
wangxy 10 months ago
parent 51a5a384ff
commit dc8d20b3a2

@ -0,0 +1,42 @@
package com.ruoyi.web.controller.manager;
import com.ruoyi.common.core.domain.Ztree;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.SysArea;
import com.ruoyi.system.service.SysAreaService;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;
/**
* packageName com.ruoyi.web.controller.manager
*
* @author wangxy
* @version JDK 8
* @className SysAreaManager
* @date 2024/5/28
* @description
*/
@Component
public class SysAreaManager {
@Resource
private SysAreaService sysAreaService;
public List<SysArea> getSysAreaList(Long parentId) {
return sysAreaService.lambdaQuery()
.eq(SysArea::getParentId, Objects.isNull(parentId) ? 29 : parentId)
.list();
}
}

@ -0,0 +1,41 @@
package com.ruoyi.web.controller.system.system;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.Ztree;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.system.domain.SysArea;
import com.ruoyi.web.controller.manager.SysAreaManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import static com.ruoyi.common.core.domain.AjaxResult.success;
/**
* packageName com.ruoyi.web.controller.system.system
*
* @author wangxy
* @version JDK 8
* @className SysAreaController
* @date 2024/5/28
* @description
*/
@Api("区划")
@Controller
@RequestMapping("/system/area")
public class SysAreaController {
@Resource
private SysAreaManager sysAreaManager;
@ApiOperation("查询区划信息")
@GetMapping("/getSysAreaList")
@ResponseBody
public AjaxResult getSysAreaList(@RequestParam(required = false) Long parentId) {
return success(sysAreaManager.getSysAreaList(parentId));
}
}

@ -0,0 +1,39 @@
package com.ruoyi.system.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
/**
*
* @TableName sys_area
*/
@Data
public class SysArea implements Serializable {
/**
* ID
*/
private Integer id;
/**
* ID
*/
private Integer parentId;
/**
* 1- 2- 3- 4-
*/
private Integer areaLevel;
/**
*
*/
private String name;
/**
*
*/
private String areaCode;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,19 @@
package com.ruoyi.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.domain.SysArea;
/**
* @author 13560
* @description sys_area()Mapper
* @createDate 2024-05-28 14:06:56
* @Entity generator.domain.SysArea
*/
public interface SysAreaMapper extends BaseMapper<SysArea> {
}

@ -0,0 +1,13 @@
package com.ruoyi.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.system.domain.SysArea;
/**
* @author 13560
* @description sys_area()Service
* @createDate 2024-05-28 14:06:56
*/
public interface SysAreaService extends IService<SysArea> {
}

@ -0,0 +1,22 @@
package com.ruoyi.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.system.domain.SysArea;
import com.ruoyi.system.mapper.SysAreaMapper;
import com.ruoyi.system.service.SysAreaService;
import org.springframework.stereotype.Service;
/**
* @author 13560
* @description sys_area()Service
* @createDate 2024-05-28 14:06:56
*/
@Service
public class SysAreaServiceImpl extends ServiceImpl<SysAreaMapper, SysArea>
implements SysAreaService {
}

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.SysAreaMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.system.domain.SysArea">
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="parentId" column="parent_id" jdbcType="INTEGER"/>
<result property="areaLevel" column="area_level" jdbcType="TINYINT"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="areaCode" column="area_code" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id,parent_id,area_level,
name,area_code
</sql>
</mapper>
Loading…
Cancel
Save