mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-21 05:18:10 +08:00
Accounts Strategy
This commit is contained in:
@@ -40,7 +40,7 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value={"/app/accounts"})
|
||||
@RequestMapping(value={"/accounts"})
|
||||
public class AccountsController {
|
||||
final static Logger _logger = LoggerFactory.getLogger(AccountsController.class);
|
||||
|
||||
@@ -58,7 +58,7 @@ public class AccountsController {
|
||||
|
||||
@RequestMapping(value={"/list"})
|
||||
public ModelAndView appAccountsList(){
|
||||
ModelAndView modelAndView=new ModelAndView("/accounts/appAccountsList");
|
||||
ModelAndView modelAndView=new ModelAndView("/accounts/accountsList");
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@@ -71,14 +71,14 @@ public class AccountsController {
|
||||
|
||||
@RequestMapping(value = { "/forwardSelect/{appId}" })
|
||||
public ModelAndView forwardSelect(@PathVariable("appId") String appId) {
|
||||
ModelAndView modelAndView=new ModelAndView("/accounts/appAccountsAddSelect");
|
||||
ModelAndView modelAndView=new ModelAndView("/accounts/accountsAddSelect");
|
||||
modelAndView.addObject("appId",appId);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value = { "/forwardAdd" })
|
||||
public ModelAndView forwardAdd(@ModelAttribute("appAccounts") Accounts appAccounts) {
|
||||
ModelAndView modelAndView=new ModelAndView("/accounts/appAccountsAdd");
|
||||
ModelAndView modelAndView=new ModelAndView("/accounts/accountsAdd");
|
||||
//Applications app= appsService.get(appAccounts.getAppId());
|
||||
//appAccounts.setAppName(app.getName());
|
||||
modelAndView.addObject("model",appAccounts);
|
||||
@@ -103,7 +103,7 @@ public class AccountsController {
|
||||
|
||||
@RequestMapping(value = { "/forwardUpdate/{id}" })
|
||||
public ModelAndView forwardUpdate(@PathVariable("id") String id) {
|
||||
ModelAndView modelAndView=new ModelAndView("/accounts/appAccountsUpdate");
|
||||
ModelAndView modelAndView=new ModelAndView("/accounts/accountsUpdate");
|
||||
Accounts appAccounts =accountsService.get(id);
|
||||
|
||||
appAccounts.setRelatedPassword(ReciprocalUtils.decoder(appAccounts.getRelatedPassword()));
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.maxkey.web.contorller;
|
||||
|
||||
import org.apache.mybatis.jpa.persistence.JpaPageResults;
|
||||
import org.maxkey.constants.ConstantsOperateMessage;
|
||||
import org.maxkey.entity.AccountsStrategy;
|
||||
import org.maxkey.entity.Roles;
|
||||
import org.maxkey.persistence.service.AccountsStrategyService;
|
||||
import org.maxkey.persistence.service.RolesService;
|
||||
import org.maxkey.web.WebContext;
|
||||
import org.maxkey.web.message.Message;
|
||||
import org.maxkey.web.message.MessageType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value={"/accountsstrategy"})
|
||||
public class AccountsStrategyController {
|
||||
final static Logger _logger = LoggerFactory.getLogger(AccountsStrategyController.class);
|
||||
|
||||
@Autowired
|
||||
@Qualifier("accountsStrategyService")
|
||||
AccountsStrategyService accountsStrategyService;
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value={"/list"})
|
||||
public ModelAndView rolesList(){
|
||||
return new ModelAndView("accountsstrategy/accountsstrategyList");
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = { "/grid" })
|
||||
@ResponseBody
|
||||
public JpaPageResults<AccountsStrategy> queryDataGrid(@ModelAttribute("accountsStrategy") AccountsStrategy accountsStrategy) {
|
||||
_logger.debug(""+accountsStrategy);
|
||||
return accountsStrategyService.queryPageResults(accountsStrategy);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = { "/forwardAdd" })
|
||||
public ModelAndView forwardAdd() {
|
||||
return new ModelAndView("accountsstrategy/accountsstrategyAdd");
|
||||
}
|
||||
|
||||
@RequestMapping(value = { "/forwardUpdate/{id}" })
|
||||
public ModelAndView forwardUpdate(@PathVariable("id") String id) {
|
||||
ModelAndView modelAndView=new ModelAndView("accountsstrategy/accountsstrategyUpdate");
|
||||
AccountsStrategy accountsStrategy=accountsStrategyService.get(id);
|
||||
modelAndView.addObject("model",accountsStrategy);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value={"/add"})
|
||||
public Message insert(@ModelAttribute("accountsStrategy") AccountsStrategy accountsStrategy) {
|
||||
_logger.debug("-Add :" + accountsStrategy);
|
||||
|
||||
if (accountsStrategyService.insert(accountsStrategy)) {
|
||||
//rolesService.refreshDynamicRoles(role);
|
||||
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_SUCCESS),MessageType.error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
* @param role
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value={"/query"})
|
||||
public Message query(@ModelAttribute("accountsStrategy") AccountsStrategy accountsStrategy) {
|
||||
_logger.debug("-query :" + accountsStrategy);
|
||||
if (accountsStrategyService.load(accountsStrategy)!=null) {
|
||||
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.INSERT_ERROR),MessageType.error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param role
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value={"/update"})
|
||||
public Message update(@ModelAttribute("accountsStrategy") AccountsStrategy accountsStrategy) {
|
||||
_logger.debug("-update AccountsStrategy :" + accountsStrategy);
|
||||
|
||||
if (accountsStrategyService.update(accountsStrategy)) {
|
||||
// rolesService.refreshDynamicRoles(role);
|
||||
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.UPDATE_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.UPDATE_ERROR),MessageType.error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value={"/delete"})
|
||||
public Message delete(@ModelAttribute("role") Roles role) {
|
||||
_logger.debug("-delete role :" + role);
|
||||
|
||||
if (accountsStrategyService.deleteById(role.getId())) {
|
||||
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.DELETE_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
return new Message(WebContext.getI18nValue(ConstantsOperateMessage.DELETE_SUCCESS),MessageType.error);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user