From 76e9e8e05cbe7dafeba51a235386f20ebf986e25 Mon Sep 17 00:00:00 2001 From: wang-hao-jie <1550036656@qq.com> Date: 星期一, 27 十二月 2021 11:54:35 +0800 Subject: [PATCH] 违章记录 --- xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AreaSectionController.java | 79 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 79 insertions(+), 0 deletions(-) diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AreaSectionController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AreaSectionController.java new file mode 100644 index 0000000..ccfb087 --- /dev/null +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/AreaSectionController.java @@ -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鍒犻櫎鏁版嵁鎴愬姛"); + } +} -- Gitblit v1.9.1