package com.changhong.epc.admin.service.master.impl; import com.changhong.epc.admin.mapper.centen.master.MasterElementMapper; import com.changhong.epc.admin.mapper.centen.master.MasterValueMapper; import com.changhong.epc.bean.tenant.master.MasterAlias; import com.changhong.epc.bean.tenant.master.MasterEleValue; import com.changhong.epc.bean.tenant.master.MasterElement; import com.changhong.epc.bean.tenant.master.extend.MasterElementExtend; import com.changhong.epc.config.service.MasterElementService; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; import java.util.Objects; @Service public class MasterElementServiceImpl extends MasterElementService { @Resource private MasterElementMapper masterElementMapper; @Resource private MasterValueMapper masterValueMapper; @Override public List selectByCode(String defineCode) { return masterElementMapper.selectByCode(defineCode); } @Override public String getValFunc(MasterEleValue value) { return Objects.toString(masterValueMapper.getVal(value),""); } @Override public List elementInfos(MasterElement masterList) { return masterElementMapper.elementInfos(masterList.getDefineCode()); } @Override public int updateAlias(MasterAlias alias) { String defCode = alias.getDefineCode(); int count = -1; //清空原有alias masterElementMapper.updateAlias(defCode, null, ""); //修改新得元素code if(!"".equals( alias.getCode()) && alias.getCode()!=null){ count += masterElementMapper.updateAlias(defCode, alias.getCode(), "code"); } //修改新的得value if(!"".equals( alias.getName()) && alias.getName()!=null) { count += masterElementMapper.updateAlias(defCode, alias.getName(), "value"); } return count; } public MasterElement geteleCode(String code){ MasterElement masterElement=new MasterElement(); masterElement.setName(masterElementMapper.geteleCode(code,"value")); masterElement.setCode(masterElementMapper.geteleCode(code,"code")); return masterElement; } }