EquipmentBindSparepartController.java
2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package com.skua.modules.equipment.controller;
import javax.servlet.http.HttpServletRequest;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.modules.equipment.entity.EquipmentBindSparepart;
import com.skua.modules.equipment.entity.EquipmentSparepart;
import com.skua.modules.equipment.service.IEquipmentBindSparepartService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* <pre>
* 设备关联备品备件
* </pre>
* @author 开发者姓名
* @version V0.1, 开发时间
*/
@Slf4j
@Api(tags="设备关联备品备件")
@RestController("webEquipmentBindSparepartController")
@RequestMapping("/web/equipment/equipmentBindSparepart")
public class EquipmentBindSparepartController {
@Autowired
private IEquipmentBindSparepartService equipmentBindSparepartService;
@AutoLog(value = "设备关联备品备件-分页列表查询")
@ApiOperation(value="设备关联备品备件-分页列表查询", notes="设备关联备品备件-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<EquipmentSparepart>> queryPageList(
@RequestParam(name="equipmentId", defaultValue="1") String equipmentId,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<EquipmentSparepart>> result = new Result<IPage<EquipmentSparepart>>();
Page<EquipmentSparepart> page = new Page<EquipmentSparepart>(pageNo, pageSize);
IPage<EquipmentSparepart> pageList = equipmentBindSparepartService.querySparepartListByEquipmentId(page,equipmentId);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
@AutoLog(value = "设备关联备品备件-添加修改")
@ApiOperation(value="设备关联备品备件-添加修改", notes="设备关联备品备件-添加修改")
@PostMapping(value = "/saveOrUpdate")
public Result<EquipmentBindSparepart> saveOrUpdate(@RequestBody EquipmentBindSparepart equipmentBindSparepart) {
Result<EquipmentBindSparepart> result = new Result<EquipmentBindSparepart>();
try {
equipmentBindSparepartService.updateEquipmentBindSparepart(equipmentBindSparepart);
result.success("添加成功!");
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败");
}
return result;
}
}