feat(sys): 根据关键字获取地区列表
This commit is contained in:
parent
67c42f59b3
commit
ea44df3340
|
@ -1,14 +1,31 @@
|
|||
package com.atguigu.ssyx.sys.controller;
|
||||
|
||||
|
||||
import com.atguigu.ssyx.common.result.Result;
|
||||
import com.atguigu.ssyx.model.sys.Region;
|
||||
import com.atguigu.ssyx.sys.service.RegionService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "区域接口")
|
||||
@RestController
|
||||
@RequestMapping("/admin/sys/region")
|
||||
public class RegionController {
|
||||
@Autowired
|
||||
private RegionService regionService;
|
||||
|
||||
@ApiOperation(value = "根据关键字获取地区列表")
|
||||
@GetMapping("findRegionByKeyword/{keyword}")
|
||||
public Result<List<Region>> findRegionByKeyword(@PathVariable("keyword") String keyword) {
|
||||
List<Region> regionList = regionService.findRegionByKeyword(keyword);
|
||||
return Result.success(regionList);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,15 +11,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Api(value = "RegionWare管理", tags = "RegionWare管理")
|
||||
@RestController
|
||||
@RequestMapping(value = "/admin/sys/regionWare")
|
||||
public class RegionWareController {
|
||||
@Resource
|
||||
@Autowired
|
||||
private RegionWareService regionWareService;
|
||||
|
||||
@ApiOperation(value = "获取开通区域列表")
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.atguigu.ssyx.sys.service;
|
|||
import com.atguigu.ssyx.model.sys.Region;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 地区表 服务类
|
||||
|
@ -13,4 +15,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
*/
|
||||
public interface RegionService extends IService<Region> {
|
||||
|
||||
/**
|
||||
* 根据关键字获取地区列表
|
||||
*
|
||||
* @param keyword 关键字
|
||||
* @return List<Region>
|
||||
*/
|
||||
List<Region> findRegionByKeyword(String keyword);
|
||||
}
|
||||
|
|
|
@ -3,9 +3,12 @@ package com.atguigu.ssyx.sys.service.impl;
|
|||
import com.atguigu.ssyx.model.sys.Region;
|
||||
import com.atguigu.ssyx.sys.mapper.RegionMapper;
|
||||
import com.atguigu.ssyx.sys.service.RegionService;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 地区表 服务实现类
|
||||
|
@ -17,4 +20,14 @@ import org.springframework.stereotype.Service;
|
|||
@Service
|
||||
public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> implements RegionService {
|
||||
|
||||
/**
|
||||
* 根据关键字获取地区列表
|
||||
*
|
||||
* @param keyword 关键字
|
||||
* @return List<Region>
|
||||
*/
|
||||
@Override
|
||||
public List<Region> findRegionByKeyword(String keyword) {
|
||||
return baseMapper.selectList(Wrappers.<Region>lambdaQuery().like(Region::getName, keyword));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue