当前位置:网站首页>Platform management background and business menu resource management: business permissions and menu resource management design
Platform management background and business menu resource management: business permissions and menu resource management design
2022-07-02 17:32:00 【Jue seconds of writing code】
Business permissions and menu resource management design
In the business menu system , We designed a three-level menu , They are classification 、 Modules and resources . among , The category menu is the top level menu , Represents a microservice application ; The module menu is a secondary menu , Represents an application function ( Entity ) The home page of ; The resource menu is a three-level menu , Represents the permission of a specific operation in the addition, deletion, modification and query of an entity .
In the background of platform management , These menus must be managed in a unified way . The management and design of each menu will be explained respectively .
Category menu management design
The category menu is a top-level menu , It's connected to a Web Microservice application , Such as inventory management 、 Order management, etc , So the top-level menu is just SSO On the home page .
In the category menu management, including addition, deletion, modification and other operations , The design of classified menu query is taken as an example to illustrate . First, use the controller design MerchantKindController, By calling the merchant service KindRestService Get category menu data ; Then convert the query results into view output , Return show.html View design based on Web , The implementation code is as follows :
@Controller
@RequestMapping("/merchantkind")
public class MerchantKindController {
private static Logger logger =
LoggerFactory.getLogger (MerchantKindController.class);
@Autowired
private KindRestService kindRestService;
CRequestMapping(value="/{id} ")
public String show(ModelMap model, @PathVariable Long id) {
String json = kindRestService.findById(id);
model.addAttribute ("kind",new Gson ().fromJson(json, KindQo.class));return "merchantkind/show";
}
}
stay show.html In the view design of , The dialog box shows show.html Page content of . among , The implementation code of the page design part is as follows :
<html xmlns:th="http://www.thymeleaf.org"><div class= "addInfBtn">
<h3 class="itemTit"><span> Categorization information </span></h3><table class="addNewInfList">
<tr>
<th> name </th>
<td width="240"><input class="inp-list w-200 clear-mr f-left"
type="text" th:value="$ {kind.name}" readonly="true"/></td>
<th> Link services </th>
<td width="240">
<input class="inp-list w-200 clear-mr f-left" type="text"
th:value="${kind. link] " readonly="true"/>
</td>
</tr><tr>
<th> date </th><td>
<input onfocus="WdatePicker({dateFmt: 'yyyy-MM-dd HH:mm : ss
type="text" class="inp-list w-200 clear-mr f-left" th:value="$(kind.created) ?$(#dates. format (kind.created,'yyYy-MM-dd HH:mm:ss')] :'"/>
</td>
</tr></table>
<div class="bottomBtnBox">
<a class="btn-93X38 backBtn" href=" javascript:closeDialog(0)"> return </a></div>
</div>
The display effect after the completion of the design is shown in the figure 11-3 Shown .
chart 11-3 What is shown is a “ Order system ” Query information of the category menu of , among “ Link services ” Use the instance name of the order microservice application . When the operator opens the link using the microservice name as the top-level menu , The corresponding link address will be found through the service name and then accessed .
Module menu management design
Module menu is a secondary menu in the background of business management , It represents a business type in an application . for example , On the top menu “ Order system ” Can contain “ Order management ” and “ Order report ” And so on .
In the module menu, the operation contents such as adding, deleting, modifying and checking the menu are included , Next, take the design of new module menu as an example .
Here is a new module menu controller MerchantModelController The design of the :
@Controller
@RequestMapping ("/merchantmodel")
public class MerchantModelController {
private static Logger logger =
LoggerFactory.getLogger (MerchantModelController.class);
@Autowired
private KindRestService kindRestService;
@Autowired
private ModelRestService modelRestService;
@RequestMapping( "/new")
public String create (ModelMap model,HttpServletRequest request){
String json = kindRestService.findList();
List<KindQo> kindQos = new Gson() .fromJson(json,new
TypeToken<List<KindQ0>>() {-getType());
// Cache module list
request.getSession().setAttribute ("kinds",kindQos);model. addAttribute("kinds", kindQ0s);
return "merchantmodel/new";
}
@RequestMapping(value="/save", method = RequestMethod.POST)@ResponseBody
public String save (Mode1Qo modelQo,HttpServletRequest request) throwsException {
// Through modularity D Specify the associated object
String kid = request.getParameter ( "kid");// Get a list of modules
List<KindQ0> kindQos =(List<KindQ0>)
request.getsession().getAttribute("kinds");
for(KindQo kindQo : kindQos){
if (kindQo.getId() .compareTo (new Long (kid)) == 0){
modelQ0. setKind(kindQo);
break;
}
}
String ret = modelRestService.create (modelQ0);logger.info(" newly added =”+ret);
return ret;
}
}
It should be noted that , The query object is used here ModelQo To get the parameters of the form . This is the same as using entity objects to get
The parameters are slightly different , That is to say, the query object cannot be used to get the home of the link , So lalishi n Group is relatively negative , It does not show the ID, Then we get the related objects from the list of objects we saved in the session , instead of
Use kid Such a parameter directly obtains the associated classification object .
In view design of related pages , There must also be a corresponding design . The following is a view of the new module menu new.html The design of the :
<html xmlns:th="http://www.thymeleaf.org">
<script th:srC="e{/scripts/merchantmodel/new.js}"></script><form id="saveForm" action="./save" method="post">
<table class="addNewInfList">
<tr>
<th> name </th>
<td width="240">
<input class="inp-list w-200 clear-mr f-left" type="text"
name= "name" id= "name" maxlength="32"/>
<span class="tipStar f-left">*</span></td>
<th>URL</th>
<td width="240">
<input class="inp-list w-200 clear-mr f-left" type="text"
id="host" name="host" maxlength="64"/>
</td>
</tr>
<tr>
<th> date </th><td>
<input onfocus="WdatePicker({dateFmt:'yYYy-MM-dd HH:mm:ss'})
type="text" class="inp-list w-200 clear-mr f-left" id="created"
name="created"/>
</td>
<th> classification </th>
<td width="240">
<div >
<select name="kid" id="kid">
<option th:each="kind:${kinds} " th:value="${kind.id}
th:text="${#strings.length (kind.name)>20?#strings.substring (kind.name,0,20)+'...' :kind.name } "
></option>
</select>
<span class="tipStar f-right">*</span></div>
</td>
</tr></table>
<div class="bottomBtnBox">
<a class="btn-93x38 saveBtn" href="javascript:void (0)"> determine </a>
<a class="btn-93X38 backBtn" href="javascript: closeDialog()"> return </a></div>
</form>
among , In the module menu associated with the category used by select Control , Used kid This parameter is used to get the ID.
After finishing the design , The display effect of module menu management is shown in the figure 11-4 Shown .
In the figure 11-4 in ,URL It's a link to the order management homepage , The superior menu associated with the menu is “ Order system ”. From this design we can see that , The secondary link address is the home page of an application .
Resource menu management design
Resource menu is a three-level menu in the background of business management , For example, for the module menu “ Order management ” Come on , It can contain “ Order modification ” and “ Order deletion ” And so on . The resource menu is the smallest permission management unit , In the design of permission management, it is the access object associated with the role .
Add, delete, modify and query are included in the resource menu , Let's take the design of resource editing as an example .
Resource editing controller
MerchantResourceController The code for the design part of is as follows :
@Controller
@RequestMapping("/merchantresource")
public class MerchantResourceController{
private static Logger logger =
LoggerFactory.getLogger (MerchantResourceController.class);
@Autowired
private ResourceRestService resourceRestService;
@Autowired
private ModelRestService modelRestService;
@RequestMapping ("/index")
public string index (ModelMap model,Principal user) throws Exception"
model .addAttribute( "user",user);
return "merchantresource/index";
@RequestMapping("/edit/{id} ")
public String edit(@PathVariable Long id,ModelMap model, HttpServletRequestrequest) {
String json = resourceRestService.findById(id);
ResourceQo resourceQo = new Gson().fromJson(json,ResourceQo.class
String models - modelRestService.findList();
List<ModelQo> modelQoList = new Gson().fromJson(models,new
TypeToken<List<ModelQ0>>() {].getType();
// Cache module list
request.getSession().setAttribute ("models",modelQoList);
model .addAttribute( "models",modelQoList);
model.addAttribute("resource", resourceQ0);
return "merchantresource/edit";
}
@RequestMapping (method = RequestMethod. POST, value="/update")@ResponseBody
public String update(ResourceQo resourceQo,HttpServletRequest requestthrows Exception{
// Through the module ID Specify the associated object
String mid - request.getParameter ( "mid");// Get a list of modules
List<ModelQo> modelQos = (List<ModelQ0>)
request.getSession() .getAttribute ( "models");
for(ModelQo modelQ0 : modelQos){
if (modelQo.getId().compareTo(new Long (mid)) ==0){
resourceQo .setModel (modelQ0);
break;
}
}
String ret = resourceRestService.update(resourceQ0);logger.info(” modify ="+ret);
return ret;
}
}
Before resource editing , First, take out the module list , And use this module list to design a drop-down box in the page . Then, when editing resources, select a module from the drop-down box to set its superior menu . Finally, when the data is saved , Through the module D Take out the corresponding object and save it .
Its corresponding page view edit.html The design is as follows :
<html xmlns:th="http://www.thymeleaf.org">
<script th:src="e(/scripts/merchantresource/edit.js}"></script><form id="saveForm" method="post">
<input type="hidden" name="id" id="id" th:value="$ {resource.id}"/><div class="addInfBtn">
<h3 class="itemTit"><span> Resource information </span></h3><table class= "addNewInfList">
<tr>
<th> name </th>
<td width="240">
<input class="inp-list w-200clear-mr f-left" type="text"
th:value="$ {resource.name]" id="name" name="name" maxlength="32"/>
<span class="tipStar f-left">*</span>
</td>
<th> modular </th>
<td width="240">
<div >
<select name="mid" id="mid">
<option th:each="model: ${models}" th:value="${model .id}"
th:text="${#strings. length (model.name)
>20?#strings.substring (model.name, 0, 20)+'...':model.name}"
th:selected="${resource.model !=null and
resOurce. model.id == model.id}"
></option>
</select>
<span class="tipStar f-right">*</span></div>
</td></tr>
<th>URL</th>
<td width="240">
<input class="inp-list w-200 clear-mr f-left" type="text"
th:value="$ {resource.url]" id="url" name="url" maxlength="64">
</td>
<th> date </th><td>
<input onfocus="wdatePicker({dateFmt:' vyyy-MM-dd HH:mm:ss'})"
type="text" class="inp-list w-200 clear-mr f-left"
th:value="${resource.created} ? ${#dates.format (resource.created, 'yvvvy-MM-ddHH :mm : ss')}:'"id="created" name="created" />
</td>
</tr></table>
<div class="bottomBtnBox">
<a class="btn-93x38 saveBtn" href="javascript:void(0) "> determine </a>
<a class="btn-93X38 backBtn" href="javascript:closeDialog (0)"> return <</div>
</div>
</form>
For the module drop-down list, we use mid The way to quote . After finishing the design , The display effect of resource management is shown in the figure 11-5 Shown .
From the picture 11-5 It can be seen that , Three level menu is an operation permission for adding, deleting, modifying and querying an entity in an application ,URL It's a link to execute order modification . A few symbols added after the link address “/**” It's for the convenience of checking permissions , It can also be omitted , And the associated module menu “ Order management ” It is the superior menu of order modification .
The content of this article is platform management background and business menu resource management : Business permissions and menu resource management design
- The next article is to explain the platform management background and business menu resource management : Business role management design ;
- Friends who think the article is good can forward this article and pay attention to Xiaobian ;
- Thank you for your support !
边栏推荐
- 什么是软件开发中的 green field 和 brown field 模式 - 绿地开发和棕地开发
- class和getClass()的区别
- Sword finger offer 21 Adjust the array order so that odd numbers precede even numbers
- traceroute命令讲解
- 阿里天池SQL学习笔记——DAY3
- Qstype implementation of self drawing interface project practice (II)
- Si446 usage record (II): generate header files using wds3
- 将您的基于 Accelerator 的 SAP Commerce Cloud Storefront 迁移到 Spartacus
- The difference of message mechanism between MFC and QT
- Explanation of traceroute command
猜你喜欢
智能垃圾桶(五)——点亮OLED
Experience home office, feel the completion of the project | community essay solicitation
Weili holdings listed on the Hong Kong Stock Exchange: with a market value of HK $500million, it contributed an IPO to Hubei
TCP congestion control details | 2 background
Baobab's gem IPO was terminated: Tang Guangyu once planned to raise 1.8 billion to control 47% of the equity
Connect Porsche and 3PL EDI cases
easyswoole3.2重启不成功
Sword finger offer 25 Merge two sorted linked lists
剑指 Offer 21. 调整数组顺序使奇数位于偶数前面
ETH数据集下载及相关问题
随机推荐
About me
[shutter] dart data type (dynamic data type)
class和getClass()的区别
CEPH principle
Nexus简介及小白使用IDEA打包上传到Nexus3私服详细教程
牛客JS2 文件扩展名
Listing of chaozhuo Aviation Technology Co., Ltd.: raising 900million yuan, with a market value of more than 6billion yuan, becoming the first science and technology innovation board enterprise in Xia
Introduce the scrollintoview() method attribute in detail
Sword finger offer 25 Merge two sorted linked lists
Update iteration of cloud communication interface -- the official launch of subail API V4
酒仙网IPO被终止:曾拟募资10亿 红杉与东方富海是股东
Nexus Introduction and Xiaobai use idea Packaging and Upload to Nexus 3 private service detailed tutoriel
[fluent] dart data type map type (create map set | initialize map set | traverse map set)
Alibaba Tianchi SQL learning notes - Day3
What is agile development process
Explanation of traceroute command
Meanings of SNAT, DNAT and masquerade in iptables
Si446 usage record (I): basic data acquisition
Chmod command principle and usage details [easy to understand]
13、Darknet YOLO3