潘志宝
2024-09-26 1373561069f7e19383dbc178c19787c4b3f0df3b
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/DmModuleController.java
@@ -1,5 +1,6 @@
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;
@@ -9,6 +10,7 @@
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.*;
@@ -23,7 +25,7 @@
 * @date 2021年04月23日 9:05
 */
@RestController
@RequestMapping("/pre/module")
@RequestMapping("/model/pre/module")
public class DmModuleController {
    @Autowired
@@ -33,6 +35,7 @@
     * 管网列表
     */
    @GetMapping("/page")
    @PreAuthorize("@ss.hasPermission('model:pre-module:query')")
    public CommonResult<PageResult<DmModuleRespVO>> page(@Validated DmModulePageReqVO reqVO) {
        PageResult<DmModuleEntity> page = dmModuleService.queryPage(reqVO);
@@ -43,6 +46,7 @@
     * 管网列表
     */
    @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);
@@ -53,8 +57,9 @@
     * 管网信息
     */
    @GetMapping("/get/{id}")
    @PreAuthorize("@ss.hasPermission('model:pre-module:query')")
    public CommonResult<DmModuleEntity> info(@PathVariable("id") String id){
        DmModuleEntity info = dmModuleService.selectById(id);
        DmModuleEntity info = dmModuleService.info(id);
        return success(info);
    }
@@ -63,7 +68,9 @@
     * 保存管网
     */
    @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, "名称重复");
@@ -77,6 +84,8 @@
     * 修改管网
     */
    @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);
@@ -86,6 +95,8 @@
     * 删除管网
     */
    @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);