xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AreaController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AreaSectionController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CustomerController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AreaController.java
New file @@ -0,0 +1,78 @@ package cn.exrick.xboot.your.controller; import cn.exrick.xboot.core.common.utils.PageUtil; import cn.exrick.xboot.core.common.utils.ResultUtil; import cn.exrick.xboot.core.common.vo.PageVo; import cn.exrick.xboot.core.common.vo.Result; import cn.exrick.xboot.your.entity.Area; import cn.exrick.xboot.your.service.IAreaService; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.transaction.annotation.Transactional; import java.util.List; /** * @author zhangzeli */ @Slf4j @RestController @Api(tags = "配送片区管理接口") @RequestMapping("/xboot/area") @Transactional public class AreaController { @Autowired private IAreaService iAreaService; @RequestMapping(value = "/get/{id}", method = RequestMethod.GET) @ApiOperation(value = "通过id获取") public Result<Area> get(@PathVariable String id) { Area area = iAreaService.getById(id); return new ResultUtil<Area>().setData(area); } @RequestMapping(value = "/getAll", method = RequestMethod.GET) @ApiOperation(value = "获取全部数据") public Result<List<Area>> getAll() { List<Area> list = iAreaService.list(); return new ResultUtil<List<Area>>().setData(list); } @RequestMapping(value = "/getByPage", method = RequestMethod.GET) @ApiOperation(value = "分页获取") public Result<IPage<Area>> getByPage(String areaId,PageVo page) { QueryWrapper<Area> wrapper = new QueryWrapper<>(); if (!StrUtil.isEmpty(areaId)) wrapper.eq("area_id",areaId); IPage<Area> data = iAreaService.page2(PageUtil.initMpPage(page),wrapper); return new ResultUtil<IPage<Area>>().setData(data); } @RequestMapping(value = "/insertOrUpdate", method = RequestMethod.POST) @ApiOperation(value = "编辑或更新数据") public Result<Area> saveOrUpdate(Area area) { if (iAreaService.saveOrUpdate(area)) { return new ResultUtil<Area>().setData(area); } return new ResultUtil<Area>().setErrorMsg("操作失败"); } @RequestMapping(value = "/delByIds", method = RequestMethod.POST) @ApiOperation(value = "批量通过id删除") public Result<Object> delAllByIds(@RequestParam String[] ids) { for (String id : ids) { iAreaService.removeById(id); } return ResultUtil.success("批量通过id删除数据成功"); } } xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AreaSectionController.java
New file @@ -0,0 +1,79 @@ package cn.exrick.xboot.your.controller; import cn.exrick.xboot.core.common.utils.PageUtil; import cn.exrick.xboot.core.common.utils.ResultUtil; import cn.exrick.xboot.core.common.vo.PageVo; import cn.exrick.xboot.core.common.vo.Result; import cn.exrick.xboot.your.entity.AreaSection; import cn.exrick.xboot.your.service.IAreaSectionService; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.transaction.annotation.Transactional; import java.util.List; /** * @author zhangzeli */ @Slf4j @RestController @Api(tags = "片区段管理接口") @RequestMapping("/xboot/areaSection") @Transactional public class AreaSectionController { @Autowired private IAreaSectionService iAreaSectionService; @RequestMapping(value = "/get/{id}", method = RequestMethod.GET) @ApiOperation(value = "通过id获取") public Result<AreaSection> get(@PathVariable String id) { AreaSection areaSection = iAreaSectionService.getById(id); return new ResultUtil<AreaSection>().setData(areaSection); } @RequestMapping(value = "/getAll", method = RequestMethod.GET) @ApiOperation(value = "获取全部数据") public Result<List<AreaSection>> getAll() { List<AreaSection> list = iAreaSectionService.list(); return new ResultUtil<List<AreaSection>>().setData(list); } @RequestMapping(value = "/getByPage", method = RequestMethod.GET) @ApiOperation(value = "分页获取") public Result<IPage<AreaSection>> getByPage(String areaId,PageVo page) { QueryWrapper<AreaSection> wrapper = new QueryWrapper<>(); if (!StrUtil.isEmpty(areaId)) wrapper.eq("area_id",areaId); IPage<AreaSection> data = iAreaSectionService.page(PageUtil.initMpPage(page),wrapper); return new ResultUtil<IPage<AreaSection>>().setData(data); } @RequestMapping(value = "/insertOrUpdate", method = RequestMethod.POST) @ApiOperation(value = "编辑或更新数据") public Result<AreaSection> saveOrUpdate(AreaSection areaSection) { if (iAreaSectionService.saveOrUpdate(areaSection)) { return new ResultUtil<AreaSection>().setData(areaSection); } return new ResultUtil<AreaSection>().setErrorMsg("操作失败"); } @RequestMapping(value = "/delByIds", method = RequestMethod.POST) @ApiOperation(value = "批量通过id删除") public Result<Object> delAllByIds(@RequestParam String[] ids) { for (String id : ids) { iAreaSectionService.removeById(id); } return ResultUtil.success("批量通过id删除数据成功"); } } xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CustomerController.java
@@ -48,10 +48,13 @@ } @RequestMapping(value = "/getByPage", method = RequestMethod.GET) @ApiOperation(value = "分页获取") public Result<IPage<Customer>> getByPage(PageVo page) { IPage<Customer> data = iCustomerService.page(PageUtil.initMpPage(page)); @ApiOperation(value = "" + "") public Result<IPage<Customer>> getByPage(String areaSectionId,PageVo page) { QueryWrapper<Customer> wrapper = new QueryWrapper<>(); if (!StrUtil.isEmpty(areaSectionId)) wrapper.eq("area_section_id",areaSectionId); IPage<Customer> data = iCustomerService.page(PageUtil.initMpPage(page),wrapper); return new ResultUtil<IPage<Customer>>().setData(data); }