@FunctionalInterface
This commit is contained in:
@@ -8,6 +8,7 @@ package com.jeesite.common.callback;
|
|||||||
* 方法回调接口
|
* 方法回调接口
|
||||||
* @author ThinkGem
|
* @author ThinkGem
|
||||||
*/
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
public interface MethodCallback {
|
public interface MethodCallback {
|
||||||
|
|
||||||
Object execute(Object... params);
|
Object execute(Object... params);
|
||||||
|
|||||||
@@ -409,22 +409,19 @@ public class ListUtils extends org.apache.commons.collections.ListUtils {
|
|||||||
final String[] ss = orderBy.trim().split(" ");
|
final String[] ss = orderBy.trim().split(" ");
|
||||||
if (ss != null){
|
if (ss != null){
|
||||||
final String t = ss.length==2 ? ss[1] : "asc";
|
final String t = ss.length==2 ? ss[1] : "asc";
|
||||||
Collections.sort(list, new Comparator<T>() {
|
Collections.sort(list, (o1, o2) -> {
|
||||||
@Override
|
String s1, s2;
|
||||||
public int compare(T o1, T o2) {
|
if (o1 instanceof Map){
|
||||||
String s1 = StringUtils.EMPTY, s2 = StringUtils.EMPTY;
|
s1 = ObjectUtils.toString(((Map)o1).get(ss[0]));
|
||||||
if (o1 instanceof Map){
|
s2 = ObjectUtils.toString(((Map)o2).get(ss[0]));
|
||||||
s1 = ObjectUtils.toString(((Map)o1).get(ss[0]));
|
}else{
|
||||||
s2 = ObjectUtils.toString(((Map)o2).get(ss[0]));
|
s1 = ObjectUtils.toString(ReflectUtils.invokeGetter(o1, ss[0]));
|
||||||
}else{
|
s2 = ObjectUtils.toString(ReflectUtils.invokeGetter(o2, ss[0]));
|
||||||
s1 = ObjectUtils.toString(ReflectUtils.invokeGetter(o1, ss[0]));
|
}
|
||||||
s2 = ObjectUtils.toString(ReflectUtils.invokeGetter(o2, ss[0]));
|
if ("asc".equalsIgnoreCase(t)){
|
||||||
}
|
return s1.compareTo(s2);
|
||||||
if ("asc".equalsIgnoreCase(t)){
|
}else{
|
||||||
return s1.compareTo(s2);
|
return s2.compareTo(s1);
|
||||||
}else{
|
|
||||||
return s2.compareTo(s1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.jeesite.modules.cms.db;
|
package com.jeesite.modules.cms.db;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import com.jeesite.common.callback.MethodCallback;
|
|
||||||
import com.jeesite.common.config.Global;
|
import com.jeesite.common.config.Global;
|
||||||
import com.jeesite.common.tests.BaseInitDataTests;
|
import com.jeesite.common.tests.BaseInitDataTests;
|
||||||
import com.jeesite.modules.cms.dao.ArticleDao;
|
import com.jeesite.modules.cms.dao.ArticleDao;
|
||||||
@@ -20,6 +15,9 @@ import com.jeesite.modules.cms.entity.Site;
|
|||||||
import com.jeesite.modules.cms.service.CategoryService;
|
import com.jeesite.modules.cms.service.CategoryService;
|
||||||
import com.jeesite.modules.cms.service.SiteService;
|
import com.jeesite.modules.cms.service.SiteService;
|
||||||
import com.jeesite.modules.gen.utils.GenUtils;
|
import com.jeesite.modules.gen.utils.GenUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化CMS表及数据
|
* 初始化CMS表及数据
|
||||||
@@ -51,72 +49,60 @@ public class InitCmsData extends BaseInitDataTests {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SiteService siteService;
|
private SiteService siteService;
|
||||||
public void initSite() throws Exception{
|
public void initSite() throws Exception{
|
||||||
initExcelData(Site.class, new MethodCallback() {
|
initExcelData(Site.class, params -> {
|
||||||
@Override
|
String action = (String)params[0];
|
||||||
public Object execute(Object... params) {
|
if("save".equals(action)){
|
||||||
String action = (String)params[0];
|
Site entity = (Site)params[1];
|
||||||
if("save".equals(action)){
|
entity.setIsNewRecord(true);
|
||||||
Site entity = (Site)params[1];
|
siteService.save(entity);
|
||||||
entity.setIsNewRecord(true);
|
|
||||||
siteService.save(entity);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CategoryService categoryService;
|
private CategoryService categoryService;
|
||||||
public void initCategory() throws Exception{
|
public void initCategory() throws Exception{
|
||||||
initExcelData(Category.class, new MethodCallback() {
|
initExcelData(Category.class, params -> {
|
||||||
@Override
|
String action = (String)params[0];
|
||||||
public Object execute(Object... params) {
|
if("save".equals(action)){
|
||||||
String action = (String)params[0];
|
Category entity = (Category)params[1];
|
||||||
if("save".equals(action)){
|
entity.setIsNewRecord(true);
|
||||||
Category entity = (Category)params[1];
|
categoryService.save(entity);
|
||||||
entity.setIsNewRecord(true);
|
|
||||||
categoryService.save(entity);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ArticleDao articleDao;
|
private ArticleDao articleDao;
|
||||||
public void initArticle() throws Exception{
|
public void initArticle() throws Exception{
|
||||||
initExcelData(Article.class, new MethodCallback() {
|
initExcelData(Article.class, params -> {
|
||||||
@Override
|
String action = (String)params[0];
|
||||||
public Object execute(Object... params) {
|
if("save".equals(action)){
|
||||||
String action = (String)params[0];
|
Article entity = (Article)params[1];
|
||||||
if("save".equals(action)){
|
entity.setIsNewRecord(true);
|
||||||
Article entity = (Article)params[1];
|
articleDao.insert(entity);
|
||||||
entity.setIsNewRecord(true);
|
|
||||||
articleDao.insert(entity);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ArticleDataDao articleDataDao;
|
private ArticleDataDao articleDataDao;
|
||||||
public void initArticleData() throws Exception{
|
public void initArticleData() throws Exception{
|
||||||
initExcelData(ArticleData.class, new MethodCallback() {
|
initExcelData(ArticleData.class, params -> {
|
||||||
@Override
|
String action = (String)params[0];
|
||||||
public Object execute(Object... params) {
|
if("save".equals(action)){
|
||||||
String action = (String)params[0];
|
ArticleData entity = (ArticleData)params[1];
|
||||||
if("save".equals(action)){
|
entity.setIsNewRecord(true);
|
||||||
ArticleData entity = (ArticleData)params[1];
|
articleDataDao.insert(entity);
|
||||||
entity.setIsNewRecord(true);
|
|
||||||
articleDataDao.insert(entity);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.jeesite.modules.sys.db;
|
package com.jeesite.modules.sys.db;
|
||||||
|
|
||||||
import org.quartz.CronTrigger;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import com.jeesite.common.callback.MethodCallback;
|
|
||||||
import com.jeesite.common.config.Global;
|
import com.jeesite.common.config.Global;
|
||||||
import com.jeesite.common.idgen.IdGen;
|
import com.jeesite.common.idgen.IdGen;
|
||||||
import com.jeesite.common.tests.BaseInitDataTests;
|
import com.jeesite.common.tests.BaseInitDataTests;
|
||||||
@@ -19,30 +13,12 @@ import com.jeesite.modules.job.entity.JobEntity;
|
|||||||
import com.jeesite.modules.msg.task.impl.MsgLocalMergePushTask;
|
import com.jeesite.modules.msg.task.impl.MsgLocalMergePushTask;
|
||||||
import com.jeesite.modules.msg.task.impl.MsgLocalPushTask;
|
import com.jeesite.modules.msg.task.impl.MsgLocalPushTask;
|
||||||
import com.jeesite.modules.sys.dao.RoleMenuDao;
|
import com.jeesite.modules.sys.dao.RoleMenuDao;
|
||||||
import com.jeesite.modules.sys.entity.Area;
|
import com.jeesite.modules.sys.entity.*;
|
||||||
import com.jeesite.modules.sys.entity.Company;
|
import com.jeesite.modules.sys.service.*;
|
||||||
import com.jeesite.modules.sys.entity.Config;
|
import org.quartz.CronTrigger;
|
||||||
import com.jeesite.modules.sys.entity.DictData;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import com.jeesite.modules.sys.entity.DictType;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import com.jeesite.modules.sys.entity.EmpUser;
|
import org.springframework.stereotype.Component;
|
||||||
import com.jeesite.modules.sys.entity.Menu;
|
|
||||||
import com.jeesite.modules.sys.entity.Module;
|
|
||||||
import com.jeesite.modules.sys.entity.Office;
|
|
||||||
import com.jeesite.modules.sys.entity.Post;
|
|
||||||
import com.jeesite.modules.sys.entity.Role;
|
|
||||||
import com.jeesite.modules.sys.entity.RoleMenu;
|
|
||||||
import com.jeesite.modules.sys.entity.User;
|
|
||||||
import com.jeesite.modules.sys.service.CompanyService;
|
|
||||||
import com.jeesite.modules.sys.service.ConfigService;
|
|
||||||
import com.jeesite.modules.sys.service.DictDataService;
|
|
||||||
import com.jeesite.modules.sys.service.DictTypeService;
|
|
||||||
import com.jeesite.modules.sys.service.EmpUserService;
|
|
||||||
import com.jeesite.modules.sys.service.MenuService;
|
|
||||||
import com.jeesite.modules.sys.service.ModuleService;
|
|
||||||
import com.jeesite.modules.sys.service.OfficeService;
|
|
||||||
import com.jeesite.modules.sys.service.PostService;
|
|
||||||
import com.jeesite.modules.sys.service.RoleService;
|
|
||||||
import com.jeesite.modules.sys.service.UserService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化核心表数据
|
* 初始化核心表数据
|
||||||
@@ -112,19 +88,16 @@ public class InitCoreData extends BaseInitDataTests {
|
|||||||
*/
|
*/
|
||||||
public void initConfig() throws Exception{
|
public void initConfig() throws Exception{
|
||||||
// clearTable(Config.class);
|
// clearTable(Config.class);
|
||||||
initExcelData(Config.class, new MethodCallback() {
|
initExcelData(Config.class, params -> {
|
||||||
@Override
|
String action = (String)params[0];
|
||||||
public Object execute(Object... params) {
|
if("save".equals(action)){
|
||||||
String action = (String)params[0];
|
Config entity = (Config)params[1];
|
||||||
if("save".equals(action)){
|
entity.setId(IdGen.nextId());
|
||||||
Config entity = (Config)params[1];
|
entity.setIsNewRecord(true);
|
||||||
entity.setId(IdGen.nextId());
|
configService.save(entity);
|
||||||
entity.setIsNewRecord(true);
|
|
||||||
configService.save(entity);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,18 +108,15 @@ public class InitCoreData extends BaseInitDataTests {
|
|||||||
*/
|
*/
|
||||||
public void initModule() throws Exception{
|
public void initModule() throws Exception{
|
||||||
// clearTable(Module.class);
|
// clearTable(Module.class);
|
||||||
initExcelData(Module.class, new MethodCallback() {
|
initExcelData(Module.class, params -> {
|
||||||
@Override
|
String action = (String)params[0];
|
||||||
public Object execute(Object... params) {
|
if("save".equals(action)){
|
||||||
String action = (String)params[0];
|
Module entity = (Module)params[1];
|
||||||
if("save".equals(action)){
|
entity.setIsNewRecord(true);
|
||||||
Module entity = (Module)params[1];
|
moduleService.save(entity);
|
||||||
entity.setIsNewRecord(true);
|
|
||||||
moduleService.save(entity);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,34 +129,28 @@ public class InitCoreData extends BaseInitDataTests {
|
|||||||
*/
|
*/
|
||||||
public void initDict() throws Exception{
|
public void initDict() throws Exception{
|
||||||
// clearTable(DictType.class);
|
// clearTable(DictType.class);
|
||||||
initExcelData(DictType.class, new MethodCallback() {
|
initExcelData(DictType.class, params -> {
|
||||||
@Override
|
String action = (String)params[0];
|
||||||
public Object execute(Object... params) {
|
if("save".equals(action)){
|
||||||
String action = (String)params[0];
|
DictType entity = (DictType)params[1];
|
||||||
if("save".equals(action)){
|
entity.setId(IdGen.nextId());
|
||||||
DictType entity = (DictType)params[1];
|
entity.setIsNewRecord(true);
|
||||||
entity.setId(IdGen.nextId());
|
dictTypeService.save(entity);
|
||||||
entity.setIsNewRecord(true);
|
|
||||||
dictTypeService.save(entity);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
// clearTable(DictData.class);
|
// clearTable(DictData.class);
|
||||||
initExcelData(DictData.class, new MethodCallback() {
|
initExcelData(DictData.class, params -> {
|
||||||
@Override
|
String action = (String)params[0];
|
||||||
public Object execute(Object... params) {
|
if("save".equals(action)){
|
||||||
String action = (String)params[0];
|
DictData entity = (DictData)params[1];
|
||||||
if("save".equals(action)){
|
entity.setIsNewRecord(true);
|
||||||
DictData entity = (DictData)params[1];
|
dictDataService.save(entity);
|
||||||
entity.setIsNewRecord(true);
|
|
||||||
dictDataService.save(entity);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,18 +163,15 @@ public class InitCoreData extends BaseInitDataTests {
|
|||||||
// clearTable(Role.class);
|
// clearTable(Role.class);
|
||||||
// clearTable(RoleMenu.class);
|
// clearTable(RoleMenu.class);
|
||||||
// clearTable(RoleDataScope.class);
|
// clearTable(RoleDataScope.class);
|
||||||
initExcelData(Role.class, new MethodCallback() {
|
initExcelData(Role.class, params -> {
|
||||||
@Override
|
String action = (String)params[0];
|
||||||
public Object execute(Object... params) {
|
if("save".equals(action)){
|
||||||
String action = (String)params[0];
|
Role entity = (Role)params[1];
|
||||||
if("save".equals(action)){
|
entity.setIsNewRecord(true);
|
||||||
Role entity = (Role)params[1];
|
roleService.save(entity);
|
||||||
entity.setIsNewRecord(true);
|
|
||||||
roleService.save(entity);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,22 +185,19 @@ public class InitCoreData extends BaseInitDataTests {
|
|||||||
public void initMenu() throws Exception{
|
public void initMenu() throws Exception{
|
||||||
// clearTable(Menu.class);
|
// clearTable(Menu.class);
|
||||||
// clearTable(RoleMenu.class);
|
// clearTable(RoleMenu.class);
|
||||||
initExcelData(Menu.class, new MethodCallback() {
|
initExcelData(Menu.class, params -> {
|
||||||
@Override
|
String action = (String)params[0];
|
||||||
public Object execute(Object... params) {
|
if("save".equals(action)){
|
||||||
String action = (String)params[0];
|
Menu entity = (Menu)params[1];
|
||||||
if("save".equals(action)){
|
entity.setIsNewRecord(true);
|
||||||
Menu entity = (Menu)params[1];
|
menuService.save(entity);
|
||||||
entity.setIsNewRecord(true);
|
RoleMenu rm = new RoleMenu();
|
||||||
menuService.save(entity);
|
rm.setMenuCode(entity.getMenuCode());
|
||||||
RoleMenu rm = new RoleMenu();
|
rm.setRoleCode(Role.CORP_ADMIN_ROLE_CODE);
|
||||||
rm.setMenuCode(entity.getMenuCode());
|
roleMenuDao.insert(rm);
|
||||||
rm.setRoleCode(Role.CORP_ADMIN_ROLE_CODE);
|
|
||||||
roleMenuDao.insert(rm);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,18 +210,15 @@ public class InitCoreData extends BaseInitDataTests {
|
|||||||
// clearTable(User.class);
|
// clearTable(User.class);
|
||||||
// clearTable(UserRole.class);
|
// clearTable(UserRole.class);
|
||||||
// clearTable(UserDataScope.class);
|
// clearTable(UserDataScope.class);
|
||||||
initExcelData(User.class, new MethodCallback() {
|
initExcelData(User.class, params -> {
|
||||||
@Override
|
String action = (String)params[0];
|
||||||
public Object execute(Object... params) {
|
if("save".equals(action)){
|
||||||
String action = (String)params[0];
|
User entity = (User)params[1];
|
||||||
if("save".equals(action)){
|
entity.setIsNewRecord(true);
|
||||||
User entity = (User)params[1];
|
userService.save(entity);
|
||||||
entity.setIsNewRecord(true);
|
|
||||||
userService.save(entity);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,18 +229,15 @@ public class InitCoreData extends BaseInitDataTests {
|
|||||||
*/
|
*/
|
||||||
public void initOffice() throws Exception{
|
public void initOffice() throws Exception{
|
||||||
// clearTable(Office.class);
|
// clearTable(Office.class);
|
||||||
initExcelData(Office.class, new MethodCallback() {
|
initExcelData(Office.class, params -> {
|
||||||
@Override
|
String action = (String)params[0];
|
||||||
public Object execute(Object... params) {
|
if("save".equals(action)){
|
||||||
String action = (String)params[0];
|
Office entity = (Office)params[1];
|
||||||
if("save".equals(action)){
|
entity.setIsNewRecord(true);
|
||||||
Office entity = (Office)params[1];
|
officeService.save(entity);
|
||||||
entity.setIsNewRecord(true);
|
|
||||||
officeService.save(entity);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,18 +249,15 @@ public class InitCoreData extends BaseInitDataTests {
|
|||||||
public void initCompany() throws Exception{
|
public void initCompany() throws Exception{
|
||||||
// clearTable(Company.class);
|
// clearTable(Company.class);
|
||||||
// clearTable(CompanyOffice.class);
|
// clearTable(CompanyOffice.class);
|
||||||
initExcelData(Company.class, new MethodCallback() {
|
initExcelData(Company.class, params -> {
|
||||||
@Override
|
String action = (String)params[0];
|
||||||
public Object execute(Object... params) {
|
if("save".equals(action)){
|
||||||
String action = (String)params[0];
|
Company entity = (Company)params[1];
|
||||||
if("save".equals(action)){
|
entity.setIsNewRecord(true);
|
||||||
Company entity = (Company)params[1];
|
companyService.save(entity);
|
||||||
entity.setIsNewRecord(true);
|
|
||||||
companyService.save(entity);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,18 +268,15 @@ public class InitCoreData extends BaseInitDataTests {
|
|||||||
*/
|
*/
|
||||||
public void initPost() throws Exception{
|
public void initPost() throws Exception{
|
||||||
// clearTable(Post.class);
|
// clearTable(Post.class);
|
||||||
initExcelData(Post.class, new MethodCallback() {
|
initExcelData(Post.class, params -> {
|
||||||
@Override
|
String action = (String)params[0];
|
||||||
public Object execute(Object... params) {
|
if("save".equals(action)){
|
||||||
String action = (String)params[0];
|
Post entity = (Post)params[1];
|
||||||
if("save".equals(action)){
|
entity.setIsNewRecord(true);
|
||||||
Post entity = (Post)params[1];
|
postService.save(entity);
|
||||||
entity.setIsNewRecord(true);
|
|
||||||
postService.save(entity);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,36 +288,33 @@ public class InitCoreData extends BaseInitDataTests {
|
|||||||
public void initEmpUser() throws Exception{
|
public void initEmpUser() throws Exception{
|
||||||
// clearTable(Employee.class);
|
// clearTable(Employee.class);
|
||||||
// clearTable(EmployeePost.class);
|
// clearTable(EmployeePost.class);
|
||||||
initExcelData(EmpUser.class, new MethodCallback() {
|
initExcelData(EmpUser.class, params -> {
|
||||||
@Override
|
String action = (String)params[0];
|
||||||
public Object execute(Object... params) {
|
if("check".equals(action)){
|
||||||
String action = (String)params[0];
|
User user = new User();
|
||||||
if("check".equals(action)){
|
user.setLoginCode("user1");
|
||||||
User user = new User();
|
return userService.getByLoginCode(user) == null;
|
||||||
user.setLoginCode("user1");
|
}else if("set".equals(action)){
|
||||||
return userService.getByLoginCode(user) == null;
|
EmpUser entity = (EmpUser)params[1];
|
||||||
}else if("set".equals(action)){
|
String header = (String)params[2];
|
||||||
EmpUser entity = (EmpUser)params[1];
|
String val = (String)params[3];
|
||||||
String header = (String)params[2];
|
if ("userRoleString".equals(header)){
|
||||||
String val = (String)params[3];
|
entity.setUserRoleString(val);
|
||||||
if ("userRoleString".equals(header)){
|
return true;
|
||||||
entity.setUserRoleString(val);
|
}else if ("employee.employeePosts".equals(header)){
|
||||||
return true;
|
entity.getEmployee().setEmployeePosts(val);
|
||||||
}else if ("employee.employeePosts".equals(header)){
|
return true;
|
||||||
entity.getEmployee().setEmployeePosts(val);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}else if("save".equals(action)){
|
|
||||||
EmpUser entity = (EmpUser)params[1];
|
|
||||||
entity.setIsNewRecord(true);
|
|
||||||
empUserService.save(entity);
|
|
||||||
// 设置当前为管理员,否则无法保存用户角色关系
|
|
||||||
entity.setCurrentUser(new User(User.SUPER_ADMIN_CODE));
|
|
||||||
userService.saveAuth(entity);
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
}else if("save".equals(action)){
|
||||||
|
EmpUser entity = (EmpUser)params[1];
|
||||||
|
entity.setIsNewRecord(true);
|
||||||
|
empUserService.save(entity);
|
||||||
|
// 设置当前为管理员,否则无法保存用户角色关系
|
||||||
|
entity.setCurrentUser(new User(User.SUPER_ADMIN_CODE));
|
||||||
|
userService.saveAuth(entity);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user