zhangnaisong
2024-07-02 9710740f1672fcaab74510ff5e8044c5fd0dafc8
ard-work/src/main/java/com/ruoyi/sy/controller/ArdTankLockController.java
@@ -6,6 +6,8 @@
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.sy.domain.ArdTankWall;
import com.ruoyi.sy.service.IArdTankWallService;
import com.ruoyi.utils.result.Results;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -40,6 +42,9 @@
public class ArdTankLockController extends BaseController {
    @Autowired
    private IArdTankLockService ardTankLockService;
    @Autowired
    private IArdTankWallService ardTankWallService;
    /**
     * 查询电磁锁列表
@@ -78,12 +83,19 @@
    /**
     * 新增电磁锁
     */
    @ApiOperation("新增电磁锁")
    /*@ApiOperation("新增电磁锁")
    @PreAuthorize("@ss.hasPermi('sy:lock:add')")
    @Log(title = "电磁锁" , businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ArdTankLock ardTankLock) {
        return toAjax(ardTankLockService.insertArdTankLock(ardTankLock));
    }*/
    @ApiOperation("新增电磁锁")
    @PreAuthorize("@ss.hasPermi('sy:lock:add')")
    @Log(title = "电磁锁" , businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Map<String,Object> para) {
        return toAjax(ardTankLockService.insertArdTankLock(para));
    }
    /**
@@ -119,12 +131,74 @@
        return toAjax(ardTankLockService.deleteArdTankLockById(id));
    }
    @ApiOperation("查询全部电磁锁")
    /*@ApiOperation("查询全部电磁锁")
    @PreAuthorize("@ss.hasPermi('sy:lock:getAll')")
    @GetMapping("/getAll")
    public Results getAll() {
        String userId = SecurityUtils.getUserId();
        Results result = ardTankLockService.getAll(userId);
        return result;
    }*/
    @ApiOperation("查询全部电磁锁")
    @PreAuthorize("@ss.hasPermi('sy:lock:getAll')")
    @GetMapping("/getAll")
    public TableDataInfo getAll() {
        startPage();
        String userId = SecurityUtils.getUserId();
        List<Map<String,Object>> result = ardTankLockService.getAll(userId);
        return getDataTable(result);
    }
    /**
     * 根据car_id获取电磁锁详细信息
     */
    @ApiOperation("根据car_id获取电磁锁详细信息")
    @PreAuthorize("@ss.hasPermi('sy:lock:getLockByCarId')")
    @PostMapping("/getLockByCarId")
    public AjaxResult getLockByCarId(@RequestBody ArdTankLock ardTankLock) {
        String userId = SecurityUtils.getUserId();
        return success(ardTankLockService.getLockByCarId(ardTankLock.getCarId(),userId));
    }
    /**
     * 新增电子围栏
     */
    @ApiOperation("新增电子围栏")
    @PreAuthorize("@ss.hasPermi('sy:lock:addWall')")
    @Log(title = "电磁锁" , businessType = BusinessType.INSERT)
    @PostMapping("/addWall")
    public AjaxResult addWall(@RequestBody ArdTankWall ardTankWall) {
        return toAjax(ardTankWallService.insertArdTankWall(ardTankWall));
    }
    /**
     * 修改电子围栏
     */
    @ApiOperation("修改电子围栏")
    @PreAuthorize("@ss.hasPermi('sy:lock:updateWall')")
    @Log(title = "电磁锁" , businessType = BusinessType.UPDATE)
    @PutMapping("/updateWall")
    public AjaxResult updateWall(@RequestBody ArdTankWall ardTankWall) {
        return toAjax(ardTankWallService.updateArdTankWall(ardTankWall));
    }
    /**
     * 删除电子围栏
     */
    @ApiOperation("删除单一电子围栏")
    @PreAuthorize("@ss.hasPermi('sy:lock:removeWall')")
    @Log(title = "电磁锁" , businessType = BusinessType.DELETE)
    @DeleteMapping("/removeWall/{id}")
    public AjaxResult removeWall(@PathVariable String id) {
        return toAjax(ardTankWallService.deleteArdTankWallById(id));
    }
    @ApiOperation("查询全部电子围栏")
    @PreAuthorize("@ss.hasPermi('sy:lock:getAllArdTankWall')")
    @GetMapping("/getAllArdTankWall")
    public Results getAllArdTankWall() {
        List<ArdTankWall> result = ardTankWallService.getAllArdTankWall();
        return Results.succeed(result);
    }
}