添加行政区划接口
This commit is contained in:
@@ -0,0 +1,34 @@
|
|||||||
|
package com.ruoyi.cms.controller.cms;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ruoyi.cms.service.SysAreaService;
|
||||||
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysArea;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地区层级表
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
* @email
|
||||||
|
* @date 2025-11-10 15:56:00
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/cms/dict/sysarea")
|
||||||
|
@Anonymous
|
||||||
|
public class SysAreaController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysAreaService sysAreaService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public AjaxResult jobCategory(SysArea sysArea){
|
||||||
|
return AjaxResult.success(sysAreaService.getList(sysArea));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.ruoyi.cms.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysArea;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地区层级表
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
* @email
|
||||||
|
* @date 2025-11-10 15:56:00
|
||||||
|
*/
|
||||||
|
public interface SysAreaMapper{
|
||||||
|
|
||||||
|
List<SysArea> getList(SysArea sysArea);
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.ruoyi.cms.service;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysArea;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地区层级表
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
* @email
|
||||||
|
* @date 2025-11-10 15:56:00
|
||||||
|
*/
|
||||||
|
public interface SysAreaService{
|
||||||
|
|
||||||
|
List<SysArea> getList(SysArea sysArea);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.ruoyi.cms.service.impl;
|
||||||
|
|
||||||
|
import com.ruoyi.cms.mapper.SysAreaMapper;
|
||||||
|
import com.ruoyi.cms.service.SysAreaService;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysArea;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class SysAreaServiceImpl implements SysAreaService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
SysAreaMapper sysAreaMapper;
|
||||||
|
|
||||||
|
public List<SysArea> getList(SysArea sysArea){
|
||||||
|
return sysAreaMapper.getList(sysArea);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?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.cms.mapper.SysAreaMapper">
|
||||||
|
|
||||||
|
<sql id="selectAreaVo">
|
||||||
|
select id, code, name, parent_code, del_flag, create_by, create_time, update_by, update_time, remark from sys_area
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="getList" resultType="com.ruoyi.common.core.domain.entity.SysArea" parameterType="com.ruoyi.common.core.domain.entity.SysArea">
|
||||||
|
<include refid="selectAreaVo"/>
|
||||||
|
<where> del_flag = '0'
|
||||||
|
<if test="name != null and name != ''"> and company_name like concat('%', #{name}, '%')</if>
|
||||||
|
<if test="code != null and code != ''"> and code =#{code}</if>
|
||||||
|
<choose>
|
||||||
|
<when test="parentCode != null and parentCode != ''">
|
||||||
|
and parent_code =#{parentCode}
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
and parent_code is null
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
</where>
|
||||||
|
order by code
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.ruoyi.common.core.domain.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地区层级表
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
* @email
|
||||||
|
* @date 2025-11-10 15:56:00
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("sys_area")
|
||||||
|
public class SysArea extends BaseEntity {
|
||||||
|
@TableField(exist = false)
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 地区编码(唯一)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("地区编码(唯一)")
|
||||||
|
private String code;
|
||||||
|
/**
|
||||||
|
* 地区名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("地区名称")
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 父级地区编码(顶级为NULL)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("父级地区编码(顶级为NULL)")
|
||||||
|
private String parentCode;
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user