InsLaborCostController.java 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package com.ydtech.modules.ins.controller;
  2. import com.ydtech.core.page.HttpResult;
  3. import com.ydtech.modules.base.controller.BaseController;
  4. import com.ydtech.modules.ins.model.InsLaborCost;
  5. import com.ydtech.modules.ins.model.vo.InsLaborCostAddVo;
  6. import com.ydtech.modules.ins.model.vo.InsLaborCostIdsVo;
  7. import com.ydtech.modules.ins.model.vo.InsLaborCostVo;
  8. import com.ydtech.modules.ins.service.InsLaborCostService;
  9. import com.ydtech.modules.order.entity.BasePageResult;
  10. import io.swagger.annotations.Api;
  11. import io.swagger.annotations.ApiOperation;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.web.bind.annotation.PostMapping;
  14. import org.springframework.web.bind.annotation.RequestBody;
  15. import org.springframework.web.bind.annotation.RequestMapping;
  16. import org.springframework.web.bind.annotation.RestController;
  17. @Api(tags = "年度成本利润管理")
  18. @RequestMapping("/insLaborCost")
  19. @RestController
  20. public class InsLaborCostController extends BaseController {
  21. @Autowired
  22. private InsLaborCostService insLaborCostService;
  23. @PostMapping("queryPage")
  24. @ApiOperation(value = "分页")
  25. public HttpResult<BasePageResult<InsLaborCost>> queryPage(@RequestBody InsLaborCostVo insLaborCostVo) {
  26. try{
  27. BasePageResult<InsLaborCost> result = insLaborCostService.queryPage(insLaborCostVo);
  28. return HttpResult.ok("查询数据成功", result);
  29. }catch (Exception e){
  30. return HttpResult.error("查询错误"+e.getMessage());
  31. }
  32. }
  33. @PostMapping("addOrUpdate")
  34. @ApiOperation("添加修改")
  35. public HttpResult<Object> addOrUpdate(@RequestBody InsLaborCostAddVo insLaborCostAddVo) {
  36. try{
  37. insLaborCostService.addOrUpdate(insLaborCostAddVo,getUser());
  38. return HttpResult.ok("操作成功");
  39. }catch (Exception e){
  40. return HttpResult.error("操作失败"+e.getMessage());
  41. }
  42. }
  43. @PostMapping("delete")
  44. @ApiOperation("删除对象")
  45. public HttpResult<Object> delete(@RequestBody InsLaborCostIdsVo idsVo) {
  46. if(idsVo.getIds()==null || idsVo.getIds().size()==0){
  47. return HttpResult.error("ids集合不能为空");
  48. }
  49. try{
  50. insLaborCostService.deleteByIds(idsVo.getIds());
  51. return HttpResult.ok("删除成功");
  52. }catch (Exception e){
  53. return HttpResult.error("删除失败"+e.getMessage());
  54. }
  55. }
  56. }