| | |
| | | package com.ycl.controller.region; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ycl.api.CommonPage; |
| | | import com.ycl.api.CommonResult; |
| | | import com.ycl.controller.BaseController; |
| | | import com.ycl.entity.region.SccgRegion; |
| | | import com.ycl.service.redis.RedisService; |
| | | import com.ycl.service.region.ISccgRegionService; |
| | | import com.ycl.utils.redis.RedisKey; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | public class SccgRegionController extends BaseController { |
| | | |
| | | @Resource |
| | | private RedisService redisService; |
| | | |
| | | @Resource |
| | | private ISccgRegionService iSccgRegionService; |
| | | |
| | | @ApiOperation("树结构") |
| | |
| | | @RequestMapping(value = "/addRegion", method = RequestMethod.POST) |
| | | @ResponseBody |
| | | public CommonResult addRegion(@Validated @RequestBody SccgRegion sccgRegion) { |
| | | redisService.del(RedisKey.SCCG_REGION); |
| | | return CommonResult.success(iSccgRegionService.save(sccgRegion)); |
| | | } |
| | | |
| | |
| | | @RequestMapping(value = "/update/{id}", method = RequestMethod.POST) |
| | | @ResponseBody |
| | | public CommonResult update(@PathVariable Long id, @RequestBody SccgRegion sccgRegion) { |
| | | redisService.del(RedisKey.SCCG_REGION); |
| | | sccgRegion.setId(id); |
| | | boolean success = iSccgRegionService.updateById(sccgRegion); |
| | | if (success) { |
| | |
| | | @RequestMapping(value = "/delete", method = RequestMethod.POST) |
| | | @ResponseBody |
| | | public CommonResult delete(@RequestParam("ids") List<Long> ids) { |
| | | redisService.del(RedisKey.SCCG_REGION); |
| | | boolean success = iSccgRegionService.removeBatchByIds(ids); |
| | | if (success) { |
| | | return CommonResult.success(null); |