当前位置:网站首页>Platform management background and merchant menu resource management: merchant role management design
Platform management background and merchant menu resource management: merchant role management design
2022-07-02 17:32:00 【Jue seconds of writing code】
Business role management design
The authority management of merchants is realized through role management , The role and resource energy table establish a general alliance. The general assembly, the general assembly, the general assembly, the general assembly, the general assembly, the general assembly, the general assembly, the general assembly, the general assembly, the general assembly, the general assembly, the general assembly, the general assembly, the general assembly, the general assembly, the general assembly . What roles does a user have , It means that this user has
Have access to .
Role management is mainly through RoleRestService And other components access the interface provided by the merchant service , So as to manage the data configuration of roles . Role management includes the addition, deletion, modification and query of roles , The following takes the design of role modification as an example .
Managing controllers in roles MerchantRoleController in , The design of the role modification part is as follows :
@Controller
@RequestMapping("/merchantrole")
public class MerchantRoleController {
private static Logger logger =LoggerFactory.getLogger(MerchantRoleController.class);
@Autowired
private ResourceRestService resourceRestService;
@Autowired
private RoleRestService roleRestService;
@RequestMapping ("/edit/{id} ")
public String edit (CPathvariable Long id, ModelMap model,HttpServletRequestrequest) {
String json = roleRestService. findById(id);
RoleQo roleQo = new Gson() .fromJson(json,RoleQo.class);
String resources = resourceRestService.findList()
List<ResourceQo> resourceVoList = new Gson().fromJson(resources, new
TypeToken<List<ResourceQ0>>(){(}.getType());
// Cache resource list
request.getSession().setAttribute("resources", resourceVoList);
List<Long> rids = new ArrayList<>();
for(ResourceQo resource : roleQo.getResources()){
rids.add(resource.getId());
}
model.addAttribute("resources", resourceVoList);model.addAttribute( "role", roleQo);
mode1.addAttribute("rids", rids);
return""merchantrole/edit";
}
@RequestMapping (method = RequestMethod.POST, value="/update")@ResponseBody
public String update (RoleQ0 roleQ0, HttpServletRequest request)
throws
Exception {
// Through resources ID Specify the associated object
String[] rids = request. getParameterValues ("rids");// Get a list of resources
List<ResourceQo>resourceQoList = (List<ResourceQ0>)
request.getSession() .getAttribute ("resources");
List<ResourceQ0> resourceQos = new ArrayList<ResourceQo>();for (String rid :rids) {
for (ResourceQo resourceVo :resourceQoList) {
if (resourceVo.getId().compareTo(new Long(rid)) == 0)
resourceQos .add(resourceVo);
}
}
}
roleQo.setResources (resourceQ0s);
String ret =roleRestService.update (roleQo);logger.info(" modify =" +ret);
return ret;
}
}
among , For resources that have been associated with roles , You can use a resource ID The list of components rids Judge the selected resources in the multi-choice drop-down list box on the page . If it is an associated role , Set it to the selected style .
Corresponding page view edit.html The implementation code is as follows :
<html xmlns:th="http://www.thymeleaf.org">
<script th:src="@(/scripts/merchantrole/edit.js}"></script><form id="saveForm" method="post">
<input type="hidden" name="id" id="id"th:value="${role.id}"/><div class="addInfBtn">
<h3 class="itemTit"><span> The role of 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="${role.name}" id="name" name="name" maxlength="32"/>
<span class="tipstar f-left">*</span>
</td>
<th> resources </th>
<td width="240">
<div >
<select name="rids" id="rids" multiple="multiple">
<option th:each= " resource:${resources}"
th:value="S{resource.id] "
th:text="${#strings.length (resource.name) >20?#strings.substring (resource.name,0,20)+'...':resource.name} "
th: selected="${#lists.contains (rids,
resource.id)}”
></option>
</select>
</div>
</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="$ {role.created} ? $ {#dates.format (role.created, 'yyyy-MM-HH: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
</a>
</div></ div>
</form>
Use lists Function to determine whether the resource in the drop-down list box has been associated with a role , If it is , Set the selected style to true.
After finishing the design , The display effect is shown in the figure 11-6 Shown .
The data of business information and menu resource management function can be found in the project of this chapter merchant-microservice In order to get , This will make it easier for readers to test .
Summary
This paper mainly realizes the design of access control in the background of platform management 、 Business registration and its authority , And the functions of menu configuration and management . among , Business registration and its authority 、 Menu configuration and management , All through calling the business service REST API The implementation of microservices .
actually , In our microservice architecture design ,Web UI Microservices are developed by calling Rest API The implementation of microservices , When it is necessary to manage various service functions of the e-commerce platform in the platform management background , Can be achieved by calling various micro service interfaces .
The development of microservices has come to an end , Start with the next one , We will discuss the deployment of micro services and the construction of micro service operation environment from the perspective of operation and maintenance .
The content of this article is platform management background and business menu resource management : Business role management design
- The next article is about cloud service environment and Docker Deployment tools ;
- Friends who think the article is good can forward this article and pay attention to Xiaobian ;
- Thank you for your support !
边栏推荐
- IDEA2021.1 安装教程
- After meeting a full stack developer from Tencent, I saw what it means to be proficient in MySQL tuning
- executescalar mysql_ ExecuteScalar()
- From collection to output: inventory those powerful knowledge management tools - inventory of excellent note taking software (4)
- visibilitychange – 指定标签页可见时,刷新页面数据
- Fuyuan medicine is listed on the Shanghai Stock Exchange: the market value is 10.5 billion, and Hu Baifan is worth more than 4billion
- executescalar mysql_ExecuteScalar()
- 例题 非线性整数规划
- Income and risk of linear programming example investment
- SAP commerce cloud storefront framework selection: accelerator or Spartacus?
猜你喜欢
Soul, a social meta universe platform, rushed to Hong Kong stocks: Tencent is a shareholder with an annual revenue of 1.28 billion
Sword finger offer 25 Merge two sorted linked lists
Eye of depth (II) -- matrix and its basic operations
剑指 Offer 24. 反转链表
深度之眼(二)——矩阵及其基本运算
体验居家办公完成项目有感 | 社区征文
[fluent] dart data type map type (create map set | initialize map set | traverse map set)
The difference of message mechanism between MFC and QT
Green bamboo biological sprint Hong Kong stocks: loss of more than 500million during the year, tiger medicine and Beijing Yizhuang are shareholders
The construction of scalable distributed database cluster and the partition design of oneproxy sub database
随机推荐
Changwan group rushed to Hong Kong stocks: the annual revenue was 289million, and Liu Hui had 53.46% voting rights
Briefly introduce the use of base64encoder
Migrate your accelerator based SAP commerce cloud storefront to Spartacus
牛客JS2 文件扩展名
The beginning of life
ssb门限_SSB调制「建议收藏」
Sword finger offer 26 Substructure of tree
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
Green bamboo biological sprint Hong Kong stocks: loss of more than 500million during the year, tiger medicine and Beijing Yizhuang are shareholders
ROS knowledge point - message_filters
剑指 Offer 22. 链表中倒数第k个节点
Eye of depth (III) -- determinant of matrix
什么是软件开发中的 green field 和 brown field 模式 - 绿地开发和棕地开发
如何给 SAP Spartacus Storefront 创建新的页面
traceroute命令讲解
Helm kubernetes package management tool
选择 SAP Spartacus 作为 SAP Commerce Cloud Storefront 实现框架的五个理由
常用SQL语句(完整范例)
将您的基于 Accelerator 的 SAP Commerce Cloud Storefront 迁移到 Spartacus