package com.gkhy.safePlatform.equipment.controller;
|
|
import com.alibaba.fastjson.JSONObject;
|
import com.gkhy.safePlatform.commons.query.PageQuery;
|
import com.gkhy.safePlatform.commons.vo.ResultVO;
|
import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialAddReq;
|
import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialModReq;
|
import com.gkhy.safePlatform.equipment.model.dto.req.SafeMaterialQuery;
|
import com.gkhy.safePlatform.equipment.service.SafeMaterialService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.security.core.Authentication;
|
import org.springframework.validation.annotation.Validated;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
@RestController
|
@RequestMapping(value = "/equipment/safeMaterial")
|
public class SafeMaterialController {
|
@Autowired
|
private SafeMaterialService safeMaterialService;
|
|
@PostMapping(value = "save")
|
public ResultVO save(Authentication authentication, @Validated @RequestBody SafeMaterialAddReq req){
|
return safeMaterialService.save(req);
|
}
|
@PostMapping(value = "update")
|
public ResultVO update(Authentication authentication, @Validated @RequestBody SafeMaterialModReq req){
|
return safeMaterialService.update(req);
|
}
|
@PostMapping(value = "delete")
|
public ResultVO delete(Authentication authentication, @RequestBody JSONObject jsonObject){
|
Long id = jsonObject.getLong("id");
|
return safeMaterialService.delete(id);
|
}
|
@PostMapping(value = "queryById")
|
public ResultVO queryById(Authentication authentication, @RequestBody JSONObject jsonObject){
|
Long id = jsonObject.getLong("id");
|
return safeMaterialService.queryById(id);
|
}
|
@PostMapping(value = "list")
|
public ResultVO list(Authentication authentication){
|
return safeMaterialService.list();
|
}
|
|
@PostMapping(value = "page/list")
|
public ResultVO listByPage(Authentication authentication,@RequestBody PageQuery<SafeMaterialQuery> pageQuery){
|
return safeMaterialService.listByPage(pageQuery);
|
}
|
@PostMapping(value = "deleteBatch")
|
public ResultVO deleteBatch(Authentication authentication, @RequestBody Long[] ids){
|
return safeMaterialService.deleteBatch(ids);
|
}
|
|
}
|