| | |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tenant.annotation.NonDS; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.sxkj.system.entity.Region; |
| | | import org.sxkj.system.excel.RegionExcel; |
| | | import org.sxkj.system.excel.RegionImporter; |
| | | import org.sxkj.system.param.RegionAddParam; |
| | | import org.sxkj.system.param.RegionPageParam; |
| | | import org.sxkj.system.service.IRegionService; |
| | | import org.sxkj.system.vo.RegionVO; |
| | | import org.sxkj.system.vo.TreeVo; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 行政区划表 控制器 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 行政区划表 自定义分页 |
| | | */ |
| | | @GetMapping("/page") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "分页", notes = " ") |
| | | public R<IPage<RegionVO>> page(RegionPageParam regionPageParam, Query query) { |
| | | IPage<RegionVO> pages = regionService.selectRegionPage(Condition.getPage(query), regionPageParam); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 懒加载列表 |
| | | */ |
| | | @GetMapping("/lazy-list") |
| | |
| | | /** |
| | | * 新增 行政区划表 |
| | | */ |
| | | @PostMapping("/save") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "新增", notes = "传入region") |
| | | @ApiLog("行政区划数据新增") |
| | | public R save(@Valid @RequestBody Region region) { |
| | | return R.status(regionService.save(region)); |
| | | } |
| | | // @PostMapping("/save") |
| | | // @ApiOperationSupport(order = 5) |
| | | // @ApiOperation(value = "新增", notes = "传入region") |
| | | // @ApiLog("行政区划数据新增") |
| | | // public R save(@Valid @RequestBody RegionAddParam region) { |
| | | // Region regionEntity = Objects.requireNonNull(BeanUtil.copy(region, Region.class)); |
| | | // return R.status(regionService.save(regionEntity)); |
| | | // } |
| | | |
| | | /** |
| | | * 修改 行政区划表 |
| | |
| | | @ApiOperation(value = "修改", notes = "传入region") |
| | | @ApiLog("行政区划数据修改") |
| | | public R update(@Valid @RequestBody Region region) { |
| | | region.setUpdateTime(DateUtil.now()); |
| | | return R.status(regionService.updateById(region)); |
| | | } |
| | | |
| | |
| | | @ApiOperationSupport(order = 7) |
| | | @ApiOperation(value = "新增或修改", notes = "传入region") |
| | | @ApiLog("行政区划数据新增或修改") |
| | | public R submit(@Valid @RequestBody Region region) { |
| | | return R.status(regionService.submit(region)); |
| | | public R submit(@Valid @RequestBody RegionAddParam region) { |
| | | Region regionEntity = Objects.requireNonNull(BeanUtil.copy(region, Region.class)); |
| | | regionEntity.setUpdateTime(DateUtil.now()); |
| | | regionEntity.setCreateTime(DateUtil.now()); |
| | | return R.status(regionService.submit(regionEntity)); |
| | | } |
| | | |
| | | |