|
|
@@ -0,0 +1,108 @@
|
|
|
+package com.ecp.tire.center.warehouse.cost.controller;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.ecp.tire.center.warehouse.api.cost.entity.CenterCostDesc;
|
|
|
+import com.ecp.tire.center.warehouse.api.cost.vo.CenterCostDescVo;
|
|
|
+import com.ecp.tire.center.warehouse.cost.service.ICenterCostDescService;
|
|
|
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.springblade.core.mp.support.Condition;
|
|
|
+import org.springblade.core.mp.support.Query;
|
|
|
+import org.springblade.core.secure.BladeUser;
|
|
|
+import org.springblade.core.secure.utils.AuthUtil;
|
|
|
+import org.springblade.core.tool.api.R;
|
|
|
+import org.springblade.core.tool.utils.Func;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author Rain
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/tire/center/warehouse/costDesc")
|
|
|
+@AllArgsConstructor
|
|
|
+public class CenterCostDescController {
|
|
|
+
|
|
|
+ private final ICenterCostDescService centerCostDescService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 详情
|
|
|
+ */
|
|
|
+ @GetMapping("/detail")
|
|
|
+ @ApiOperationSupport(order = 1)
|
|
|
+ @ApiOperation(value = "详情", notes = "传入centerShipCost")
|
|
|
+ public R<CenterCostDesc> detail(CenterCostDescVo centerShipCost) {
|
|
|
+ CenterCostDesc detail = centerCostDescService.getOne(Condition.getQueryWrapper(centerShipCost));
|
|
|
+ return R.data(detail);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页 出入库费用表
|
|
|
+ */
|
|
|
+ @GetMapping("/list")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "分页", notes = "传入centerShipCost")
|
|
|
+ public R<IPage<CenterCostDesc>> list(CenterCostDescVo centerCostDescVo, Query query) {
|
|
|
+ IPage<CenterCostDesc> pages = centerCostDescService.page(Condition.getPage(query), Condition.getQueryWrapper(centerCostDescVo));
|
|
|
+ return R.data(pages);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增 出入库费用表
|
|
|
+ */
|
|
|
+ @PostMapping("/save")
|
|
|
+ @ApiOperationSupport(order = 4)
|
|
|
+ @ApiOperation(value = "新增", notes = "传入centerShipCost")
|
|
|
+ public R save(@Valid @RequestBody CenterCostDescVo centerCostDescVo) {
|
|
|
+ return R.status(centerCostDescService.save(centerCostDescVo));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改 出入库费用表
|
|
|
+ */
|
|
|
+ @PostMapping("/update")
|
|
|
+ @ApiOperationSupport(order = 5)
|
|
|
+ @ApiOperation(value = "修改", notes = "传入centerShipCost")
|
|
|
+ public R update(@Valid @RequestBody CenterCostDescVo centerCostDescVo) {
|
|
|
+ return R.status(centerCostDescService.updateById(centerCostDescVo));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增或修改 出入库费用表
|
|
|
+ */
|
|
|
+ @PostMapping("/submit")
|
|
|
+ @ApiOperationSupport(order = 6)
|
|
|
+ public R submit(@Valid @RequestBody CenterCostDescVo centerCostDescVo) {
|
|
|
+ BladeUser bladeUser = AuthUtil.getUser();
|
|
|
+ if (Objects.isNull(centerCostDescVo.getId())) {
|
|
|
+ centerCostDescVo.setCreateUser(bladeUser.getUserId());
|
|
|
+ centerCostDescVo.setCreateDept(Long.valueOf(bladeUser.getDeptId()));
|
|
|
+ centerCostDescVo.setCreateTime(new Date());
|
|
|
+ centerCostDescVo.setVersion(1);
|
|
|
+ } else {
|
|
|
+ centerCostDescVo.setUpdateUser(bladeUser.getUserId());
|
|
|
+ centerCostDescVo.setUpdateTime(new Date());
|
|
|
+ centerCostDescVo.setVersion(centerCostDescVo.getVersion() + 1);
|
|
|
+ }
|
|
|
+ return R.status(centerCostDescService.saveOrUpdate(centerCostDescVo));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除 出入库费用表
|
|
|
+ */
|
|
|
+ @PostMapping("/remove")
|
|
|
+ @ApiOperationSupport(order = 8)
|
|
|
+ @ApiOperation(value = "删除", notes = "传入ids")
|
|
|
+ public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
|
|
|
+ return R.status(centerCostDescService.removeByIds(Func.toLongList(ids)));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|