package com.ydtech.modules.ins.controller; import com.ydtech.core.page.HttpResult; import com.ydtech.modules.base.controller.BaseController; import com.ydtech.modules.ins.model.InsLaborCost; import com.ydtech.modules.ins.model.vo.InsLaborCostAddVo; import com.ydtech.modules.ins.model.vo.InsLaborCostIdsVo; import com.ydtech.modules.ins.model.vo.InsLaborCostVo; import com.ydtech.modules.ins.service.InsLaborCostService; import com.ydtech.modules.order.entity.BasePageResult; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; 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; @Api(tags = "年度成本利润管理") @RequestMapping("/insLaborCost") @RestController public class InsLaborCostController extends BaseController { @Autowired private InsLaborCostService insLaborCostService; @PostMapping("queryPage") @ApiOperation(value = "分页") public HttpResult> queryPage(@RequestBody InsLaborCostVo insLaborCostVo) { try{ BasePageResult result = insLaborCostService.queryPage(insLaborCostVo); return HttpResult.ok("查询数据成功", result); }catch (Exception e){ return HttpResult.error("查询错误"+e.getMessage()); } } @PostMapping("addOrUpdate") @ApiOperation("添加修改") public HttpResult addOrUpdate(@RequestBody InsLaborCostAddVo insLaborCostAddVo) { try{ insLaborCostService.addOrUpdate(insLaborCostAddVo,getUser()); return HttpResult.ok("操作成功"); }catch (Exception e){ return HttpResult.error("操作失败"+e.getMessage()); } } @PostMapping("delete") @ApiOperation("删除对象") public HttpResult delete(@RequestBody InsLaborCostIdsVo idsVo) { if(idsVo.getIds()==null || idsVo.getIds().size()==0){ return HttpResult.error("ids集合不能为空"); } try{ insLaborCostService.deleteByIds(idsVo.getIds()); return HttpResult.ok("删除成功"); }catch (Exception e){ return HttpResult.error("删除失败"+e.getMessage()); } } }