package cn.autoform.web.service.common; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.alibaba.fastjson.parser.JSONToken; import cn.autoform.db.entity.CodeMasterEntity; import cn.autoform.util.tool.JSONTool; import cn.autoform.web.mapper.common.CommonMapper; /** * 共通Service * @author yangrx * */ @Service public class CommonService { @Autowired private CommonMapper commonMapper = null; public List queryCodeAndValue(String codeDiv, String subCodeDiv){ return commonMapper.queryCodeAndValue(codeDiv, subCodeDiv); } public String queryValueByCode(String codeDiv, String subCodeDiv, String code){ return commonMapper.queryValueByCode(codeDiv, subCodeDiv,code); } public Map> queryTwoCodes(String codeDivFirst, String codeDivSecond){ List allList = commonMapper.queryTwoCodes(codeDivFirst, codeDivSecond); System.err.println(JSONTool.toJson(allList)); List codeDivFirstList = new ArrayList(); List codeDivSecondList = new ArrayList(); for(CodeMasterEntity codeObj : allList) { if(codeObj.getCodeDiv().equals(codeDivFirst)) { codeDivFirstList.add(codeObj); } else { codeDivSecondList.add(codeObj); } } Map> rsMap = new HashMap>(); if(codeDivFirst != null) rsMap.put(codeDivFirst, codeDivFirstList); if(codeDivSecond != null) rsMap.put(codeDivSecond, codeDivSecondList); return rsMap; } public List receiveDoEventList(String type) { return commonMapper.queryDoEventList(type.toUpperCase()); } }