| | |
| | | package com.iailab.module.model.mcs.pre.controller.admin; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DSTransactional; |
| | | import com.iailab.framework.common.exception.ErrorCode; |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | |
| | | import com.iailab.module.model.mcs.pre.vo.DmModulePageReqVO; |
| | | import com.iailab.module.model.mcs.pre.vo.DmModuleRespVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | * @date 2021年04月23日 9:05 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/pre/module") |
| | | @RequestMapping("/model/pre/module") |
| | | public class DmModuleController { |
| | | |
| | | @Autowired |
| | |
| | | * 管网列表 |
| | | */ |
| | | @GetMapping("/page") |
| | | @PreAuthorize("@ss.hasPermission('model:pre-module:query')") |
| | | public CommonResult<PageResult<DmModuleRespVO>> page(@Validated DmModulePageReqVO reqVO) { |
| | | PageResult<DmModuleEntity> page = dmModuleService.queryPage(reqVO); |
| | | |
| | |
| | | * 管网列表 |
| | | */ |
| | | @GetMapping("/list") |
| | | @PreAuthorize("@ss.hasPermission('model:pre-module:query')") |
| | | public CommonResult<List<DmModuleEntity>> list(@RequestParam Map<String, Object> params) { |
| | | List<DmModuleEntity> list = dmModuleService.list(params); |
| | | |
| | |
| | | /** |
| | | * 管网信息 |
| | | */ |
| | | @GetMapping("/get") |
| | | public CommonResult<DmModuleEntity> info(@RequestParam("id") String id){ |
| | | DmModuleEntity module = dmModuleService.selectById(id); |
| | | @GetMapping("/get/{id}") |
| | | @PreAuthorize("@ss.hasPermission('model:pre-module:query')") |
| | | public CommonResult<DmModuleEntity> info(@PathVariable("id") String id){ |
| | | DmModuleEntity info = dmModuleService.info(id); |
| | | |
| | | return success(module); |
| | | return success(info); |
| | | } |
| | | |
| | | /** |
| | | * 保存管网 |
| | | */ |
| | | @PostMapping("/create") |
| | | public CommonResult<Boolean> save(@RequestBody DmModuleEntity module){ |
| | | @PreAuthorize("@ss.hasPermission('model:pre-module:create')") |
| | | @DSTransactional(rollbackFor= Exception.class) |
| | | public CommonResult<Boolean> create(@RequestBody DmModuleEntity module){ |
| | | int count = dmModuleService.check(module); |
| | | if (count > 0) { |
| | | ErrorCode errorCode = new ErrorCode(999, "名称重复"); |
| | |
| | | * 修改管网 |
| | | */ |
| | | @PutMapping("/update") |
| | | @PreAuthorize("@ss.hasPermission('model:pre-module:update')") |
| | | @DSTransactional(rollbackFor= Exception.class) |
| | | public CommonResult<Boolean> update(@RequestBody DmModuleEntity module){ |
| | | dmModuleService.update(module); |
| | | return success(true); |
| | |
| | | * 删除管网 |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | @PreAuthorize("@ss.hasPermission('model:pre-module:delete')") |
| | | @DSTransactional(rollbackFor= Exception.class) |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id){ |
| | | dmModuleService.deleteBatch(new String[]{id}); |
| | | return success(true); |