合并代码
This commit is contained in:
@ -0,0 +1,97 @@
|
||||
package com.mosty.yjzl.controller;
|
||||
|
||||
import com.mosty.base.model.dto.yjzl.TbZdxlFgdwUpdateDTO;
|
||||
import com.mosty.base.model.vo.yjzl.TbZdxlFgdwVO;
|
||||
import com.mosty.base.utils.MessageUtils;
|
||||
import com.mosty.base.utils.spring.SpringValidUtils;
|
||||
import com.mosty.common.base.domain.ResponseResult;
|
||||
import com.mosty.common.base.entity.log.BusinessType;
|
||||
import com.mosty.common.base.entity.log.Log;
|
||||
import com.mosty.common.base.util.StringUtils;
|
||||
import com.mosty.common.token.JwtSysUser;
|
||||
import com.mosty.yjzl.service.TbZdxlFgdwService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhangzhao
|
||||
* @description 指导巡逻方格点位接口
|
||||
* @modifier zhangzhao
|
||||
* @modifiedTime 2025/05/15 21:53
|
||||
* @since 2025/05/15 21:53
|
||||
*/
|
||||
@Api(tags = {"指导巡逻-方格点位接口"})
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/tbZdxlFgdw")
|
||||
public class TbZdxlFgdwController {
|
||||
|
||||
/**
|
||||
* 指导巡逻方格点位表Service
|
||||
*/
|
||||
private final TbZdxlFgdwService tbZdxlFgdwService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询单条(根据主键ID)
|
||||
* @param id 主键ID
|
||||
* @return ResponseResult 实体信息
|
||||
*/
|
||||
@ApiOperation(value = "查询单条(根据主键ID)")
|
||||
@GetMapping("{id}")
|
||||
@JwtSysUser
|
||||
@Log(title = "指导巡逻-方格点位接口-查询单条(根据主键ID)", businessType = BusinessType.OTHER)
|
||||
public ResponseResult<TbZdxlFgdwVO> selectById(@PathVariable("id") Integer id) {
|
||||
return ResponseResult.success(tbZdxlFgdwService.selectById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全量列表
|
||||
* @return ResponseResult 实体信息列表
|
||||
*/
|
||||
@ApiOperation(value = "查询全量列表")
|
||||
@GetMapping("/selectAllList")
|
||||
@JwtSysUser
|
||||
@Log(title = "指导巡逻-方格点位接口-查询全量列表", businessType = BusinessType.OTHER)
|
||||
public ResponseResult<List<TbZdxlFgdwVO>> selectAllList() {
|
||||
return ResponseResult.success(tbZdxlFgdwService.selectAllList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改单条
|
||||
* @param dto 修改DTO对象
|
||||
* @param bindResult 校验对象
|
||||
* @return ResponseResult 实体主键ID
|
||||
*/
|
||||
@ApiOperation(value = "修改单条")
|
||||
@PostMapping("update")
|
||||
@JwtSysUser
|
||||
@Log(title = "指导巡逻-方格点位接口-修改单条", businessType = BusinessType.UPDATE)
|
||||
public ResponseResult<Integer> update(@RequestBody @Valid TbZdxlFgdwUpdateDTO dto, BindingResult bindResult){
|
||||
try {
|
||||
//基础信息校验
|
||||
String message = SpringValidUtils.getErrorsMsg(bindResult);
|
||||
if (StringUtils.isNotBlank(message)) {
|
||||
return ResponseResult.fail(MessageUtils.getEditFailMsg() + message);
|
||||
}
|
||||
|
||||
//修改
|
||||
Integer resultId = tbZdxlFgdwService.updateEntity(dto);
|
||||
if(ObjectUtils.isNotEmpty(resultId)){
|
||||
return ResponseResult.success(resultId);
|
||||
}
|
||||
return ResponseResult.fail(MessageUtils.getEditFailMsg());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResponseResult.fail(MessageUtils.getEditServerErrorMsg());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user