package com.changhong.epc.tenant.service.cost.impl;
|
|
import com.changhong.epc.bean.tenant.cost.CostFromMapping;
|
import com.changhong.epc.bean.tenant.cost.extend.CostFromMappingExtend;
|
import com.changhong.epc.bean.tenant.cost.extend.CostTypeExtend;
|
import com.changhong.epc.tenant.mapper.tenant.cost.CostFromMappingMapper;
|
import com.changhong.epc.tenant.service.cost.CostFromMappingService;
|
import com.iemsoft.framework.cloud.core.tools.JSONTool;
|
import org.springframework.stereotype.Service;
|
|
import javax.annotation.Resource;
|
import java.util.List;
|
|
@Service("costFromMappingServiceImpl")
|
public class CostFromMappingServiceImpl implements CostFromMappingService{
|
|
@Resource
|
private CostFromMappingMapper costFromMapping;
|
|
|
|
|
@Override
|
public CostFromMappingExtend selectOne(CostFromMapping costFrom) {
|
// System.out.println(costFrom.getFId()+"参数为");
|
return costFromMapping.selectCostType(costFrom);
|
}
|
|
|
|
|
@Override
|
public int updateCost(CostTypeExtend cost) {
|
List<CostFromMapping> list = cost.getCostFromMapping();
|
int count = 0;
|
if(list!=null){
|
for(CostFromMapping costs : list){
|
costs.setCtId(cost.getId());
|
// System.out.println(JSONTool.toJson(costs));
|
if(costs.getFId() == null || costs.getFName()== null || "".equals(costs.getFName())){
|
// System.out.println("删除表单");
|
costFromMapping.deleteFormByCtidAndType(costs.getCtId(),costs.getType());
|
}
|
if((!"".equals(costs.getFId())) && costs.getFId() != null && costFromMapping.selectByctId(costs) != null){
|
// System.out.println("进入修改");
|
// System.out.println(JSONTool.toJson(costs));
|
count += costFromMapping.updateCost(costs);
|
}else if(costs.getFId() !=null && !costs.getFId().equals("")){
|
costs.initParam();
|
count += costFromMapping.insert(costs);
|
// System.out.println("进入添加");
|
// System.out.println(JSONTool.toJson(costs));
|
}
|
}
|
}
|
return count;
|
}
|
|
@Override
|
public List<CostFromMapping> getConstFroms(CostFromMapping cost) {
|
return costFromMapping.getConstFroms(cost);
|
}
|
|
@Override
|
public List<CostFromMapping> selectType(CostFromMapping cost) {
|
return costFromMapping.selectType(cost.getType());
|
}
|
|
|
}
|