|
| 1 | +package com.berry.oss.api; |
| 2 | + |
| 3 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 4 | +import com.baomidou.mybatisplus.core.metadata.IPage; |
| 5 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| 6 | +import com.berry.oss.common.Result; |
| 7 | +import com.berry.oss.common.ResultFactory; |
| 8 | +import com.berry.oss.dao.entity.RegionInfo; |
| 9 | +import com.berry.oss.dao.service.IRegionInfoDaoService; |
| 10 | +import io.swagger.annotations.Api; |
| 11 | +import io.swagger.annotations.ApiOperation; |
| 12 | +import org.springframework.beans.factory.annotation.Autowired; |
| 13 | +import org.springframework.web.bind.annotation.GetMapping; |
| 14 | +import org.springframework.web.bind.annotation.RequestMapping; |
| 15 | +import org.springframework.web.bind.annotation.RequestParam; |
| 16 | +import org.springframework.web.bind.annotation.RestController; |
| 17 | + |
| 18 | +import static org.apache.commons.lang3.StringUtils.isNotBlank; |
| 19 | + |
| 20 | +/** |
| 21 | + * Created with IntelliJ IDEA. |
| 22 | + * |
| 23 | + * @author Berry_Cooper. |
| 24 | + * @date 2020/6/9 14:28 |
| 25 | + * fileName:RegionController |
| 26 | + * Use: |
| 27 | + */ |
| 28 | +@RestController |
| 29 | +@RequestMapping("ajax/region") |
| 30 | +@Api(tags = "Region 管理") |
| 31 | +public class RegionController { |
| 32 | + |
| 33 | + @Autowired |
| 34 | + private IRegionInfoDaoService regionInfoDaoService; |
| 35 | + |
| 36 | + @ApiOperation("分页查询 区域列表") |
| 37 | + @GetMapping("/page_list") |
| 38 | + public Result pageListRegion(@RequestParam("pageSize") Integer pageSize, |
| 39 | + @RequestParam("pageNum") Integer pageNum, |
| 40 | + @RequestParam("keyword") String keyword) { |
| 41 | + IPage<RegionInfo> page = new Page<>(pageNum, pageSize); |
| 42 | + QueryWrapper<RegionInfo> queryWrapper = new QueryWrapper<>(); |
| 43 | + if (isNotBlank(keyword)) { |
| 44 | + queryWrapper.like("name", keyword) |
| 45 | + .or() |
| 46 | + .like("code", keyword); |
| 47 | + } |
| 48 | + regionInfoDaoService.page(page, queryWrapper); |
| 49 | + return ResultFactory.wrapper(page); |
| 50 | + } |
| 51 | +} |
0 commit comments