package com.sinata.web.controller.backend;
|
|
import com.sinata.common.core.domain.R;
|
import com.sinata.common.entity.PageDTO;
|
import com.sinata.system.domain.dto.MwProtectionEquipmentDTO;
|
import com.sinata.system.domain.dto.MwProtectionEquipmentRecordDTO;
|
import com.sinata.system.domain.query.MwProtectionEquipmentQuery;
|
import com.sinata.system.domain.vo.MwProtectionEquipmentVO;
|
import com.sinata.system.service.MwProtectionEquipmentService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiParam;
|
import lombok.RequiredArgsConstructor;
|
import org.springframework.validation.annotation.Validated;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.PathVariable;
|
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;
|
|
import javax.validation.Valid;
|
|
/**
|
* <p>
|
* 防护器具 前端控制器
|
* </p>
|
*
|
* @author mitao
|
* @since 2024-12-02
|
*/
|
@Validated
|
@RestController
|
@RequiredArgsConstructor
|
@Api(tags = {"防护器具相关接口"})
|
@RequestMapping("/backend/mwProtectionEquipment")
|
public class MwProtectionEquipmentController {
|
private final MwProtectionEquipmentService mwProtectionEquipmentService;
|
|
/**
|
* 防护器具分页列表
|
*
|
* @param query
|
* @return
|
*/
|
@PostMapping("/page")
|
@ApiOperation("防护器具分页列表")
|
public R<PageDTO<MwProtectionEquipmentVO>> pageList(@Valid @RequestBody MwProtectionEquipmentQuery query) {
|
return R.ok(mwProtectionEquipmentService.pageList(query));
|
}
|
|
/**
|
* 详情
|
*
|
* @param id
|
* @return
|
*/
|
@GetMapping("/{id}")
|
@ApiOperation("详情")
|
public R<MwProtectionEquipmentVO> detail(@ApiParam(name = "id", value = "防护器具id", required = true) @PathVariable("id") Long id) {
|
return R.ok(mwProtectionEquipmentService.detail(id));
|
}
|
|
/**
|
* 新增防护器具
|
*
|
* @param dto
|
* @return
|
*/
|
@PostMapping("/add")
|
@ApiOperation("新增防护器具")
|
public R<?> add(@Valid @RequestBody MwProtectionEquipmentDTO dto) {
|
mwProtectionEquipmentService.add(dto);
|
return R.ok();
|
}
|
|
/**
|
* 编辑
|
*
|
* @param dto
|
* @return
|
*/
|
@PostMapping("/edit")
|
@ApiOperation("编辑")
|
public R<?> edit(@Valid @RequestBody MwProtectionEquipmentDTO dto) {
|
mwProtectionEquipmentService.edit(dto);
|
return R.ok();
|
}
|
|
/**
|
* @param id
|
* @return
|
*/
|
@DeleteMapping("/{id}")
|
@ApiOperation("删除")
|
public R<?> delete(@ApiParam(name = "id", value = "防护器具id", required = true) @PathVariable("id") Long id) {
|
mwProtectionEquipmentService.removeById(id);
|
return R.ok();
|
}
|
|
/**
|
* 增加库存
|
*
|
* @param dto
|
*/
|
@PostMapping("/addStock")
|
@ApiOperation("增加库存")
|
public R<?> addStock(@Valid @RequestBody MwProtectionEquipmentRecordDTO dto) {
|
mwProtectionEquipmentService.addStock(dto);
|
return R.ok();
|
}
|
|
}
|