mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-20 12:38:09 +08:00
APPS ExtraAttr UPDATE
APPS ExtraAttr UPDATE
This commit is contained in:
@@ -4,6 +4,8 @@ package org.maxkey.web.apps.contorller;
|
||||
import org.apache.mybatis.jpa.persistence.JpaPageResults;
|
||||
import org.maxkey.constants.OPERATEMESSAGE;
|
||||
import org.maxkey.crypto.ReciprocalUtils;
|
||||
import org.maxkey.domain.ExtraAttr;
|
||||
import org.maxkey.domain.ExtraAttrs;
|
||||
import org.maxkey.domain.apps.Apps;
|
||||
import org.maxkey.web.WebContext;
|
||||
import org.maxkey.web.message.Message;
|
||||
@@ -68,6 +70,35 @@ public class ApplicationsController extends BaseAppContorller {
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = { "/forwardAppsExtendAttr/{id}" })
|
||||
public ModelAndView forwardExtendAttr(@PathVariable("id") String id) {
|
||||
ModelAndView modelAndView=new ModelAndView("apps/appsExtendAttr");
|
||||
modelAndView.addObject("model",appsService.get(id));
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = { "/updateExtendAttr" })
|
||||
public Message updateExtendAttr(@ModelAttribute("application") Apps application,@ModelAttribute("extraAttrs") ExtraAttr extraAttr) {
|
||||
if(extraAttr.getAttr()!=null){
|
||||
String []attributes=extraAttr.getAttr().split(",");
|
||||
String []attributeType=extraAttr.getType().split(",");
|
||||
String []attributeValue=extraAttr.getValue().split(",");
|
||||
ExtraAttrs extraAttrs=new ExtraAttrs();
|
||||
for(int i=0;i<attributes.length;i++){
|
||||
extraAttrs.put(attributes[i],attributeType[i], attributeValue[i]);
|
||||
}
|
||||
application.setExtendAttr(extraAttrs.toJsonString());
|
||||
}
|
||||
|
||||
if (appsService.updateExtendAttr(application)) {
|
||||
return new Message(WebContext.getI18nValue(OPERATEMESSAGE.INSERT_SUCCESS),MessageType.success);
|
||||
|
||||
} else {
|
||||
return new Message(WebContext.getI18nValue(OPERATEMESSAGE.INSERT_ERROR),MessageType.error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* query
|
||||
* @param application
|
||||
|
||||
@@ -9,7 +9,6 @@ import org.maxkey.constants.PROTOCOLS;
|
||||
import org.maxkey.crypto.ReciprocalUtils;
|
||||
import org.maxkey.crypto.password.PasswordReciprocal;
|
||||
import org.maxkey.dao.service.AppsService;
|
||||
import org.maxkey.domain.ExtraAttrs;
|
||||
import org.maxkey.domain.apps.Apps;
|
||||
import org.maxkey.util.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
@@ -49,12 +48,7 @@ public class BaseAppContorller {
|
||||
* string field encoding
|
||||
*/
|
||||
encoding(application);
|
||||
|
||||
/*
|
||||
* convertExtendAttr
|
||||
*
|
||||
*/
|
||||
convertExtendAttr(application);
|
||||
|
||||
/*
|
||||
* upload iconFile MultipartFile to icon Bytes
|
||||
*/
|
||||
@@ -113,17 +107,4 @@ public class BaseAppContorller {
|
||||
application.setSecret(decodeSecret);
|
||||
}
|
||||
}
|
||||
|
||||
protected void convertExtendAttr(Apps application) {
|
||||
if(application.getAttribute()!=null){
|
||||
String []attributes=application.getAttribute().split(",");
|
||||
String []attributeValue=application.getAttributeValue().split(",");
|
||||
ExtraAttrs extraAttrs=new ExtraAttrs();
|
||||
for(int i=0;i<attributes.length;i++){
|
||||
extraAttrs.put(attributes[i], attributeValue[i]);
|
||||
}
|
||||
application.setExtendAttr(extraAttrs.toJsonString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user