【8.0】【dict】单独抽出行政区域模块

pull/57/head
fengshuonan 2023-07-10 21:17:07 +08:00
parent 555f70c3af
commit dc0a1c991c
16 changed files with 348 additions and 279 deletions

View File

@ -1,97 +0,0 @@
<?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="cn.stylefeng.roses.kernel.dict.modular.mapper.AreaMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.stylefeng.roses.kernel.dict.modular.entity.Area">
<id column="area_id" property="areaId" />
<result column="area_code" property="areaCode" />
<result column="area_name" property="areaName" />
<result column="parent_id" property="parentId" />
<result column="area_level" property="areaLevel" />
<result column="area_sort" property="areaSort" />
<result column="del_flag" property="delFlag" />
<result column="area_pids" property="areaPids" />
<result column="create_time" property="createTime" />
<result column="create_user" property="createUser" />
<result column="update_time" property="updateTime" />
<result column="update_user" property="updateUser" />
</resultMap>
<resultMap id="customResultMap" type="cn.stylefeng.roses.kernel.dict.modular.pojo.AreaVo" extends="BaseResultMap">
</resultMap>
<sql id="Base_Column_List">
area_id,area_code,area_name,parent_id,area_level,area_sort,del_flag,area_pids,create_time,create_user,update_time,update_user
</sql>
<select id="selectAll" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
sys_area
</select>
<select id="customFindList" resultMap="customResultMap">
SELECT
tbl.area_id,
tbl.area_code,
tbl.area_name,
tbl.parent_id,
tbl.area_level,
tbl.area_sort,
tbl.del_flag,
tbl.area_pids,
tbl.create_time,
tbl.create_user,
tbl.update_time,
tbl.update_user
FROM
sys_area tbl
WHERE tbl.del_flag = 'N'
<if test="param.areaId != null ">
and tbl.area_id = #{param.areaId}
</if>
<if test="param.areaCode != null and param.areaCode != ''">
and tbl.area_code like concat('%',#{param.areaCode},'%')
</if>
<if test="param.areaName != null and param.areaName != ''">
and tbl.area_name like concat('%',#{param.areaName},'%')
</if>
<if test="param.parentId != null and param.parentId != ''">
and tbl.parent_id like concat('%',#{param.parentId},'%')
</if>
<if test="param.areaLevel != null ">
and tbl.area_level = #{param.areaLevel}
</if>
<if test="param.areaSort != null ">
and tbl.area_sort = #{param.areaSort}
</if>
<if test="param.delFlag != null and param.delFlag != ''">
and tbl.del_flag like concat('%',#{param.delFlag},'%')
</if>
<if test="param.areaPids != null and param.areaPids != ''">
and tbl.area_pids like concat('%',#{param.areaPids},'%')
</if>
<if test="param.createTime != null ">
and tbl.create_time = #{param.createTime}
</if>
<if test="param.createUser != null ">
and tbl.create_user = #{param.createUser}
</if>
<if test="param.updateTime != null ">
and tbl.update_time = #{param.updateTime}
</if>
<if test="param.updateUser != null ">
and tbl.update_user = #{param.updateUser}
</if>
</select>
</mapper>

View File

@ -1,18 +0,0 @@
package cn.stylefeng.roses.kernel.dict.modular.pojo;
import cn.stylefeng.roses.kernel.dict.modular.entity.Area;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import lombok.Data;
/**
* -
*
* @author LiYanJun
* @date 2023/07/05 18:12
*/
@Data
public class AreaVo extends Area {
}

View File

@ -1,126 +0,0 @@
package cn.stylefeng.roses.kernel.dict.modular.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.stylefeng.roses.kernel.rule.constants.TreeConstants;
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
import cn.stylefeng.roses.kernel.dict.modular.entity.Area;
import cn.stylefeng.roses.kernel.dict.modular.enums.AreaExceptionEnum;
import cn.stylefeng.roses.kernel.dict.modular.mapper.AreaMapper;
import cn.stylefeng.roses.kernel.dict.modular.pojo.AreaVo;
import cn.stylefeng.roses.kernel.dict.modular.pojo.request.AreaRequest;
import cn.stylefeng.roses.kernel.dict.modular.service.AreaService;
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Date;
import java.math.BigDecimal;
/**
* -
*
* @author LiYanJun
* @date 2023/07/05 18:12
*/
@Service
public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements AreaService {
@Override
public void add(AreaRequest areaRequest) {
Area area = new Area();
BeanUtil.copyProperties(areaRequest, area);
this.save(area);
}
@Override
public void del(AreaRequest areaRequest) {
Area area = this.queryArea(areaRequest);
this.removeById(area.getAreaId());
}
@Override
public void edit(AreaRequest areaRequest) {
Area area = this.queryArea(areaRequest);
BeanUtil.copyProperties(areaRequest, area);
this.updateById(area);
}
@Override
public Area detail(AreaRequest areaRequest) {
return this.queryArea(areaRequest);
}
@Override
public PageResult<AreaVo> findPage(AreaRequest areaRequest) {
Page<AreaVo> page = PageFactory.defaultPage();
List<AreaVo> list = baseMapper.customFindList(page, areaRequest);
PageResult<AreaVo> pageResult = PageResultFactory.createPageResult(page.setRecords(list));
return pageResult;
}
@Override
public List<Area> findList(AreaRequest areaRequest) {
LambdaQueryWrapper<Area> queryWrapper = new LambdaQueryWrapper<>();
String parentId = areaRequest.getParentId();
if(ObjectUtil.isEmpty(parentId)) {
parentId=TreeConstants.DEFAULT_PARENT_ID.toString();
}
queryWrapper.select(Area::getAreaId,Area::getAreaName,Area::getAreaCode);
queryWrapper.eq(Area::getParentId, parentId);
queryWrapper.orderByAsc(Area::getAreaSort);
return this.list(queryWrapper);
}
/**
*
*
* @author LiYanJun
* @date 2023/07/05 18:12
*/
private Area queryArea(AreaRequest areaRequest) {
Area area = this.getById(areaRequest.getAreaId());
if (ObjectUtil.isEmpty(area)) {
throw new ServiceException(AreaExceptionEnum.AREA_NOT_EXISTED);
}
return area;
}
/**
* wrapper
*
* @author LiYanJun
* @date 2023/07/05 18:12
*/
private LambdaQueryWrapper<Area> createWrapper(AreaRequest areaRequest) {
LambdaQueryWrapper<Area> queryWrapper = new LambdaQueryWrapper<>();
Long areaId = areaRequest.getAreaId();
String areaCode = areaRequest.getAreaCode();
String areaName = areaRequest.getAreaName();
String parentId = areaRequest.getParentId();
Integer areaLevel = areaRequest.getAreaLevel();
BigDecimal areaSort = areaRequest.getAreaSort();
String delFlag = areaRequest.getDelFlag();
String areaPids = areaRequest.getAreaPids();
queryWrapper.eq(ObjectUtil.isNotNull(areaId), Area::getAreaId, areaId);
queryWrapper.like(ObjectUtil.isNotEmpty(areaCode), Area::getAreaCode, areaCode);
queryWrapper.like(ObjectUtil.isNotEmpty(areaName), Area::getAreaName, areaName);
queryWrapper.like(ObjectUtil.isNotEmpty(parentId), Area::getParentId, parentId);
queryWrapper.eq(ObjectUtil.isNotNull(areaLevel), Area::getAreaLevel, areaLevel);
queryWrapper.eq(ObjectUtil.isNotNull(areaSort), Area::getAreaSort, areaSort);
queryWrapper.like(ObjectUtil.isNotEmpty(delFlag), Area::getDelFlag, delFlag);
queryWrapper.like(ObjectUtil.isNotEmpty(areaPids), Area::getAreaPids, areaPids);
return queryWrapper;
}
}

View File

@ -0,0 +1 @@
城市-省市县联动的字典

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-s-dict</artifactId>
<version>8.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>dict-city-business</artifactId>
<packaging>jar</packaging>
<dependencies>
<!--字典模块api-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>dict-api</artifactId>
<version>${roses.version}</version>
</dependency>
<!--缓存的依赖-->
<!--字典缓存的使用-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>cache-api</artifactId>
<version>${roses.version}</version>
</dependency>
<!--资源api模块-->
<!--用在资源控制器,资源扫描上-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>scanner-api</artifactId>
<version>${roses.version}</version>
</dependency>
<!--参数校验模块-->
<!--用在控制器,参数校验-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>validator-api-table-unique</artifactId>
<version>${roses.version}</version>
</dependency>
<!--数据库sdk-->
<!--数据库dao框架-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>db-sdk-mp</artifactId>
<version>${roses.version}</version>
</dependency>
<!--web模块-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -1,11 +1,10 @@
package cn.stylefeng.roses.kernel.dict.modular.controller;
package cn.stylefeng.roses.kernel.city.modular.controller;
import cn.stylefeng.roses.kernel.city.modular.entity.Area;
import cn.stylefeng.roses.kernel.city.modular.pojo.AreaVo;
import cn.stylefeng.roses.kernel.city.modular.pojo.request.AreaRequest;
import cn.stylefeng.roses.kernel.city.modular.service.AreaService;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.dict.modular.entity.Area;
import cn.stylefeng.roses.kernel.dict.modular.pojo.AreaVo;
import cn.stylefeng.roses.kernel.dict.modular.pojo.request.AreaRequest;
import cn.stylefeng.roses.kernel.dict.modular.service.AreaService;
import cn.stylefeng.roses.kernel.rule.enums.ResBizTypeEnum;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
@ -19,13 +18,13 @@ import javax.annotation.Resource;
import java.util.List;
/**
* -
*
*
* @author LiYanJun
* @date 2023/07/05 18:12
*/
@RestController
@ApiResource(name = "行政区域", resBizType = ResBizTypeEnum.SYSTEM)
@ApiResource(name = "行政区域")
public class AreaController {
@Resource

View File

@ -1,4 +1,4 @@
package cn.stylefeng.roses.kernel.dict.modular.entity;
package cn.stylefeng.roses.kernel.city.modular.entity;
import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseEntity;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
@ -9,11 +9,10 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.math.BigDecimal;
/**
* -
*
*
* @author LiYanJun
* @date 2023/07/05 18:12

View File

@ -1,11 +1,11 @@
package cn.stylefeng.roses.kernel.dict.modular.enums;
package cn.stylefeng.roses.kernel.city.modular.enums;
import cn.stylefeng.roses.kernel.rule.constants.RuleConstants;
import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum;
import lombok.Getter;
/**
* -
*
*
* @author LiYanJun
* @date 2023/07/05 18:12
@ -16,7 +16,7 @@ public enum AreaExceptionEnum implements AbstractExceptionEnum {
/**
*
*/
AREA_NOT_EXISTED(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10001", "查询结果不存在");
AREA_NOT_EXISTED(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10001", "查询结果不存在");
/**
*

View File

@ -1,20 +1,22 @@
package cn.stylefeng.roses.kernel.dict.modular.mapper;
package cn.stylefeng.roses.kernel.city.modular.mapper;
import cn.stylefeng.roses.kernel.city.modular.entity.Area;
import cn.stylefeng.roses.kernel.city.modular.pojo.AreaVo;
import cn.stylefeng.roses.kernel.city.modular.pojo.request.AreaRequest;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.stylefeng.roses.kernel.dict.modular.entity.Area;
import cn.stylefeng.roses.kernel.dict.modular.pojo.AreaVo;
import cn.stylefeng.roses.kernel.dict.modular.pojo.request.AreaRequest;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* - Mapper
* Mapper
*
* @author LiYanJun
* @date 2023/07/05 18:12
*/
public interface AreaMapper extends BaseMapper<Area> {
List<AreaVo> customFindList(@Param("page") Page page, @Param("param")AreaRequest request);
List<AreaVo> customFindList(@Param("page") Page page, @Param("param") AreaRequest request);
}

View File

@ -0,0 +1,96 @@
<?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="cn.stylefeng.roses.kernel.city.modular.mapper.AreaMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.stylefeng.roses.kernel.city.modular.entity.Area">
<id column="area_id" property="areaId"/>
<result column="area_code" property="areaCode"/>
<result column="area_name" property="areaName"/>
<result column="parent_id" property="parentId"/>
<result column="area_level" property="areaLevel"/>
<result column="area_sort" property="areaSort"/>
<result column="del_flag" property="delFlag"/>
<result column="area_pids" property="areaPids"/>
<result column="create_time" property="createTime"/>
<result column="create_user" property="createUser"/>
<result column="update_time" property="updateTime"/>
<result column="update_user" property="updateUser"/>
</resultMap>
<resultMap id="customResultMap" type="cn.stylefeng.roses.kernel.city.modular.pojo.AreaVo" extends="BaseResultMap">
</resultMap>
<sql id="Base_Column_List">
area_id
,area_code,area_name,parent_id,area_level,area_sort,del_flag,area_pids,create_time,create_user,update_time,update_user
</sql>
<select id="selectAll" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
sys_area
</select>
<select id="customFindList" resultMap="customResultMap">
SELECT
tbl.area_id,
tbl.area_code,
tbl.area_name,
tbl.parent_id,
tbl.area_level,
tbl.area_sort,
tbl.del_flag,
tbl.area_pids,
tbl.create_time,
tbl.create_user,
tbl.update_time,
tbl.update_user
FROM
sys_area tbl
WHERE tbl.del_flag = 'N'
<if test="param.areaId != null ">
and tbl.area_id = #{param.areaId}
</if>
<if test="param.areaCode != null and param.areaCode != ''">
and tbl.area_code like concat('%',#{param.areaCode},'%')
</if>
<if test="param.areaName != null and param.areaName != ''">
and tbl.area_name like concat('%',#{param.areaName},'%')
</if>
<if test="param.parentId != null and param.parentId != ''">
and tbl.parent_id like concat('%',#{param.parentId},'%')
</if>
<if test="param.areaLevel != null ">
and tbl.area_level = #{param.areaLevel}
</if>
<if test="param.areaSort != null ">
and tbl.area_sort = #{param.areaSort}
</if>
<if test="param.delFlag != null and param.delFlag != ''">
and tbl.del_flag like concat('%',#{param.delFlag},'%')
</if>
<if test="param.areaPids != null and param.areaPids != ''">
and tbl.area_pids like concat('%',#{param.areaPids},'%')
</if>
<if test="param.createTime != null ">
and tbl.create_time = #{param.createTime}
</if>
<if test="param.createUser != null ">
and tbl.create_user = #{param.createUser}
</if>
<if test="param.updateTime != null ">
and tbl.update_time = #{param.updateTime}
</if>
<if test="param.updateUser != null ">
and tbl.update_user = #{param.updateUser}
</if>
</select>
</mapper>

View File

@ -0,0 +1,17 @@
package cn.stylefeng.roses.kernel.city.modular.pojo;
import cn.stylefeng.roses.kernel.city.modular.entity.Area;
import lombok.Data;
/**
*
*
* @author LiYanJun
* @date 2023/07/05 18:12
*/
@Data
public class AreaVo extends Area {
}

View File

@ -1,18 +1,16 @@
package cn.stylefeng.roses.kernel.dict.modular.pojo.request;
package cn.stylefeng.roses.kernel.city.modular.pojo.request;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.math.BigDecimal;
/**
* -
*
*
* @author LiYanJun
* @date 2023/07/05 18:12

View File

@ -1,22 +1,22 @@
package cn.stylefeng.roses.kernel.dict.modular.service;
package cn.stylefeng.roses.kernel.city.modular.service;
import cn.stylefeng.roses.kernel.city.modular.entity.Area;
import cn.stylefeng.roses.kernel.city.modular.pojo.AreaVo;
import cn.stylefeng.roses.kernel.city.modular.pojo.request.AreaRequest;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.dict.modular.entity.Area;
import cn.stylefeng.roses.kernel.dict.modular.pojo.AreaVo;
import cn.stylefeng.roses.kernel.dict.modular.pojo.request.AreaRequest;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* -
*
*
* @author LiYanJun
* @date 2023/07/05 18:12
*/
public interface AreaService extends IService<Area> {
/**
/**
*
*
* @param areaRequest
@ -25,7 +25,7 @@ public interface AreaService extends IService<Area> {
*/
void add(AreaRequest areaRequest);
/**
/**
*
*
* @param areaRequest
@ -34,7 +34,7 @@ public interface AreaService extends IService<Area> {
*/
void del(AreaRequest areaRequest);
/**
/**
*
*
* @param areaRequest
@ -43,7 +43,7 @@ public interface AreaService extends IService<Area> {
*/
void edit(AreaRequest areaRequest);
/**
/**
*
*
* @param areaRequest
@ -52,20 +52,20 @@ public interface AreaService extends IService<Area> {
*/
Area detail(AreaRequest areaRequest);
/**
/**
*
*
* @param areaRequest
* @param areaRequest
* @return List<Area>
* @author LiYanJun
* @date 2023/07/05 18:12
*/
List<Area> findList(AreaRequest areaRequest);
/**
/**
*
*
* @param areaRequest
* @param areaRequest
* @return PageResult<Area>
* @author LiYanJun
* @date 2023/07/05 18:12

View File

@ -0,0 +1,123 @@
package cn.stylefeng.roses.kernel.city.modular.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.stylefeng.roses.kernel.city.modular.entity.Area;
import cn.stylefeng.roses.kernel.city.modular.enums.AreaExceptionEnum;
import cn.stylefeng.roses.kernel.city.modular.mapper.AreaMapper;
import cn.stylefeng.roses.kernel.city.modular.pojo.AreaVo;
import cn.stylefeng.roses.kernel.city.modular.pojo.request.AreaRequest;
import cn.stylefeng.roses.kernel.city.modular.service.AreaService;
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.rule.constants.TreeConstants;
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.List;
/**
*
*
* @author LiYanJun
* @date 2023/07/05 18:12
*/
@Service
public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements AreaService {
@Override
public void add(AreaRequest areaRequest) {
Area area = new Area();
BeanUtil.copyProperties(areaRequest, area);
this.save(area);
}
@Override
public void del(AreaRequest areaRequest) {
Area area = this.queryArea(areaRequest);
this.removeById(area.getAreaId());
}
@Override
public void edit(AreaRequest areaRequest) {
Area area = this.queryArea(areaRequest);
BeanUtil.copyProperties(areaRequest, area);
this.updateById(area);
}
@Override
public Area detail(AreaRequest areaRequest) {
return this.queryArea(areaRequest);
}
@Override
public PageResult<AreaVo> findPage(AreaRequest areaRequest) {
Page<AreaVo> page = PageFactory.defaultPage();
List<AreaVo> list = baseMapper.customFindList(page, areaRequest);
PageResult<AreaVo> pageResult = PageResultFactory.createPageResult(page.setRecords(list));
return pageResult;
}
@Override
public List<Area> findList(AreaRequest areaRequest) {
LambdaQueryWrapper<Area> queryWrapper = new LambdaQueryWrapper<>();
String parentId = areaRequest.getParentId();
if (ObjectUtil.isEmpty(parentId)) {
parentId = TreeConstants.DEFAULT_PARENT_ID.toString();
}
queryWrapper.select(Area::getAreaId, Area::getAreaName, Area::getAreaCode);
queryWrapper.eq(Area::getParentId, parentId);
queryWrapper.orderByAsc(Area::getAreaSort);
return this.list(queryWrapper);
}
/**
*
*
* @author LiYanJun
* @date 2023/07/05 18:12
*/
private Area queryArea(AreaRequest areaRequest) {
Area area = this.getById(areaRequest.getAreaId());
if (ObjectUtil.isEmpty(area)) {
throw new ServiceException(AreaExceptionEnum.AREA_NOT_EXISTED);
}
return area;
}
/**
* wrapper
*
* @author LiYanJun
* @date 2023/07/05 18:12
*/
private LambdaQueryWrapper<Area> createWrapper(AreaRequest areaRequest) {
LambdaQueryWrapper<Area> queryWrapper = new LambdaQueryWrapper<>();
Long areaId = areaRequest.getAreaId();
String areaCode = areaRequest.getAreaCode();
String areaName = areaRequest.getAreaName();
String parentId = areaRequest.getParentId();
Integer areaLevel = areaRequest.getAreaLevel();
BigDecimal areaSort = areaRequest.getAreaSort();
String delFlag = areaRequest.getDelFlag();
String areaPids = areaRequest.getAreaPids();
queryWrapper.eq(ObjectUtil.isNotNull(areaId), Area::getAreaId, areaId);
queryWrapper.like(ObjectUtil.isNotEmpty(areaCode), Area::getAreaCode, areaCode);
queryWrapper.like(ObjectUtil.isNotEmpty(areaName), Area::getAreaName, areaName);
queryWrapper.like(ObjectUtil.isNotEmpty(parentId), Area::getParentId, parentId);
queryWrapper.eq(ObjectUtil.isNotNull(areaLevel), Area::getAreaLevel, areaLevel);
queryWrapper.eq(ObjectUtil.isNotNull(areaSort), Area::getAreaSort, areaSort);
queryWrapper.like(ObjectUtil.isNotEmpty(delFlag), Area::getDelFlag, delFlag);
queryWrapper.like(ObjectUtil.isNotEmpty(areaPids), Area::getAreaPids, areaPids);
return queryWrapper;
}
}

View File

@ -24,6 +24,13 @@
<version>${roses.version}</version>
</dependency>
<!--城市的字典业务-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>dict-city-business</artifactId>
<version>${roses.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -18,6 +18,7 @@
<modules>
<module>dict-api</module>
<module>dict-business</module>
<module>dict-city-business</module>
<module>dict-spring-boot-starter</module>
</modules>