package cn.gistack.sm.patrol.controller;
|
|
import cn.gistack.sm.patrol.entity.PatrolConfig;
|
import cn.gistack.sm.patrol.entity.PatrolReport;
|
import cn.gistack.sm.patrol.service.IPatrolReportService;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import lombok.AllArgsConstructor;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springblade.core.boot.ctrl.BladeController;
|
import org.springblade.core.mp.support.Condition;
|
import org.springblade.core.mp.support.Query;
|
import org.springblade.core.tool.api.R;
|
import org.springframework.web.bind.annotation.*;
|
|
import java.util.Arrays;
|
|
/**
|
* @Description: 巡查上报
|
*/
|
@Slf4j
|
@Api(tags="巡查上报")
|
@RestController
|
@RequestMapping("/patrol/patrolReport")
|
@AllArgsConstructor
|
public class PatrolReportController extends BladeController {
|
|
private IPatrolReportService patrolReportService;
|
|
/**
|
* 分页列表查询
|
*/
|
@ApiOperation(value="巡查上报-分页列表查询", notes="巡查上报-分页列表查询")
|
@GetMapping(value = "/list")
|
public R<IPage<PatrolConfig>> queryPageList(PatrolConfig patrolConfig,Query query) {
|
IPage<PatrolConfig> pageList = patrolReportService.selectPatrolReport(Condition.getPage(query),patrolConfig);
|
return R.data(pageList);
|
}
|
|
/**
|
* 添加
|
*/
|
@ApiOperation(value="巡查上报-添加", notes="巡查上报-添加")
|
@PostMapping(value = "/add")
|
public R add(@RequestBody PatrolReport patrolReport) {
|
return R.data(patrolReportService.save(patrolReport));
|
}
|
|
/**
|
* 编辑
|
*/
|
@ApiOperation(value="巡查上报-编辑", notes="巡查上报-编辑")
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
public R edit(@RequestBody PatrolReport patrolReport) {
|
return R.data(patrolReportService.updateById(patrolReport));
|
}
|
|
/**
|
* 通过id删除
|
*
|
* @param id
|
* @return
|
*/
|
@ApiOperation(value="巡查上报-通过id删除", notes="巡查上报-通过id删除")
|
@DeleteMapping(value = "/delete")
|
public R delete(@RequestParam(name="id",required=true) String id) {
|
patrolReportService.removeById(id);
|
return R.data(patrolReportService.removeById(id));
|
}
|
|
/**
|
* 批量删除
|
*
|
* @param ids
|
* @return
|
*/
|
@ApiOperation(value="巡查上报-批量删除", notes="巡查上报-批量删除")
|
@DeleteMapping(value = "/deleteBatch")
|
public R deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
return R.data(this.patrolReportService.removeByIds(Arrays.asList(ids.split(","))));
|
}
|
|
/**
|
* 通过id查询
|
*
|
* @param id
|
* @return
|
*/
|
@ApiOperation(value="巡查上报-通过id查询", notes="巡查上报-通过id查询")
|
@GetMapping(value = "/queryById")
|
public R queryById(@RequestParam(name="id",required=true) String id) {
|
PatrolReport byId = patrolReportService.getById(id);
|
return R.data(byId);
|
}
|
|
/**
|
* 自定义查询
|
*
|
* @param patrolReport
|
* @return
|
*/
|
@ApiOperation(value="巡查上报-自定义查询", notes="巡查上报-自定义查询")
|
@PostMapping(value = "/customizeGetDetail")
|
public R customizeGetDetail(PatrolReport patrolReport) {
|
PatrolReport detail = patrolReportService.getOne(Condition.getQueryWrapper(patrolReport));
|
return R.data(detail);
|
}
|
|
}
|