Browse Source

解决数据注册编辑目录分类没有回显

lidongyang 5 years ago
parent
commit
824850ac96

+ 5 - 0
src/main/java/com/lightinit/hsdataplatform/controller/admin/ResourceDataRegisterController.java

@@ -12,6 +12,7 @@ import com.lightinit.hsdataplatform.mapper.PublishInfoMapper;
 import com.lightinit.hsdataplatform.model.ResultState;
 import com.lightinit.hsdataplatform.model.ResultStateCode;
 import com.lightinit.hsdataplatform.model.admin.*;
+import com.lightinit.hsdataplatform.service.admin.IResourceAPIRegisterService;
 import com.lightinit.hsdataplatform.service.admin.IResourceDataRegisterService;
 import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
@@ -43,6 +44,9 @@ public class ResourceDataRegisterController extends BaseController {
     @Autowired
     private IResourceDataRegisterService resourceDataRegisterService;
 
+    @Autowired
+    private IResourceAPIRegisterService resourceAPIRegisterService ;
+
     @RequestMapping(value = "index.htm")
     public ModelAndView index(){
         ModelAndView modelAndView = new ModelAndView("admin/data_register/index");
@@ -115,6 +119,7 @@ public class ResourceDataRegisterController extends BaseController {
             modelAndView.addObject("dataFileName", StringUtils.isNotEmpty(busiModel.getDataFile()) ? UploadFileUtils.getFileNameByPath(busiModel.getDataFile()) : null);
             modelAndView.addObject("demoFileName", StringUtils.isNotEmpty(busiModel.getDemoFile()) ? UploadFileUtils.getFileNameByPath(busiModel.getDemoFile()) : null);
         }
+        modelAndView.addObject("resource", resourceAPIRegisterService.queryOneResource(id)) ;
         modelAndView.addObject("dicResourceShareType", DicResourceShareType.getInstacne().getDicMap());
         modelAndView.addObject("dicResourceOpenType", DicResourceOpenType.getInstacne().getDicMap());
         return modelAndView;

+ 18 - 7
src/main/webapp/pages/admin/data_register/edit.jsp

@@ -2,8 +2,9 @@
 <%@ page import="com.lightinit.hsdataplatform.dictionary.DicResourceState" %>
 <%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
 <%@ page isELIgnored="false" %>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
 <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
 <%
     String basePath = request.getContextPath();
 %>
@@ -58,12 +59,22 @@
     <div class="form-group">
         <label for="resourceSummary" class="col-md-3 col-sm-3 control-label"><span style="color: red;">*</span>目录分类:</label>
         <div class="col-md-7 col-sm-7">
-            <input type="checkbox" name="catelogType" value="<%=DicResourceCatelogType.BASIC%>" /><%=DicResourceCatelogType.BASIC%>
-            <input type="checkbox" name="catelogType" value="<%=DicResourceCatelogType.SECTOR%>" style="margin-left: 50px;" /><%=DicResourceCatelogType.SECTOR%>
-            <br />
-            <input type="checkbox" name="catelogType" value="<%=DicResourceCatelogType.THEME%>" /><%=DicResourceCatelogType.THEME%>
-            <input type="checkbox" name="catelogType" value="<%=DicResourceCatelogType.CUSTOM%>" style="margin-left: 50px;" /><%=DicResourceCatelogType.CUSTOM%>
-            <span class="help-block"></span>
+<%--            <input type="checkbox" name="catelogType" value="<%=DicResourceCatelogType.BASIC%>" /><%=DicResourceCatelogType.BASIC%>--%>
+<%--            <input type="checkbox" name="catelogType" value="<%=DicResourceCatelogType.SECTOR%>" style="margin-left: 50px;" /><%=DicResourceCatelogType.SECTOR%>--%>
+<%--            <br />--%>
+<%--            <input type="checkbox" name="catelogType" value="<%=DicResourceCatelogType.THEME%>" /><%=DicResourceCatelogType.THEME%>--%>
+<%--            <input type="checkbox" name="catelogType" value="<%=DicResourceCatelogType.CUSTOM%>" style="margin-left: 50px;" /><%=DicResourceCatelogType.CUSTOM%>--%>
+<%--            <span class="help-block"></span>--%>
+    <input type="checkbox" name="catelogType" <c:if test="${fn:contains(resource.catelogType,'基础分类')}">checked</c:if>
+           value="<%=DicResourceCatelogType.BASIC%>" /><%=DicResourceCatelogType.BASIC%>
+    <input type="checkbox" name="catelogType" <c:if test="${fn:contains(resource.catelogType,'部门分类')}">checked</c:if>
+           value="<%=DicResourceCatelogType.SECTOR%>" style="margin-left: 50px;" /><%=DicResourceCatelogType.SECTOR%>
+    <br />
+    <input type="checkbox" name="catelogType" <c:if test="${fn:contains(resource.catelogType,'主题分类')}">checked</c:if>
+           value="<%=DicResourceCatelogType.THEME%>" /><%=DicResourceCatelogType.THEME%>
+    <input type="checkbox" name="catelogType" <c:if test="${fn:contains(resource.catelogType,'自定义分类')}">checked</c:if>
+           value="<%=DicResourceCatelogType.CUSTOM%>" style="margin-left: 50px;" /><%=DicResourceCatelogType.CUSTOM%>
+    <span class="field-validation-valid help-block"></span>
         </div>
     </div>
     <div class="form-group">