You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
2.3 KiB
82 lines
2.3 KiB
package com.zilber.boot.intelligencesite.controller;
|
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.zilber.boot.commoncontroller.BaseController;
|
|
import com.zilber.boot.intelligencesite.entity.IUser;
|
|
import com.zilber.boot.intelligencesite.entity.IWarn;
|
|
import com.zilber.boot.intelligencesite.service.IIUserService;
|
|
import com.zilber.boot.intelligencesite.service.IIWarnService;
|
|
import com.zilber.boot.utils.AjaxResult;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import javax.annotation.Resource;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* <p>
|
|
* 预警表 前端控制器
|
|
* </p>
|
|
*
|
|
* @author lsc
|
|
* @since 2025-05-06
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/iwarn")
|
|
@Api(tags = "预警")
|
|
public class IWarnController extends BaseController {
|
|
|
|
@Resource
|
|
private IIWarnService iiWarnService;
|
|
|
|
|
|
@GetMapping("/list")
|
|
@ApiOperation(value="分页查询",notes="分页查询")
|
|
@ResponseBody
|
|
public AjaxResult queryList(IWarn iWarn, @RequestParam(defaultValue = "1") Integer pageNo,
|
|
@RequestParam(defaultValue = "10") Integer pageSize) {
|
|
PageHelper.startPage(pageNo, pageSize);
|
|
List<IWarn> iWarns = iiWarnService.queryList(iWarn);
|
|
PageInfo<IWarn> page = new PageInfo<>(iWarns);
|
|
return AjaxResult.success(page);
|
|
}
|
|
|
|
/***
|
|
* 查询单个
|
|
*/
|
|
@GetMapping("/getById")
|
|
@ApiOperation("查询单个")
|
|
public AjaxResult getById(Integer id) {
|
|
return AjaxResult.success(iiWarnService.getById(id));
|
|
}
|
|
|
|
|
|
@PostMapping("/add")
|
|
@ApiOperation("增加")
|
|
public AjaxResult add(@RequestBody IWarn iWarn) {
|
|
iWarn.setCreateTime(new Date());
|
|
iWarn.setCreator(getUsername());
|
|
return AjaxResult.success(iiWarnService.save(iWarn));
|
|
}
|
|
|
|
|
|
@PutMapping("/update")
|
|
@ApiOperation("修改")
|
|
public AjaxResult update(@RequestBody @Validated IWarn iWarn) {
|
|
iiWarnService.updateById(iWarn);
|
|
return AjaxResult.success();
|
|
}
|
|
|
|
@DeleteMapping("/delete")
|
|
@ApiOperation("删除")
|
|
public AjaxResult delete(Integer id) {
|
|
return AjaxResult.success(iiWarnService.removeById(id));
|
|
}
|
|
|
|
|
|
}
|
|
|