后台:
@RequestMapping("/cmci/v_divide_check_add.do")
public String toDivideCheckAdd(HttpServletRequest request,ModelMap model,Long ids,String operId){
List<MsStaticDataDef> status = mssddService.queryStaticDataDefByDddCode(StaticDataDef.CM_ASSESSMENT_TYPE.getCode());
CmCheckCycleDef cycleDef = scService.get().getCcdId();
List<CmCheckCatalogInfo> catalogInfo = ccciService.findByCcdId(cycleDef.getCcdId());
//所有考核类别list
List<MsStaticDataDef> catalog = new ArrayList<MsStaticDataDef>();
for (CmCheckCatalogInfo cmCheckCatalogInfo : catalogInfo) {
catalog.add(cmCheckCatalogInfo.getId().getCatalog());
System.out.println(cmCheckCatalogInfo.getId().getCatalog().getSddId());
}
//已经存在关联(CmMmiCmiCtgRel)
List<CmMmiCmiCtgRel> cccrList = cccrService.getMccrByCcdIdAndMciId(cycleDef.getCcdId(), ids);
if(cccrList!=null && cccrList.size()>0){
Map<String, CmMmiCmiCtgRel> map = new HashMap<String, CmMmiCmiCtgRel>();
for(CmMmiCmiCtgRel cr : cccrList){
System.out.println(cr.getCatalog().getSddId());
map.put(cr.getCatalog().getSddId(), cr);
}
model.addAttribute("map", map);
}
model.addAttribute("catalog", catalog);
model.addAttribute("status", status);
model.addAttribute("cycleDef", cycleDef);
model.addAttribute("ccdId", scService.get().getCcdId().getCcdId());
model.addAttribute("mciId", ids);
model.addAttribute("operId", operId);
return "cm/cmci/divide_check_add";
}
前台:
<@e.form id="jvForm" action="o_divide_check_save.do">
<@e.hidden name="ccdId" value="${ccdId!}" />
<@e.hidden name="mciId" value="${mciId!}" />
<@e.hidden name="operId" value="${operId!}" />
<#list catalog as ca >
<#if map?? &&(map[ca.sddId])?exists && (ca.sddId == map[ca.sddId].catalog.sddId)>
<@e.hidden name="checkMmi" value="${(map[ca.sddId].cmiId.cmiId)!}" id="v_${(ca.sddId)!}"/>
<@e.text label="${(ca.sddName)!}" readonly="readonly" id="n_${(ca.sddId)!}" value="${(map[ca.sddId].cmiId.cmiMechanismName)!}" />
<a onclick="show_cids('v_${(ca.sddId)!}','n_${(ca.sddId)!}','${(ca.sddId)!}')" href="javascript:;" style="left: 525px;margin-top:-33px;position: absolute;">
<img border="0" src="${base}/res/pra/img/find.png">
</a>
<@e.hidden name="checkType" value="${(ca.sddId)!}" />
<@e.hidden name="refId" value="${(map[ca.sddId].mccrId)!}" />
<#else>
<@e.hidden name="checkMmi" value="" id="v_${(ca.sddId)!}"/>
<@e.text label="${(ca.sddName)!}" readonly="readonly" id="n_${(ca.sddId)!}" />
<a onclick="show_cids('v_${(ca.sddId)!}','n_${(ca.sddId)!}','${(ca.sddId)!}')" href="javascript:;" style="left: 525px;margin-top:-33px;position: absolute;">
<img border="0" src="${base}/res/pra/img/find.png">
</a>
<@e.hidden name="checkType" value="${(ca.sddId)!}" />
<@e.hidden name="refId" value="" />
</#if>
</#list>
<@cms_perm url="#" >
<@e.submit value="确认保存"/>
</@cms_perm> <@e.reset code="global.reset"/>
</@e.form>