新增 根据父级ID查询区域列表信息
This commit is contained in:
parent
dc88a39cef
commit
ed6081789f
@ -41,5 +41,16 @@ public class RegionController {
|
|||||||
throw new RuntimeException("根据区域关键字查询区域列表信息异常", e);
|
throw new RuntimeException("根据区域关键字查询区域列表信息异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("根据父级ID查询区域列表信息")
|
||||||
|
@GetMapping("findByParentId/{parentId}")
|
||||||
|
public Result findByParentId(@PathVariable("parentId") String parentId) {
|
||||||
|
try {
|
||||||
|
List<Region> list = regionService.getRegionByParentId(parentId);
|
||||||
|
return Result.ok(list);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("根据父级ID查询区域列表信息异常", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.yovinchen.xlcs.sys.service;
|
package com.yovinchen.xlcs.sys.service;
|
||||||
|
|
||||||
|
|
||||||
import com.yovinchen.xlcs.model.sys.Region;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.yovinchen.xlcs.model.sys.Region;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -16,5 +16,19 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface RegionService extends IService<Region> {
|
public interface RegionService extends IService<Region> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据区域关键字查询区域列表信息
|
||||||
|
*
|
||||||
|
* @param keyword
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
List<Region> getRegionByKeyword(String keyword);
|
List<Region> getRegionByKeyword(String keyword);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据父级ID查询区域列表信息
|
||||||
|
*
|
||||||
|
* @param parentId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Region> getRegionByParentId(String parentId);
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package com.yovinchen.xlcs.sys.service.impl;
|
package com.yovinchen.xlcs.sys.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.yovinchen.xlcs.model.sys.Region;
|
import com.yovinchen.xlcs.model.sys.Region;
|
||||||
import com.yovinchen.xlcs.sys.mapper.RegionMapper;
|
import com.yovinchen.xlcs.sys.mapper.RegionMapper;
|
||||||
import com.yovinchen.xlcs.sys.service.RegionService;
|
import com.yovinchen.xlcs.sys.service.RegionService;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -21,8 +21,25 @@ import java.util.List;
|
|||||||
@Service
|
@Service
|
||||||
public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> implements RegionService {
|
public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> implements RegionService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据区域关键字查询区域列表信息
|
||||||
|
*
|
||||||
|
* @param keyword
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Region> getRegionByKeyword(String keyword) {
|
public List<Region> getRegionByKeyword(String keyword) {
|
||||||
return baseMapper.selectList(new LambdaQueryWrapper<Region>().like(Region::getName, keyword));
|
return baseMapper.selectList(new LambdaQueryWrapper<Region>().like(Region::getName, keyword));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据父级ID查询区域列表信息
|
||||||
|
*
|
||||||
|
* @param parentId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Region> getRegionByParentId(String parentId) {
|
||||||
|
return baseMapper.selectList(new LambdaQueryWrapper<Region>().eq(Region::getParentId, parentId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package com.yovinchen.xlcs.sys.service.impl;
|
package com.yovinchen.xlcs.sys.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.yovinchen.xlcs.common.exception.xlcsException;
|
import com.yovinchen.xlcs.common.exception.xlcsException;
|
||||||
import com.yovinchen.xlcs.common.result.ResultCodeEnum;
|
import com.yovinchen.xlcs.common.result.ResultCodeEnum;
|
||||||
import com.yovinchen.xlcs.model.sys.RegionWare;
|
import com.yovinchen.xlcs.model.sys.RegionWare;
|
||||||
import com.yovinchen.xlcs.sys.mapper.RegionWareMapper;
|
import com.yovinchen.xlcs.sys.mapper.RegionWareMapper;
|
||||||
import com.yovinchen.xlcs.sys.service.RegionWareService;
|
import com.yovinchen.xlcs.sys.service.RegionWareService;
|
||||||
import com.yovinchen.xlcs.vo.sys.RegionWareQueryVo;
|
import com.yovinchen.xlcs.vo.sys.RegionWareQueryVo;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
@ -35,8 +35,7 @@ public class RegionWareServiceImpl extends ServiceImpl<RegionWareMapper, RegionW
|
|||||||
String keyword = regionWareQueryVo.getKeyword();
|
String keyword = regionWareQueryVo.getKeyword();
|
||||||
LambdaQueryWrapper<RegionWare> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RegionWare> wrapper = new LambdaQueryWrapper<>();
|
||||||
if (!StringUtils.isEmpty(keyword)) {
|
if (!StringUtils.isEmpty(keyword)) {
|
||||||
wrapper
|
wrapper.like(RegionWare::getRegionName, keyword)
|
||||||
.like(RegionWare::getRegionName, keyword)
|
|
||||||
.or()
|
.or()
|
||||||
.like(RegionWare::getWareName, keyword);
|
.like(RegionWare::getWareName, keyword);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user