package com.changhong.epc.admin.controller.cost; import java.util.List; import javax.annotation.Resource; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import com.changhong.epc.admin.service.cost.CostFromTemplateService; import com.changhong.epc.admin.service.cost.CostGroupTypeService; import com.changhong.epc.bean.admin.CostGroupType; import com.changhong.epc.bean.admin.extend.CostGroupTypeExtend; import com.changhong.epc.constter.admin.AdminUrlConst; import com.iemsoft.framework.cloud.core.tools.JSONTool; @RestController public class CostGroupTypeController implements AdminUrlConst { @Resource(name = "costGroupTypeServiceImpl") private CostGroupTypeService costGroupTypeService; @Resource(name = "costFromTemplateServiceImpl") private CostFromTemplateService costFromTemplateService; /** * 查询费用组费用类型 * */ @PostMapping(REST_ADMIN_COSTGROUPTYPE_SELECTCOSTTREE) public List SelectCostTree(@RequestBody CostGroupType costGroupType){ return costGroupTypeService.selectTree(costGroupType); } /** * 添加费用组费用类型 * */ @PostMapping(REST_ADMIN_COSTGROUPTYPE_ADDCOSTTYPE) public CostGroupType addCostType( @RequestBody CostGroupTypeExtend costGroupType) { return costGroupTypeService.addCostType(costGroupType); } /** * 修改费用组费用类型 * */ @PostMapping( REST_ADMIN_COSTGROUPTYPE_UPDATECOSTTYPE) public int updateCostType(@RequestBody CostGroupTypeExtend costGroupType) { // System.err.println(JSONTool.toJson(costGroupType)); // System.out.println("2"); costFromTemplateService.updateCost(costGroupType); return costGroupTypeService.updateCostType(costGroupType); } /** * 删除费用组费用类型 * */ @PostMapping( REST_ADMIN_COSTGROUPTYPE_EDLETECOSTTYPE) public int deleteCostType(@RequestBody CostGroupType costGroupType) { return costGroupTypeService.deleteCostType(costGroupType); } /** * 分页查询父类与所有子类 * */ @PostMapping( REST_ADMIN_COSTGROUPTYPE_SELECTTREEPAGE) public List selectTreePage(@RequestBody CostGroupType costGroupType) { return costGroupTypeService.selectTreePage(costGroupType); } /** * 查询子类与其父类 * */ @PostMapping( REST_ADMIN_COSTGROUPTYPE_SELECTCOSTTYPEONE) public CostGroupTypeExtend selectTreeOne(@RequestBody CostGroupType costGroupType) { return costGroupTypeService.selectTreeOne(costGroupType); } }