Resources 优化

Resources 优化
This commit is contained in:
MaxKey 2020-07-19 09:27:42 +08:00
parent 0276059f1a
commit a475042f66
10 changed files with 151 additions and 35 deletions

View File

@ -35,6 +35,8 @@ public class Resources extends JpaBaseDomain implements Serializable {
@Column @Column
String name; String name;
@Column @Column
int sortIndex;
@Column
String appId; String appId;
@Column @Column
String parentId; String parentId;
@ -43,6 +45,10 @@ public class Resources extends JpaBaseDomain implements Serializable {
@Column @Column
String resourceType; String resourceType;
@Column @Column
String resourceIcon;
@Column
String resourceStyle;
@Column
String resourceUrl; String resourceUrl;
@Column @Column
String resourceAction; String resourceAction;
@ -112,6 +118,22 @@ public class Resources extends JpaBaseDomain implements Serializable {
this.resourceType = resourceType; this.resourceType = resourceType;
} }
public String getResourceIcon() {
return resourceIcon;
}
public void setResourceIcon(String resourceIcon) {
this.resourceIcon = resourceIcon;
}
public String getResourceStyle() {
return resourceStyle;
}
public void setResourceStyle(String resourceStyle) {
this.resourceStyle = resourceStyle;
}
public String getResourceUrl() { public String getResourceUrl() {
return resourceUrl; return resourceUrl;
} }
@ -175,5 +197,13 @@ public class Resources extends JpaBaseDomain implements Serializable {
public void setModifiedDate(String modifiedDate) { public void setModifiedDate(String modifiedDate) {
this.modifiedDate = modifiedDate; this.modifiedDate = modifiedDate;
} }
public int getSortIndex() {
return sortIndex;
}
public void setSortIndex(int sortIndex) {
this.sortIndex = sortIndex;
}
} }

View File

@ -17,6 +17,8 @@
package org.maxkey.persistence.service; package org.maxkey.persistence.service;
import java.util.List;
import org.apache.mybatis.jpa.persistence.JpaBaseService; import org.apache.mybatis.jpa.persistence.JpaBaseService;
import org.maxkey.domain.Resources; import org.maxkey.domain.Resources;
import org.maxkey.persistence.mapper.ResourcesMapper; import org.maxkey.persistence.mapper.ResourcesMapper;
@ -37,4 +39,8 @@ public class ResourcesService extends JpaBaseService<Resources>{
// TODO Auto-generated method stub // TODO Auto-generated method stub
return (ResourcesMapper)super.getMapper(); return (ResourcesMapper)super.getMapper();
} }
public List<Resources> queryResourcesTree(Resources resource){
return getMapper().queryPageResults(resource);
}
} }

View File

@ -27,6 +27,7 @@
WHERE WHERE
(1=1) (1=1)
<include refid="where_statement"/> <include refid="where_statement"/>
ORDER BY SORTINDEX
</select> </select>

View File

@ -160,7 +160,7 @@ public class ResourcesController {
_logger.debug("resourcesTree appId :" + appId + " ,appName " + appName); _logger.debug("resourcesTree appId :" + appId + " ,appName " + appName);
Resources queryRes = new Resources(); Resources queryRes = new Resources();
queryRes.setAppId(appId); queryRes.setAppId(appId);
List<Resources> resourcesList = this.resourcesService.query(queryRes); List<Resources> resourcesList = this.resourcesService.queryResourcesTree(queryRes);
TreeNodeList treeNodeList = new TreeNodeList(); TreeNodeList treeNodeList = new TreeNodeList();
TreeNode rootNode = new TreeNode(appId, appName); TreeNode rootNode = new TreeNode(appId, appName);

View File

@ -391,11 +391,20 @@ role.name=\u89D2\u8272
resource.id=\u8D44\u6E90\u7F16\u7801 resource.id=\u8D44\u6E90\u7F16\u7801
resource.name=\u8D44\u6E90\u540D\u79F0 resource.name=\u8D44\u6E90\u540D\u79F0
resource.pid=\u7236\u7EA7\u7F16\u7801 resource.parentId=\u7236\u7EA7\u7F16\u7801
resource.pname=\u7236\u7EA7\u540D\u79F0 resource.parentName=\u7236\u7EA7\u540D\u79F0
resource.resType=\u8D44\u6E90\u7C7B\u578B resource.resourceType=\u8D44\u6E90\u7C7B\u578B
resource.resUrl=\u8D44\u6E90\u5730\u5740 resource.resourceType.Menu=\u83DC\u5355
resource.resAction=\u52A8\u4F5C resource.resourceType.Element=\u5143\u7D20
resource.resourceType.Button=\u6309\u94AE
resource.resourceType.Module=\u6A21\u5757
resource.resourceType.File=\u6587\u4EF6
resource.resourceType.Data=\u6570\u636E
resource.resourceType.Other=\u5176\u4ED6
resource.resourceIcon=\u56FE\u6807
resource.resourceUrl=\u8D44\u6E90\u5730\u5740
resource.resourceAction=\u52A8\u4F5C
resource.resourceStyle=\u6837\u5F0F
#account #account
account.username=\u7528\u6237\u540D account.username=\u7528\u6237\u540D

View File

@ -390,11 +390,20 @@ role.name=name
resource.id=id resource.id=id
resource.name=name resource.name=name
resource.pid=pid resource.parentId=parentId
resource.pname=pname resource.parentName=parentName
resource.resType=Type resource.resourceType=Type
resource.resUrl=URL resource.resourceType.Menu=Menu
resource.resAction=Action resource.resourceType.Button=Button
resource.resourceType.Element=Element
resource.resourceType.Module=Module
resource.resourceType.File=File
resource.resourceType.Data=Data
resource.resourceType.Other=Other
resource.resourceIcon=Icon
resource.resourceUrl=URL
resource.resourceAction=Action
resource.resourceStyle=Style
#account #account
account.username=username account.username=username

View File

@ -391,11 +391,20 @@ role.name=\u89D2\u8272
resource.id=\u8D44\u6E90\u7F16\u7801 resource.id=\u8D44\u6E90\u7F16\u7801
resource.name=\u8D44\u6E90\u540D\u79F0 resource.name=\u8D44\u6E90\u540D\u79F0
resource.pid=\u7236\u7EA7\u7F16\u7801 resource.parentId=\u7236\u7EA7\u7F16\u7801
resource.pname=\u7236\u7EA7\u540D\u79F0 resource.parentName=\u7236\u7EA7\u540D\u79F0
resource.resType=\u8D44\u6E90\u7C7B\u578B resource.resourceType=\u8D44\u6E90\u7C7B\u578B
resource.resUrl=\u8D44\u6E90\u5730\u5740 resource.resourceType.Menu=\u83DC\u5355
resource.resAction=\u52A8\u4F5C resource.resourceType.Element=\u5143\u7D20
resource.resourceType.Button=\u6309\u94AE
resource.resourceType.Module=\u6A21\u5757
resource.resourceType.File=\u6587\u4EF6
resource.resourceType.Data=\u6570\u636E
resource.resourceType.Other=\u5176\u4ED6
resource.resourceIcon=\u56FE\u6807
resource.resourceUrl=\u8D44\u6E90\u5730\u5740
resource.resourceAction=\u52A8\u4F5C
resource.resourceStyle=\u6837\u5F0F
#account #account
account.username=\u7528\u6237\u540D account.username=\u7528\u6237\u540D

View File

@ -47,7 +47,7 @@
</td> </td>
<th><@locale code="common.text.sortindex"/></th> <th><@locale code="common.text.sortindex"/></th>
<td> <td>
<input type="text" id="sortOrder" class="form-control" name="sortOrder" title="" value="1" required="" /> <input type="text" id="sortIndex" class="form-control" name="sortIndex" title="" value="1" required="" />
</td> </td>
</tr> </tr>
<tr> <tr>

View File

@ -25,7 +25,7 @@ $(function () {
<tr> <tr>
<th><@locale code="resource.id" /></th> <th><@locale code="resource.id" /></th>
<td nowrap> <td nowrap>
<input type="text" id="id" name="id" class="form-control" title="" value="" required="" /> <input type="text" id="id" name="id" class="form-control" title="" value="" />
</td> </td>
</tr> </tr>
<tr> <tr>
@ -41,35 +41,61 @@ $(function () {
</td> </td>
</tr> </tr>
<tr> <tr>
<th><@locale code="resource.pid" /></th> <th><@locale code="resource.parentId" /></th>
<td nowrap> <td nowrap>
<input type="text" id="parentId" name="parentId" class="form-control" title="" value="" required="" /> <input type="text" id="parentId" name="parentId" class="form-control" title="" value="" required="" />
</td> </td>
</tr> </tr>
<tr> <tr>
<th><@locale code="resource.pname" /></th> <th><@locale code="resource.parentName" /></th>
<td nowrap> <td nowrap>
<input type="text" id="parentName" name="parentName" class="form-control" title="" value="" required="" /> <input type="text" id="parentName" name="parentName" class="form-control" title="" value="" required="" />
</td> </td>
</tr> </tr>
<tr> <tr>
<th><@locale code="resource.resType" /></th> <th><@locale code="resource.resourceType" /></th>
<td nowrap> <td nowrap>
<input type="text" id="resourceType" name="resourceType" class="form-control" title="" value="" required="" /> <select id="resourceType" name="resourceType" class="form-control" >
<option value="MENU" selected ><@locale code="resource.resourceType.Menu" /></option>
<option value="ELEMENT" ><@locale code="resource.resourceType.Element" /></option>
<option value="BUTTON" ><@locale code="resource.resourceType.Button" /></option>
<option value="MODULE" ><@locale code="resource.resourceType.Module" /></option>
<option value="FILE" ><@locale code="resource.resourceType.File" /></option>
<option value="DATA" ><@locale code="resource.resourceType.Data" /></option>
<option value="OTHER" ><@locale code="resource.resourceType.Other" /></option>
</select>
</td> </td>
</tr> </tr>
<tr> <tr>
<th><@locale code="resource.resUrl" /></th> <th><@locale code="resource.resourceUrl" /></th>
<td nowrap> <td nowrap>
<input type="text" id="resourceUrl" name="resourceUrl" class="form-control" title="" value="" required="" /> <input type="text" id="resourceUrl" name="resourceUrl" class="form-control" title="" value="" />
</td> </td>
</tr> </tr>
<tr> <tr>
<th><@locale code="resource.resAction" /></th> <th><@locale code="resource.resourceAction" /></th>
<td nowrap> <td nowrap>
<input type="text" id="resourceAction" name="resourceAction" class="form-control" title="" value="" required="" /> <input type="text" id="resourceAction" name="resourceAction" class="form-control" title="" value="" />
</td> </td>
</tr> </tr>
<tr>
<th><@locale code="resource.resourceIcon" /></th>
<td nowrap>
<input type="text" id="resourceIcon" name="resourceIcon" class="form-control" title="" value="" />
</td>
</tr>
<tr>
<th><@locale code="resource.resourceStyle" /></th>
<td nowrap>
<input type="text" id="resourceStyle" name="resourceStyle" class="form-control" title="" value="" />
</td>
</tr>
<tr>
<th><@locale code="common.text.sortindex"/></th>
<td>
<input type="text" id="sortIndex" class="form-control" name="sortIndex" title="" value="1" required="" />
</td>
</tr>
<tr> <tr>
<th><@locale code="common.text.description" /></th> <th><@locale code="common.text.description" /></th>
<td nowrap> <td nowrap>

View File

@ -27,7 +27,7 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<th><@locale code="resource.pid" /></th> <th><@locale code="resource.parentId" /></th>
<td nowrap> <td nowrap>
<input type="text" id="parentId" name="parentId" class="form-control" title="" value="${model.parentId!}" required="" /> <input type="text" id="parentId" name="parentId" class="form-control" title="" value="${model.parentId!}" required="" />
</td> </td>
@ -39,29 +39,55 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<th><@locale code="resource.pname" /></th> <th><@locale code="resource.parentName" /></th>
<td nowrap> <td nowrap>
<input type="text" id="parentName" name="parentName" class="form-control" title="" value="${model.parentName!}" required="" /> <input type="text" id="parentName" name="parentName" class="form-control" title="" value="${model.parentName!}" required="" />
</td> </td>
</tr> </tr>
<tr> <tr>
<th><@locale code="resource.resType" /></th> <th><@locale code="resource.resourceType" /></th>
<td nowrap> <td nowrap>
<input type="text" id="resourceType" name="resourceType" class="form-control" title="" value="${model.resourceType!}" required="" /> <select id="resourceType" name="resourceType" class="form-control" >
<option value="MENU" <#if 'MENU'==model.resourceType>selected</#if> ><@locale code="resource.resourceType.Menu" /></option>
<option value="ELEMENT" <#if 'ELEMENT'==model.resourceType>selected</#if> ><@locale code="resource.resourceType.Element" /></option>
<option value="BUTTON" <#if 'BUTTON'==model.resourceType>selected</#if> ><@locale code="resource.resourceType.Button" /></option>
<option value="MODULE" <#if 'MODULE'==model.resourceType>selected</#if> ><@locale code="resource.resourceType.Module" /></option>
<option value="FILE" <#if 'FILE'==model.resourceType>selected</#if> ><@locale code="resource.resourceType.File" /></option>
<option value="DATA" <#if 'DATA'==model.resourceType>selected</#if> ><@locale code="resource.resourceType.Data" /></option>
<option value="OTHER" <#if 'OTHER'==model.resourceType >selected</#if> ><@locale code="resource.resourceType.Other" /></option>
</select>
</td>
</tr>
<tr>
<th><@locale code="resource.resourceUrl" /></th>
<td nowrap>
<input type="text" id="resourceUrl" name="resourceUrl" class="form-control" title="" value="${model.resourceUrl!}" />
</td> </td>
</tr> </tr>
<tr> <tr>
<th><@locale code="resource.resUrl" /></th> <th><@locale code="resource.resourceAction" /></th>
<td nowrap> <td nowrap>
<input type="text" id="resourceUrl" name="resourceUrl" class="form-control" title="" value="${model.resourceUrl!}" required="" /> <input type="text" id="resourceAction" name="resourceAction" class="form-control" title="" value="${model.resourceAction!}" />
</td> </td>
</tr> </tr>
<tr> <tr>
<th><@locale code="resource.resAction" /></th> <th><@locale code="resource.resourceIcon" /></th>
<td nowrap> <td nowrap>
<input type="text" id="resourceAction" name="resourceAction" class="form-control" title="" value="${model.resourceAction!}" required="" /> <input type="text" id="resourceIcon" name="resourceIcon" class="form-control" title="" value="${model.resourceIcon!}" />
</td> </td>
</tr> </tr>
<tr>
<th><@locale code="resource.resourceStyle" /></th>
<td nowrap>
<input type="text" id="resourceStyle" name="resourceStyle" class="form-control" title="" value="${model.resourceStyle!}" />
</td>
</tr>
<tr>
<th><@locale code="common.text.sortindex"/></th>
<td>
<input type="text" id="sortIndex" class="form-control" name="sortIndex" title="" value="1" required="${model.sortIndex!}" />
</td>
</tr>
<tr> <tr>
<th><@locale code="common.text.description" /></th> <th><@locale code="common.text.description" /></th>
<td nowrap> <td nowrap>