From abbebc370f82fc0f9beddc68cc606e3b0e469164 Mon Sep 17 00:00:00 2001 From: zhenghuang <236220500@qq.com> Date: Sun, 28 Nov 2021 21:57:09 +0800 Subject: [PATCH] merge --- .../xpack/impl/AuthXpackDefaultService.java | 140 +++++++ .../xpack/impl/DeptXpackDefaultService.java | 359 ++++++++++++++++++ .../xpack/impl/RoleXpackDefaultService.java | 169 +++++++++ .../auth/XpackExtSysAuthDetailMapper.java | 13 + .../auth/XpackExtSysAuthDetailMapper.xml | 54 +++ .../mapper/auth/XpackExtSysAuthMapper.java | 14 + .../mapper/auth/XpackExtSysAuthMapper.xml | 81 ++++ .../mapper/auth/XpackExtVAuthModelMapper.java | 9 + .../mapper/auth/XpackExtVAuthModelMapper.xml | 95 +++++ .../mapper/auth/XpackSysAuthDetailMapper.java | 31 ++ .../mapper/auth/XpackSysAuthDetailMapper.xml | 291 ++++++++++++++ .../xpack/mapper/auth/XpackSysAuthMapper.java | 30 ++ .../xpack/mapper/auth/XpackSysAuthMapper.xml | 276 ++++++++++++++ .../mapper/auth/XpackVAuthModelMapper.java | 23 ++ .../mapper/auth/XpackVAuthModelMapper.xml | 223 +++++++++++ .../xpack/mapper/dept/XpackExtDeptMapper.java | 29 ++ .../xpack/mapper/dept/XpackExtDeptMapper.xml | 48 +++ .../xpack/mapper/dept/XpackSysDeptMapper.java | 31 ++ .../xpack/mapper/dept/XpackSysDeptMapper.xml | 275 ++++++++++++++ .../xpack/mapper/role/XpackExtRoleMapper.java | 15 + .../xpack/mapper/role/XpackExtRoleMapper.xml | 73 ++++ .../xpack/mapper/role/XpackSysRoleMapper.java | 30 ++ .../xpack/mapper/role/XpackSysRoleMapper.xml | 243 ++++++++++++ 23 files changed, 2552 insertions(+) create mode 100644 backend/src/main/java/com/ipsos/plugins/xpack/impl/AuthXpackDefaultService.java create mode 100644 backend/src/main/java/com/ipsos/plugins/xpack/impl/DeptXpackDefaultService.java create mode 100644 backend/src/main/java/com/ipsos/plugins/xpack/impl/RoleXpackDefaultService.java create mode 100644 backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackExtSysAuthDetailMapper.java create mode 100644 backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackExtSysAuthDetailMapper.xml create mode 100644 backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackExtSysAuthMapper.java create mode 100644 backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackExtSysAuthMapper.xml create mode 100644 backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackExtVAuthModelMapper.java create mode 100644 backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackExtVAuthModelMapper.xml create mode 100644 backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackSysAuthDetailMapper.java create mode 100644 backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackSysAuthDetailMapper.xml create mode 100644 backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackSysAuthMapper.java create mode 100644 backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackSysAuthMapper.xml create mode 100644 backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackVAuthModelMapper.java create mode 100644 backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackVAuthModelMapper.xml create mode 100644 backend/src/main/java/com/ipsos/plugins/xpack/mapper/dept/XpackExtDeptMapper.java create mode 100644 backend/src/main/java/com/ipsos/plugins/xpack/mapper/dept/XpackExtDeptMapper.xml create mode 100644 backend/src/main/java/com/ipsos/plugins/xpack/mapper/dept/XpackSysDeptMapper.java create mode 100644 backend/src/main/java/com/ipsos/plugins/xpack/mapper/dept/XpackSysDeptMapper.xml create mode 100644 backend/src/main/java/com/ipsos/plugins/xpack/mapper/role/XpackExtRoleMapper.java create mode 100644 backend/src/main/java/com/ipsos/plugins/xpack/mapper/role/XpackExtRoleMapper.xml create mode 100644 backend/src/main/java/com/ipsos/plugins/xpack/mapper/role/XpackSysRoleMapper.java create mode 100644 backend/src/main/java/com/ipsos/plugins/xpack/mapper/role/XpackSysRoleMapper.xml diff --git a/backend/src/main/java/com/ipsos/plugins/xpack/impl/AuthXpackDefaultService.java b/backend/src/main/java/com/ipsos/plugins/xpack/impl/AuthXpackDefaultService.java new file mode 100644 index 0000000..f087b1f --- /dev/null +++ b/backend/src/main/java/com/ipsos/plugins/xpack/impl/AuthXpackDefaultService.java @@ -0,0 +1,140 @@ +package com.ipsos.plugins.xpack.impl; + +import com.ipsos.common.constants.PluginSystemConstants; +import com.ipsos.common.dto.PluginSysMenu; +import com.ipsos.plugins.xpack.auth.dto.request.XpackBaseTreeRequest; +import com.ipsos.plugins.xpack.auth.dto.request.XpackSysAuthRequest; +import com.ipsos.plugins.xpack.auth.dto.response.*; +import com.ipsos.plugins.xpack.auth.entity.XpackVAuthModelExample; +import com.ipsos.plugins.xpack.auth.service.AuthXpackService; +import com.ipsos.plugins.xpack.mapper.auth.*; +import org.apache.ibatis.annotations.Param; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; + +import java.io.InputStream; +import java.util.*; +import java.util.stream.Collectors; + +@Service +public class AuthXpackDefaultService extends AuthXpackService { + private static List MODEL_TYPES; + @Autowired + private XpackSysAuthMapper sysAuthMapper; + + @Autowired + private XpackSysAuthDetailMapper sysAuthDetailMapper; + + @Autowired + private XpackExtSysAuthDetailMapper extSysAuthDetailMapper; + + @Autowired + private XpackExtVAuthModelMapper extVAuthModelMapper; + + @Autowired + private XpackExtSysAuthMapper extSysAuthMapper; + + public Map> searchAuthDetails(XpackSysAuthRequest request) { + return (Map) ((List) Optional.ofNullable(extSysAuthMapper.search(request)).orElse(new ArrayList())).stream().collect(Collectors.groupingBy(XpackSysAuthDetailDTO::getAuthSource)); + } + + protected InputStream readContent(String name) { + return name.getClass().getClassLoader().getResourceAsStream((new StringBuilder()).insert(0, "static/").append(name).toString()); + } + + public List searchAuthModelTree(XpackBaseTreeRequest request, Long userId, Boolean isAdmin) { + request.setCreateBy(String.valueOf(userId)); + if (!MODEL_TYPES.contains(request.getModelType()) || userId != null && isAdmin) { + request.setWithAuth("0"); + } else { + request.setWithAuth("1"); + } + + return extVAuthModelMapper.searchTree(request); + } + + public void authChange(XpackSysAuthRequest request, Long userId, String userName, Boolean isAdmin) { + XpackSysAuthDetail sysAuthDetail = request.getAuthDetail(); + List authIds; + if (CollectionUtils.isEmpty(authIds = vAuthIds(request.getAuthSource(), request.getAuthSourceType(), userId, isAdmin))) { + throw new RuntimeException("i18n_auth_source_be_canceled"); + } else { + List var = vAuthIds(request.getAuthTarget(), request.getAuthTargetType(), userId, isAdmin); + if (!CollectionUtils.isEmpty(authIds) && !CollectionUtils.isEmpty(var)) { + List ids = new ArrayList(); + var.stream().forEach((ax) -> { + authIds.forEach((id) -> { + String authId = getAuthId(id, request.getAuthSourceType(), ax, request.getAuthTargetType(), userName); + ids.add(authId); + }); + }); + if (sysAuthDetail.getPrivilegeValue() == PluginSystemConstants.PRIVILEGE_VALUE.ON) { + extSysAuthDetailMapper.authDetailsChange(PluginSystemConstants.PRIVILEGE_VALUE.OFF, sysAuthDetail.getPrivilegeType(), ids); + return; + } + extSysAuthDetailMapper.authDetailsChange(PluginSystemConstants.PRIVILEGE_VALUE.ON, sysAuthDetail.getPrivilegeType(), ids); + } + } + } + + public List searchAuthDetailsModel(String authType) { + return extSysAuthDetailMapper.searchAuthTypeModel(authType); + } + + public List menus() { + final PluginSysMenu pluginSysMenu = new PluginSysMenu(); + pluginSysMenu.setMenuId(41L); + pluginSysMenu.setPid(1L); + pluginSysMenu.setHidden(false); + pluginSysMenu.setComponent("SystemAuth"); + pluginSysMenu.setIcon("password"); + pluginSysMenu.setTitle("权限管理"); + pluginSysMenu.setName("system-auth"); + pluginSysMenu.setPath("system-auth"); + pluginSysMenu.setPermission("auth:read"); + pluginSysMenu.setNoLayout(true); + pluginSysMenu.setType(1); + pluginSysMenu.setMenuSort(4); + return new ArrayList() { + { + add(pluginSysMenu); + } + }; + } + + static { + String[] modelTypes = new String[5]; + boolean var10002 = true; + modelTypes[0] = "link"; + modelTypes[1] = "dataset"; + modelTypes[2] = "chart"; + modelTypes[3] = "panel"; + modelTypes[4] = "menu"; + MODEL_TYPES = Arrays.asList(modelTypes); + } + + // $FF: synthetic method + private List vAuthIds(String authSource, String authSourceType, Long userId, Boolean isAdmin) { + return (List) ((List) Optional.ofNullable(searchAuthModelTree(new XpackBaseTreeRequest(authSource, authSourceType, "children"), userId, isAdmin)).orElse(new ArrayList())).stream().map(XpackVAuthModel::getId).collect(Collectors.toList()); + } + + private String getAuthId(String authSource, String authSourceType, String authTarget, String authTargetType, String authUser) { + String authId; + if (StringUtils.isEmpty(authId = extSysAuthMapper.findAuthId(authSource, authSourceType, authTarget, authTargetType))) { + authId = UUID.randomUUID().toString(); + XpackSysAuth sysAuth = new XpackSysAuth(); + sysAuth.setId(authId); + sysAuth.setAuthSource(authSource); + sysAuth.setAuthSourceType(authSourceType); + sysAuth.setAuthTarget(authTarget); + sysAuth.setAuthTargetType(authTargetType); + sysAuth.setAuthTime(System.currentTimeMillis()); + sysAuth.setAuthUser(authUser); + sysAuthMapper.insertSelective(sysAuth); + extSysAuthDetailMapper.copyAuthModel(authSourceType, authId, authUser); + } + return authId; + } +} diff --git a/backend/src/main/java/com/ipsos/plugins/xpack/impl/DeptXpackDefaultService.java b/backend/src/main/java/com/ipsos/plugins/xpack/impl/DeptXpackDefaultService.java new file mode 100644 index 0000000..1665439 --- /dev/null +++ b/backend/src/main/java/com/ipsos/plugins/xpack/impl/DeptXpackDefaultService.java @@ -0,0 +1,359 @@ +package com.ipsos.plugins.xpack.impl; + +import com.ipsos.common.dto.PluginSimpleTreeNode; +import com.ipsos.common.dto.PluginSysMenu; +import com.ipsos.common.entity.XpackGridRequest; +import com.ipsos.common.util.PluginCommonUtil; +import com.ipsos.plugins.xpack.dept.dto.request.XpackCreateDept; +import com.ipsos.plugins.xpack.dept.dto.request.XpackDeleteDept; +import com.ipsos.plugins.xpack.dept.dto.request.XpackMoveDept; +import com.ipsos.plugins.xpack.dept.dto.response.XpackDeptTreeNode; +import com.ipsos.plugins.xpack.dept.dto.response.XpackSysDept; +import com.ipsos.plugins.xpack.dept.entity.XpackSysDeptExample; +import com.ipsos.plugins.xpack.dept.service.DeptXpackService; +import com.ipsos.plugins.xpack.mapper.dept.XpackExtDeptMapper; +import com.ipsos.plugins.xpack.mapper.dept.XpackSysDeptMapper; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import javax.annotation.Resource; + +import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.datasource.DataSourceTransactionManager; +import org.springframework.stereotype.Service; +import org.springframework.transaction.TransactionDefinition; +import org.springframework.transaction.TransactionStatus; +import org.springframework.util.CollectionUtils; + +@Service +public class DeptXpackDefaultService extends DeptXpackService { + public static final Long DEPT_ROOT_PID = 0L; + + @Autowired(required = false) + private XpackExtDeptMapper c; + + @Resource + TransactionDefinition transactionDefinition; + + private static final Integer e = 0; + @Resource + private DataSourceTransactionManager C; + + @Autowired(required = false) + private XpackSysDeptMapper m; + + public int batchDelete(List a) { + TransactionStatus transactionStatus = C.getTransaction(transactionDefinition); + try { + a = (List) a.stream().map((ax) -> { + Long var2; + if ((var2 = ax.getPid()) != DEPT_ROOT_PID) { + c.decreasingSubcount(var2); + } + return ax.getDeptId(); + }).collect(Collectors.toList()); + c.updateUserDeptId(a.stream().map(XpackDeleteDept::getDeptId).collect(Collectors.toList())); + int var5 = c.batchDelete(a.stream().map(XpackDeleteDept::getDeptId).collect(Collectors.toList())); + C.commit(transactionStatus); + return var5; + } catch (Exception var4) { + C.rollback(transactionStatus); + throw new RuntimeException(var4); + } + } + + public List nodesTreeByCondition(XpackGridRequest a) { + List allNodes = getAllNodes(); + List pluginSimpleTreeNodes; + if (CollectionUtils.isEmpty(pluginSimpleTreeNodes = getPluginSimpleTreeNode(a))) { + return new ArrayList(); + } else { + pluginSimpleTreeNodes = buildPluginSimpleTreeNodes(allNodes, pluginSimpleTreeNodes); + XpackSysDeptExample sysDeptExample = new XpackSysDeptExample(); + if (!CollectionUtils.isEmpty(pluginSimpleTreeNodes)) { + sysDeptExample.createCriteria().andDeptIdIn(pluginSimpleTreeNodes); + } + sysDeptExample.setOrderByClause("dept_sort"); + return m.selectByExample(sysDeptExample); + } + } + + public List menus() { + PluginSysMenu var1 = createDept(); + PluginSysMenu var2 = delDept(); + PluginSysMenu var3 = editDept(); + PluginSysMenu var4 = manageDept(); + PluginSysMenu var5 = deptForm(); + ArrayList var6; + (var6 = new ArrayList()).add(var1); + var6.add(var2); + var6.add(var3); + var6.add(var4); + var6.add(var5); + return var6; + } + + protected InputStream readContent(String name) { + return name.getClass().getClassLoader().getResourceAsStream((new StringBuilder()).insert(0, "static/").append(name).toString()); + } + + public List searchTree(Long a) { + List deptList = nodesByPid(0L); + if (a == DEPT_ROOT_PID) { + return (List) deptList.stream().map((dept) -> { + XpackDeptTreeNode deptTreeNode = new XpackDeptTreeNode(); + deptTreeNode.setId(dept.getDeptId()); + deptTreeNode.setLabel(dept.getName()); + deptTreeNode.setHasChildren(dept.getSubCount() > 0); + return deptTreeNode; + }).collect(Collectors.toList()); + } else { + XpackSysDept var3 = m.selectByPrimaryKey(a); + if (deptList.stream().anyMatch((ax) -> ax.getDeptId() == a)) { + return (List) deptList.stream().map((ax) -> { + XpackDeptTreeNode var2 = new XpackDeptTreeNode(); + var2.setId(ax.getDeptId()); + var2.setLabel(ax.getName()); + var2.setHasChildren(ax.getSubCount() > 0); + return var2; + }).collect(Collectors.toList()); + } else { +// XpackDeptTreeNode var7 = a.ALLATORIxDEMO(var3); +// +// XpackSysDept var4; +// for (XpackSysDept var10000 = a; var10000.getPid() != DEPT_ROOT_PID; var10000 = var4) { +// XpackDeptTreeNode var5 = a.ALLATORIxDEMO(var4 = a.m.selectByPrimaryKey(a.getPid())); +// var5.setChildren(var7.toList()); +// a = var4; +// var7 = var5; +// } +// +// return (List) var2.stream().map((ax) -> { +// return ax.getDeptId() == var7.getId() ? var7 : a.ALLATORIxDEMO(ax); +// }).collect(Collectors.toList()); + return new ArrayList<>(); + } + } + } + + public int update(XpackCreateDept a) { + TransactionStatus var2 = C.getTransaction(transactionDefinition); + XpackSysDept var3 = (XpackSysDept) PluginCommonUtil.copyBean(new XpackSysDept(), a); + if (a.isTop()) { + var3.setPid(DEPT_ROOT_PID); + } + + var3.setUpdateTime(System.currentTimeMillis()); + var3.setUpdateBy((String) null); + Long deptId = var3.getDeptId(); + XpackSysDept primaryKey = m.selectByPrimaryKey(deptId); + List var4 = nodesByPid(var3.getPid()); + try { + if (var3.getPid() != a.getPid()) { + Long var6 = a.getPid(); + if (!CollectionUtils.isEmpty(var4) && var4.stream().anyMatch((ax) -> { + return StringUtils.equals(ax.getName(), var3.getName()); + })) { + C.commit(var2); + return -2; + } + + if (var6 != DEPT_ROOT_PID) { + c.decreasingSubcount(var6); + } + + if (var3.getPid() != DEPT_ROOT_PID) { + c.incrementalSubcount(var3.getPid()); + } + } + + if (!CollectionUtils.isEmpty(var4) && var4.stream().anyMatch((ax) -> { + return StringUtils.equals(ax.getName(), var3.getName()) && var3.getDeptId() != ax.getDeptId(); + })) { + C.commit(var2); + return -2; + } else { + int var10 = m.updateByPrimaryKeySelective(var3); + C.commit(var2); + return var10; + } + } catch (Exception var7) { + C.rollback(var2); + throw new RuntimeException(var7); + } + } + + public int add(XpackCreateDept a) { + TransactionStatus var2 = C.getTransaction(transactionDefinition); + XpackSysDept var3 = (XpackSysDept) PluginCommonUtil.copyBean(new XpackSysDept(), a); + if (a.isTop()) { + var3.setPid(DEPT_ROOT_PID); + } + + List sysDeptList; + if (!CollectionUtils.isEmpty(sysDeptList = nodesByPid(var3.getPid())) && sysDeptList.stream().anyMatch((ax) -> { + return StringUtils.equals(ax.getName(), var3.getName()); + })) { + C.commit(var2); + return -2; + } else { + long var4 = System.currentTimeMillis(); + var3.setCreateTime(var4); + var3.setUpdateTime(var4); + var3.setCreateBy((String) null); + var3.setUpdateBy((String) null); + var3.setSubCount(e); + + try { + int saveXpackSysDept = m.insert(var3); + Long var9 = null; + if ((var9 = var3.getPid()) != DEPT_ROOT_PID) { + c.incrementalSubcount(var9); + } + C.commit(var2); + return saveXpackSysDept == 1 ? saveXpackSysDept : -1; + } catch (Exception var6) { + C.rollback(var2); + throw new RuntimeException(var6); + } + } + } + + public void move(XpackMoveDept a) { + TransactionStatus var2 = C.getTransaction(transactionDefinition); + try { + Long resourceId = a.getResourceId(); + Long targetId = a.getTargetId(); + XpackSysDept var4 = m.selectByPrimaryKey(resourceId); + c.decreasingSubcount(var4.getPid()); + var4 = new XpackSysDept(); + var4.setDeptId(resourceId); + var4.setPid(targetId); + m.updateByPrimaryKeySelective(var4); + c.incrementalSubcount(targetId); + C.commit(var2); + } catch (Exception var5) { + C.rollback(var2); + throw new RuntimeException(var5); + } + } + + public List nodesByPid(Long a) { + XpackSysDeptExample sysDeptExample; + XpackSysDeptExample.Criteria criteria = (sysDeptExample = new XpackSysDeptExample()).createCriteria(); + if (ObjectUtils.isEmpty(a)) { + criteria.andPidEqualTo(0L); + } else { + criteria.andPidEqualTo(a); + } + sysDeptExample.setOrderByClause("dept_sort"); + return m.selectByExample(sysDeptExample); + } + + + // $FF: synthetic method + private PluginSysMenu editDept() { + PluginSysMenu sysMenu = new PluginSysMenu(); + sysMenu.setIcon((String) null); + sysMenu.setTitle("编辑组织"); + sysMenu.setMenuId(20L); + sysMenu.setPid(4L); + sysMenu.setHidden(false); + sysMenu.setPermission("dept:edit"); + sysMenu.setType(2); + sysMenu.setMenuSort(999); + return sysMenu; + } + + // $FF: synthetic method + private List getAllNodes() { + return c.allNodes(); + } + + // $FF: synthetic method + private List buildPluginSimpleTreeNodes(List allTreeNodes, List searchTreeNodes) { + Map allTreeNodeMaps = allTreeNodes.stream().collect(Collectors.toMap(PluginSimpleTreeNode::getId, (ax) -> ax)); + return (List) searchTreeNodes.parallelStream().flatMap((ax) -> { + ArrayList var2 = new ArrayList(); + Long var3; + for (PluginSimpleTreeNode var10000 = ax; var10000 != null; var10000 = ax = (PluginSimpleTreeNode) allTreeNodeMaps.get(var3)) { + var2.add(ax.getId()); + var3 = ax.getPid(); + } + return var2.stream(); + }).distinct().collect(Collectors.toList()); + } + + // $FF: synthetic method + private PluginSysMenu createDept() { + PluginSysMenu sysMenu = new PluginSysMenu(); + sysMenu.setIcon((String) null); + sysMenu.setTitle("创建组织"); + sysMenu.setMenuId(18L); + sysMenu.setPid(4L); + sysMenu.setHidden(false); + sysMenu.setPermission("dept:add"); + sysMenu.setType(2); + sysMenu.setMenuSort(999); + return sysMenu; + } + + // $FF: synthetic method + private List getPluginSimpleTreeNode(XpackGridRequest request) { + return c.nodesByExample(request.convertExample()); + } + + // $FF: synthetic method + private PluginSysMenu manageDept() { + PluginSysMenu sysMenu = new PluginSysMenu(); + sysMenu.setIcon("dept"); + sysMenu.setTitle("组织管理"); + sysMenu.setMenuId(4L); + sysMenu.setPid(1L); + sysMenu.setHidden(false); + sysMenu.setComponent("SystemDept"); + sysMenu.setName("system-dept"); + sysMenu.setPath("dept"); + sysMenu.setPermission("dept:read"); + sysMenu.setType(1); + sysMenu.setSubCount(3); + sysMenu.setMenuSort(3); + return sysMenu; + } + + // $FF: synthetic method + private PluginSysMenu delDept() { + PluginSysMenu sysMenu = new PluginSysMenu(); + sysMenu.setIcon((String) null); + sysMenu.setTitle("删除组织"); + sysMenu.setMenuId(19L); + sysMenu.setPid(4L); + sysMenu.setHidden(false); + sysMenu.setPermission("dept:del"); + sysMenu.setType(2); + sysMenu.setMenuSort(999); + return sysMenu; + } + + // $FF: synthetic method + private PluginSysMenu deptForm() { + PluginSysMenu sysMenu = new PluginSysMenu(); + sysMenu.setIcon((String) null); + sysMenu.setTitle("组织表单"); + sysMenu.setMenuId(37L); + sysMenu.setPid(1L); + sysMenu.setHidden(true); + sysMenu.setComponent("SystemDeptForm"); + sysMenu.setName("system-dept-form"); + sysMenu.setPath("dept-form"); + sysMenu.setType(1); + sysMenu.setMenuSort(999); + return sysMenu; + } +} + diff --git a/backend/src/main/java/com/ipsos/plugins/xpack/impl/RoleXpackDefaultService.java b/backend/src/main/java/com/ipsos/plugins/xpack/impl/RoleXpackDefaultService.java new file mode 100644 index 0000000..d9f52e6 --- /dev/null +++ b/backend/src/main/java/com/ipsos/plugins/xpack/impl/RoleXpackDefaultService.java @@ -0,0 +1,169 @@ +package com.ipsos.plugins.xpack.impl; + +import com.ipsos.common.dto.PluginSysMenu; +import com.ipsos.common.entity.XpackGridExample; +import com.ipsos.common.entity.XpackGridRequest; +import com.ipsos.common.util.PluginCommonUtil; +import com.ipsos.plugins.xpack.mapper.role.XpackExtRoleMapper; +import com.ipsos.plugins.xpack.mapper.role.XpackSysRoleMapper; +import com.ipsos.plugins.xpack.role.dto.response.XpackRoleDto; +import com.ipsos.plugins.xpack.role.entity.XpackSysRole; +import com.ipsos.plugins.xpack.role.service.RoleXpackService; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import javax.annotation.Resource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.datasource.DataSourceTransactionManager; +import org.springframework.stereotype.Service; +import org.springframework.transaction.TransactionDefinition; +import org.springframework.transaction.TransactionStatus; + +@Service +public class RoleXpackDefaultService extends RoleXpackService { + @Autowired + private DataSourceTransactionManager transactionManager; + @Autowired + private XpackExtRoleMapper extRoleMapper; + @Autowired + private XpackSysRoleMapper sysRoleMapper; + @Autowired + TransactionDefinition transactionDefinition; + + public void delete(Long a) { + TransactionStatus var2 = transactionManager.getTransaction(transactionDefinition); + + try { + extRoleMapper.deleteMenuMapping(a); + extRoleMapper.deleteUserMapping(a); + sysRoleMapper.deleteByPrimaryKey(a); + transactionManager.commit(var2); + } catch (Exception var3) { + transactionManager.rollback(var2); + throw new RuntimeException(var3); + } + } + + public List menus() { + PluginSysMenu var1 = roleDel(); + PluginSysMenu var2 = roleEdit(); + PluginSysMenu var3 = roleForm(); + PluginSysMenu var4 = roleRead(); + PluginSysMenu var5 = roleAdd(); + ArrayList menus; + (menus = new ArrayList()).add(var1); + menus.add(var2); + menus.add(var3); + menus.add(var4); + menus.add(var5); + return menus; + } + + public void update(XpackRoleDto roleDto) { + XpackSysRole role = (XpackSysRole)PluginCommonUtil.copyBean(new XpackSysRole(), roleDto); + Long time = System.currentTimeMillis(); + role.setUpdateTime(time); + sysRoleMapper.updateByPrimaryKey(role); + } + + public List query(XpackGridRequest request) { + XpackGridExample example = request.convertExample(); + return (List) extRoleMapper.query(example).stream().map((ax) -> { + return (XpackRoleDto)PluginCommonUtil.copyBean(new XpackRoleDto(), ax); + }).collect(Collectors.toList()); + } + + public InputStream readContent(String a) { + return a.getClass().getClassLoader().getResourceAsStream((new StringBuilder()).insert(0, "static/").append(a).toString()); + } + + public void save(XpackRoleDto a) { + XpackSysRole role = PluginCommonUtil.copyBean(new XpackSysRole(), a); + Long time = System.currentTimeMillis(); + role.setCreateTime(time); + role.setUpdateTime(time); + sysRoleMapper.insert(role); + } + + // $FF: synthetic method + private PluginSysMenu roleAdd() { + PluginSysMenu var1 = new PluginSysMenu(); + var1.setIcon((String)null); + var1.setTitle("创建角色"); + var1.setMenuId(21L); + var1.setPid(5L); + var1.setHidden(false); + var1.setPermission("role:add"); + var1.setType(2); + var1.setMenuSort(999); + return var1; + } + + public List allRoles() { + return extRoleMapper.queryAll(); + } + + // $FF: synthetic method + private PluginSysMenu roleEdit() { + PluginSysMenu var1 = new PluginSysMenu(); + var1.setIcon((String)null); + var1.setTitle("编辑角色"); + var1.setMenuId(23L); + var1.setPid(5L); + var1.setHidden(false); + var1.setPermission("role:edit"); + var1.setType(2); + var1.setMenuSort(999); + return var1; + } + + // $FF: synthetic method + private PluginSysMenu roleForm() { + PluginSysMenu var1 = new PluginSysMenu(); + var1.setIcon((String)null); + var1.setTitle("角色表单"); + var1.setMenuId(38L); + var1.setPid(1L); + var1.setHidden(true); + var1.setComponent("SystemRoleForm"); + var1.setName("system-role-form"); + var1.setPath("role-form"); + var1.setType(1); + var1.setMenuSort(999); + return var1; + } + + // $FF: synthetic method + private PluginSysMenu roleRead() { + PluginSysMenu var1 = new PluginSysMenu(); + var1.setIcon("role"); + var1.setTitle("角色管理"); + var1.setMenuId(5L); + var1.setPid(1L); + var1.setHidden(false); + var1.setComponent("SystemRole"); + var1.setName("system-role"); + var1.setPath("role"); + var1.setPermission("role:read"); + var1.setType(1); + var1.setSubCount(3); + var1.setMenuSort(2); + return var1; + } + + // $FF: synthetic method + private PluginSysMenu roleDel() { + PluginSysMenu var1 = new PluginSysMenu(); + var1.setIcon((String)null); + var1.setTitle("删除角色"); + var1.setMenuId(22L); + var1.setPid(5L); + var1.setHidden(false); + var1.setPermission("role:del"); + var1.setType(2); + var1.setMenuSort(999); + return var1; + } +} diff --git a/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackExtSysAuthDetailMapper.java b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackExtSysAuthDetailMapper.java new file mode 100644 index 0000000..cac1040 --- /dev/null +++ b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackExtSysAuthDetailMapper.java @@ -0,0 +1,13 @@ +package com.ipsos.plugins.xpack.mapper.auth; + +import com.ipsos.plugins.xpack.auth.dto.response.XpackSysAuthDetail; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface XpackExtSysAuthDetailMapper { + void copyAuthModel(@Param("authTypeModel") String authTypeModel, @Param("authId") String authId, @Param("createUser") String createUser); + + void authDetailsChange(@Param("privilegeValue") Integer privilegeValue, @Param("privilegeType") Integer privilegeType, @Param("authIds") List authIds); + + List searchAuthTypeModel(@Param("authTypeModel") String authTypeModel); +} diff --git a/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackExtSysAuthDetailMapper.xml b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackExtSysAuthDetailMapper.xml new file mode 100644 index 0000000..9c7eb5d --- /dev/null +++ b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackExtSysAuthDetailMapper.xml @@ -0,0 +1,54 @@ + + + + + + + + INSERT INTO sys_auth_detail ( + id, + auth_id, + privilege_name, + privilege_type, + privilege_value, + privilege_extend, + remark, + create_user, + create_time + ) SELECT + uuid() AS id, + #{authId} AS auth_id, + sys_auth_detail.privilege_name, + sys_auth_detail.privilege_type, + sys_auth_detail.privilege_value, + sys_auth_detail.privilege_extend, + sys_auth_detail.remark, + #{createUser} AS create_user, + unix_timestamp(now())* 1000 AS create_time + FROM + sys_auth_detail where auth_id =#{authTypeModel} + + + + + UPDATE sys_auth_detail + SET privilege_value = #{privilegeValue} + + auth_id in + #{authId} + + and privilege_type <= #{privilegeType} + + + and privilege_type >= #{privilegeType} + + + + + diff --git a/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackExtSysAuthMapper.java b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackExtSysAuthMapper.java new file mode 100644 index 0000000..f253045 --- /dev/null +++ b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackExtSysAuthMapper.java @@ -0,0 +1,14 @@ +package com.ipsos.plugins.xpack.mapper.auth; + +import com.ipsos.plugins.xpack.auth.dto.request.XpackSysAuthRequest; +import com.ipsos.plugins.xpack.auth.dto.response.XpackSysAuthDetailDTO; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface XpackExtSysAuthMapper { + Boolean authExist(@Param("authSource") String authSource, @Param("authTarget") String authTarget); + + String findAuthId(@Param("authSource") String authSource, @Param("authSourceType") String authSourceType, @Param("authTarget") String authTarget, @Param("authTargetType") String authTargetType); + + List search(XpackSysAuthRequest authRequest); +} diff --git a/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackExtSysAuthMapper.xml b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackExtSysAuthMapper.xml new file mode 100644 index 0000000..cab5eb2 --- /dev/null +++ b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackExtSysAuthMapper.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackExtVAuthModelMapper.java b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackExtVAuthModelMapper.java new file mode 100644 index 0000000..e05235e --- /dev/null +++ b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackExtVAuthModelMapper.java @@ -0,0 +1,9 @@ +package com.ipsos.plugins.xpack.mapper.auth; + +import com.ipsos.plugins.xpack.auth.dto.request.XpackBaseTreeRequest; +import com.ipsos.plugins.xpack.auth.dto.response.XpackVAuthModelDTO; +import java.util.List; + +public interface XpackExtVAuthModelMapper { + List searchTree(XpackBaseTreeRequest baseTreeRequest); +} diff --git a/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackExtVAuthModelMapper.xml b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackExtVAuthModelMapper.xml new file mode 100644 index 0000000..ea29522 --- /dev/null +++ b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackExtVAuthModelMapper.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackSysAuthDetailMapper.java b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackSysAuthDetailMapper.java new file mode 100644 index 0000000..d43a702 --- /dev/null +++ b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackSysAuthDetailMapper.java @@ -0,0 +1,31 @@ +package com.ipsos.plugins.xpack.mapper.auth; + +import com.ipsos.plugins.xpack.auth.dto.response.XpackSysAuthDetail; +import java.util.List; + +import com.ipsos.plugins.xpack.auth.entity.XpackSysAuthDetailExample; +import org.apache.ibatis.annotations.Param; + +public interface XpackSysAuthDetailMapper { + List selectByExample(XpackSysAuthDetailExample sysAuthDetailExample); + + int deleteByExample(XpackSysAuthDetailExample sysAuthDetailExample); + + XpackSysAuthDetail selectByPrimaryKey(String primaryKey); + + int updateByPrimaryKey(XpackSysAuthDetail sysAuthDetail); + + int deleteByPrimaryKey(String primaryKey); + + int insert(XpackSysAuthDetail sysAuthDetail); + + int updateByExample(@Param("record") XpackSysAuthDetail record, @Param("example") XpackSysAuthDetailExample example); + + int updateByPrimaryKeySelective(XpackSysAuthDetail sysAuthDetail); + + int updateByExampleSelective(@Param("record") XpackSysAuthDetail record, @Param("example") XpackSysAuthDetailExample example); + + long countByExample(XpackSysAuthDetailExample sysAuthDetailExample); + + int insertSelective(XpackSysAuthDetail sysAuthDetail); +} diff --git a/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackSysAuthDetailMapper.xml b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackSysAuthDetailMapper.xml new file mode 100644 index 0000000..67933ed --- /dev/null +++ b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackSysAuthDetailMapper.xml @@ -0,0 +1,291 @@ + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, auth_id, privilege_name, privilege_type, privilege_value, privilege_extend, remark, + create_user, create_time, update_time + + + + + delete from sys_auth_detail + where id = #{id,jdbcType=VARCHAR} + + + delete from sys_auth_detail + + + + + + insert into sys_auth_detail (id, auth_id, privilege_name, + privilege_type, privilege_value, privilege_extend, + remark, create_user, create_time, + update_time) + values (#{id,jdbcType=VARCHAR}, #{authId,jdbcType=VARCHAR}, #{privilegeName,jdbcType=VARCHAR}, + #{privilegeType,jdbcType=INTEGER}, #{privilegeValue,jdbcType=INTEGER}, #{privilegeExtend,jdbcType=VARCHAR}, + #{remark,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, + #{updateTime,jdbcType=BIGINT}) + + + insert into sys_auth_detail + + + id, + + + auth_id, + + + privilege_name, + + + privilege_type, + + + privilege_value, + + + privilege_extend, + + + remark, + + + create_user, + + + create_time, + + + update_time, + + + + + #{id,jdbcType=VARCHAR}, + + + #{authId,jdbcType=VARCHAR}, + + + #{privilegeName,jdbcType=VARCHAR}, + + + #{privilegeType,jdbcType=INTEGER}, + + + #{privilegeValue,jdbcType=INTEGER}, + + + #{privilegeExtend,jdbcType=VARCHAR}, + + + #{remark,jdbcType=VARCHAR}, + + + #{createUser,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=BIGINT}, + + + #{updateTime,jdbcType=BIGINT}, + + + + + + update sys_auth_detail + + + id = #{record.id,jdbcType=VARCHAR}, + + + auth_id = #{record.authId,jdbcType=VARCHAR}, + + + privilege_name = #{record.privilegeName,jdbcType=VARCHAR}, + + + privilege_type = #{record.privilegeType,jdbcType=INTEGER}, + + + privilege_value = #{record.privilegeValue,jdbcType=INTEGER}, + + + privilege_extend = #{record.privilegeExtend,jdbcType=VARCHAR}, + + + remark = #{record.remark,jdbcType=VARCHAR}, + + + create_user = #{record.createUser,jdbcType=VARCHAR}, + + + create_time = #{record.createTime,jdbcType=BIGINT}, + + + update_time = #{record.updateTime,jdbcType=BIGINT}, + + + + + + + + update sys_auth_detail + set id = #{record.id,jdbcType=VARCHAR}, + auth_id = #{record.authId,jdbcType=VARCHAR}, + privilege_name = #{record.privilegeName,jdbcType=VARCHAR}, + privilege_type = #{record.privilegeType,jdbcType=INTEGER}, + privilege_value = #{record.privilegeValue,jdbcType=INTEGER}, + privilege_extend = #{record.privilegeExtend,jdbcType=VARCHAR}, + remark = #{record.remark,jdbcType=VARCHAR}, + create_user = #{record.createUser,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + update_time = #{record.updateTime,jdbcType=BIGINT} + + + + + + update sys_auth_detail + + + auth_id = #{authId,jdbcType=VARCHAR}, + + + privilege_name = #{privilegeName,jdbcType=VARCHAR}, + + + privilege_type = #{privilegeType,jdbcType=INTEGER}, + + + privilege_value = #{privilegeValue,jdbcType=INTEGER}, + + + privilege_extend = #{privilegeExtend,jdbcType=VARCHAR}, + + + remark = #{remark,jdbcType=VARCHAR}, + + + create_user = #{createUser,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=BIGINT}, + + + update_time = #{updateTime,jdbcType=BIGINT}, + + + where id = #{id,jdbcType=VARCHAR} + + + update sys_auth_detail + set auth_id = #{authId,jdbcType=VARCHAR}, + privilege_name = #{privilegeName,jdbcType=VARCHAR}, + privilege_type = #{privilegeType,jdbcType=INTEGER}, + privilege_value = #{privilegeValue,jdbcType=INTEGER}, + privilege_extend = #{privilegeExtend,jdbcType=VARCHAR}, + remark = #{remark,jdbcType=VARCHAR}, + create_user = #{createUser,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + update_time = #{updateTime,jdbcType=BIGINT} + where id = #{id,jdbcType=VARCHAR} + + diff --git a/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackSysAuthMapper.java b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackSysAuthMapper.java new file mode 100644 index 0000000..1518565 --- /dev/null +++ b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackSysAuthMapper.java @@ -0,0 +1,30 @@ +package com.ipsos.plugins.xpack.mapper.auth; + +import com.ipsos.plugins.xpack.auth.dto.response.XpackSysAuth; +import com.ipsos.plugins.xpack.auth.entity.XpackSysAuthExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface XpackSysAuthMapper { + int updateByPrimaryKeySelective(XpackSysAuth var1); + + int updateByExample(@Param("record") XpackSysAuth record, @Param("example") XpackSysAuthExample example); + + int deleteByExample(XpackSysAuthExample example); + + int insert(XpackSysAuth sysAuth); + + int updateByPrimaryKey(XpackSysAuth sysAuth); + + int insertSelective(XpackSysAuth sysAuth); + + XpackSysAuth selectByPrimaryKey(String primaryKey); + + int deleteByPrimaryKey(String primaryKey); + + List selectByExample(XpackSysAuthExample example); + + long countByExample(XpackSysAuthExample example); + + int updateByExampleSelective(@Param("record") XpackSysAuth record, @Param("example") XpackSysAuthExample example); +} diff --git a/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackSysAuthMapper.xml b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackSysAuthMapper.xml new file mode 100644 index 0000000..064a22a --- /dev/null +++ b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackSysAuthMapper.xml @@ -0,0 +1,276 @@ + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, auth_source, auth_source_type, auth_target, auth_target_type, auth_time, auth_details, + auth_user, update_time + + + + + delete from sys_auth + where id = #{id,jdbcType=VARCHAR} + + + delete from sys_auth + + + + + + insert into sys_auth (id, auth_source, auth_source_type, + auth_target, auth_target_type, auth_time, + auth_details, auth_user, update_time + ) + values (#{id,jdbcType=VARCHAR}, #{authSource,jdbcType=VARCHAR}, #{authSourceType,jdbcType=VARCHAR}, + #{authTarget,jdbcType=VARCHAR}, #{authTargetType,jdbcType=VARCHAR}, #{authTime,jdbcType=BIGINT}, + #{authDetails,jdbcType=VARCHAR}, #{authUser,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP} + ) + + + insert into sys_auth + + + id, + + + auth_source, + + + auth_source_type, + + + auth_target, + + + auth_target_type, + + + auth_time, + + + auth_details, + + + auth_user, + + + update_time, + + + + + #{id,jdbcType=VARCHAR}, + + + #{authSource,jdbcType=VARCHAR}, + + + #{authSourceType,jdbcType=VARCHAR}, + + + #{authTarget,jdbcType=VARCHAR}, + + + #{authTargetType,jdbcType=VARCHAR}, + + + #{authTime,jdbcType=BIGINT}, + + + #{authDetails,jdbcType=VARCHAR}, + + + #{authUser,jdbcType=VARCHAR}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + + + + update sys_auth + + + id = #{record.id,jdbcType=VARCHAR}, + + + auth_source = #{record.authSource,jdbcType=VARCHAR}, + + + auth_source_type = #{record.authSourceType,jdbcType=VARCHAR}, + + + auth_target = #{record.authTarget,jdbcType=VARCHAR}, + + + auth_target_type = #{record.authTargetType,jdbcType=VARCHAR}, + + + auth_time = #{record.authTime,jdbcType=BIGINT}, + + + auth_details = #{record.authDetails,jdbcType=VARCHAR}, + + + auth_user = #{record.authUser,jdbcType=VARCHAR}, + + + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + + + + + + + + update sys_auth + set id = #{record.id,jdbcType=VARCHAR}, + auth_source = #{record.authSource,jdbcType=VARCHAR}, + auth_source_type = #{record.authSourceType,jdbcType=VARCHAR}, + auth_target = #{record.authTarget,jdbcType=VARCHAR}, + auth_target_type = #{record.authTargetType,jdbcType=VARCHAR}, + auth_time = #{record.authTime,jdbcType=BIGINT}, + auth_details = #{record.authDetails,jdbcType=VARCHAR}, + auth_user = #{record.authUser,jdbcType=VARCHAR}, + update_time = #{record.updateTime,jdbcType=TIMESTAMP} + + + + + + update sys_auth + + + auth_source = #{authSource,jdbcType=VARCHAR}, + + + auth_source_type = #{authSourceType,jdbcType=VARCHAR}, + + + auth_target = #{authTarget,jdbcType=VARCHAR}, + + + auth_target_type = #{authTargetType,jdbcType=VARCHAR}, + + + auth_time = #{authTime,jdbcType=BIGINT}, + + + auth_details = #{authDetails,jdbcType=VARCHAR}, + + + auth_user = #{authUser,jdbcType=VARCHAR}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + where id = #{id,jdbcType=VARCHAR} + + + update sys_auth + set auth_source = #{authSource,jdbcType=VARCHAR}, + auth_source_type = #{authSourceType,jdbcType=VARCHAR}, + auth_target = #{authTarget,jdbcType=VARCHAR}, + auth_target_type = #{authTargetType,jdbcType=VARCHAR}, + auth_time = #{authTime,jdbcType=BIGINT}, + auth_details = #{authDetails,jdbcType=VARCHAR}, + auth_user = #{authUser,jdbcType=VARCHAR}, + update_time = #{updateTime,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=VARCHAR} + + diff --git a/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackVAuthModelMapper.java b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackVAuthModelMapper.java new file mode 100644 index 0000000..2f8a52f --- /dev/null +++ b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackVAuthModelMapper.java @@ -0,0 +1,23 @@ +package com.ipsos.plugins.xpack.mapper.auth; + +import com.ipsos.plugins.xpack.auth.dto.response.XpackVAuthModel; +import java.util.List; + +import com.ipsos.plugins.xpack.auth.entity.XpackVAuthModelExample; +import org.apache.ibatis.annotations.Param; + +public interface XpackVAuthModelMapper { + long countByExample(XpackVAuthModelExample var1); + + int updateByExample(@Param("record") XpackVAuthModel var1, @Param("example") XpackVAuthModelExample var2); + + int insert(XpackVAuthModel var1); + + int deleteByExample(XpackVAuthModelExample var1); + + int updateByExampleSelective(@Param("record") XpackVAuthModel var1, @Param("example") XpackVAuthModelExample var2); + + int insertSelective(XpackVAuthModel var1); + + List selectByExample(XpackVAuthModelExample var1); +} diff --git a/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackVAuthModelMapper.xml b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackVAuthModelMapper.xml new file mode 100644 index 0000000..da06673 --- /dev/null +++ b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/auth/XpackVAuthModelMapper.xml @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, `name`, `label`, pid, node_type, model_type, model_inner_type, auth_type, create_by + + + + delete from v_auth_model + + + + + + insert into v_auth_model (id, `name`, `label`, + pid, node_type, model_type, + model_inner_type, auth_type, create_by + ) + values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{label,jdbcType=VARCHAR}, + #{pid,jdbcType=VARCHAR}, #{nodeType,jdbcType=VARCHAR}, #{modelType,jdbcType=VARCHAR}, + #{modelInnerType,jdbcType=VARCHAR}, #{authType,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR} + ) + + + insert into v_auth_model + + + id, + + + `name`, + + + `label`, + + + pid, + + + node_type, + + + model_type, + + + model_inner_type, + + + auth_type, + + + create_by, + + + + + #{id,jdbcType=VARCHAR}, + + + #{name,jdbcType=VARCHAR}, + + + #{label,jdbcType=VARCHAR}, + + + #{pid,jdbcType=VARCHAR}, + + + #{nodeType,jdbcType=VARCHAR}, + + + #{modelType,jdbcType=VARCHAR}, + + + #{modelInnerType,jdbcType=VARCHAR}, + + + #{authType,jdbcType=VARCHAR}, + + + #{createBy,jdbcType=VARCHAR}, + + + + + + update v_auth_model + + + id = #{record.id,jdbcType=VARCHAR}, + + + `name` = #{record.name,jdbcType=VARCHAR}, + + + `label` = #{record.label,jdbcType=VARCHAR}, + + + pid = #{record.pid,jdbcType=VARCHAR}, + + + node_type = #{record.nodeType,jdbcType=VARCHAR}, + + + model_type = #{record.modelType,jdbcType=VARCHAR}, + + + model_inner_type = #{record.modelInnerType,jdbcType=VARCHAR}, + + + auth_type = #{record.authType,jdbcType=VARCHAR}, + + + create_by = #{record.createBy,jdbcType=VARCHAR}, + + + + + + + + update v_auth_model + set id = #{record.id,jdbcType=VARCHAR}, + `name` = #{record.name,jdbcType=VARCHAR}, + `label` = #{record.label,jdbcType=VARCHAR}, + pid = #{record.pid,jdbcType=VARCHAR}, + node_type = #{record.nodeType,jdbcType=VARCHAR}, + model_type = #{record.modelType,jdbcType=VARCHAR}, + model_inner_type = #{record.modelInnerType,jdbcType=VARCHAR}, + auth_type = #{record.authType,jdbcType=VARCHAR}, + create_by = #{record.createBy,jdbcType=VARCHAR} + + + + + diff --git a/backend/src/main/java/com/ipsos/plugins/xpack/mapper/dept/XpackExtDeptMapper.java b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/dept/XpackExtDeptMapper.java new file mode 100644 index 0000000..15b47d7 --- /dev/null +++ b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/dept/XpackExtDeptMapper.java @@ -0,0 +1,29 @@ +package com.ipsos.plugins.xpack.mapper.dept; + +import java.util.List; + +import com.ipsos.common.dto.PluginSimpleTreeNode; +import com.ipsos.common.entity.XpackGridExample; +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Update; + +public interface XpackExtDeptMapper { + + List allNodes(); + + @Delete({""}) + int batchDelete(@Param("ids") List var1); + + List nodesByExample(XpackGridExample var1); + + @Update({" update sys_dept set sub_count = sub_count-1 where dept_id = #{deptId} and sub_count > 0"}) + int decreasingSubcount(@Param("deptId") Long var1); + + @Update({""}) + int updateUserDeptId(@Param("ids") List var1); + + @Update({" update sys_dept set sub_count = sub_count+1 where dept_id = #{deptId} "}) + int incrementalSubcount(@Param("deptId") Long var1); +} diff --git a/backend/src/main/java/com/ipsos/plugins/xpack/mapper/dept/XpackExtDeptMapper.xml b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/dept/XpackExtDeptMapper.xml new file mode 100644 index 0000000..8d653cf --- /dev/null +++ b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/dept/XpackExtDeptMapper.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + diff --git a/backend/src/main/java/com/ipsos/plugins/xpack/mapper/dept/XpackSysDeptMapper.java b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/dept/XpackSysDeptMapper.java new file mode 100644 index 0000000..1b6221e --- /dev/null +++ b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/dept/XpackSysDeptMapper.java @@ -0,0 +1,31 @@ +package com.ipsos.plugins.xpack.mapper.dept; + +import java.util.List; + +import com.ipsos.plugins.xpack.dept.dto.response.XpackSysDept; +import com.ipsos.plugins.xpack.dept.entity.XpackSysDeptExample; +import org.apache.ibatis.annotations.Param; + +public interface XpackSysDeptMapper { + int insertSelective(XpackSysDept var1); + + int deleteByPrimaryKey(Long var1); + + int updateByExampleSelective(@Param("record") XpackSysDept record, @Param("example") XpackSysDeptExample example); + + XpackSysDept selectByPrimaryKey(Long var1); + + int updateByPrimaryKey(XpackSysDept var1); + + int insert(XpackSysDept var1); + + List selectByExample(XpackSysDeptExample var1); + + long countByExample(XpackSysDeptExample var1); + + int deleteByExample(XpackSysDeptExample var1); + + int updateByExample(@Param("record") XpackSysDept record, @Param("example") XpackSysDeptExample example); + + int updateByPrimaryKeySelective(XpackSysDept var1); +} diff --git a/backend/src/main/java/com/ipsos/plugins/xpack/mapper/dept/XpackSysDeptMapper.xml b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/dept/XpackSysDeptMapper.xml new file mode 100644 index 0000000..b96f047 --- /dev/null +++ b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/dept/XpackSysDeptMapper.xml @@ -0,0 +1,275 @@ + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + dept_id, pid, sub_count, `name`, dept_sort, create_by, update_by, create_time, update_time + + + + + delete from sys_dept + where dept_id = #{deptId,jdbcType=BIGINT} + + + delete from sys_dept + + + + + + insert into sys_dept (dept_id, pid, sub_count, + `name`, dept_sort, create_by, + update_by, create_time, update_time + ) + values (#{deptId,jdbcType=BIGINT}, #{pid,jdbcType=BIGINT}, #{subCount,jdbcType=INTEGER}, + #{name,jdbcType=VARCHAR}, #{deptSort,jdbcType=INTEGER}, #{createBy,jdbcType=VARCHAR}, + #{updateBy,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT} + ) + + + insert into sys_dept + + + dept_id, + + + pid, + + + sub_count, + + + `name`, + + + dept_sort, + + + create_by, + + + update_by, + + + create_time, + + + update_time, + + + + + #{deptId,jdbcType=BIGINT}, + + + #{pid,jdbcType=BIGINT}, + + + #{subCount,jdbcType=INTEGER}, + + + #{name,jdbcType=VARCHAR}, + + + #{deptSort,jdbcType=INTEGER}, + + + #{createBy,jdbcType=VARCHAR}, + + + #{updateBy,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=BIGINT}, + + + #{updateTime,jdbcType=BIGINT}, + + + + + + update sys_dept + + + dept_id = #{record.deptId,jdbcType=BIGINT}, + + + pid = #{record.pid,jdbcType=BIGINT}, + + + sub_count = #{record.subCount,jdbcType=INTEGER}, + + + `name` = #{record.name,jdbcType=VARCHAR}, + + + dept_sort = #{record.deptSort,jdbcType=INTEGER}, + + + create_by = #{record.createBy,jdbcType=VARCHAR}, + + + update_by = #{record.updateBy,jdbcType=VARCHAR}, + + + create_time = #{record.createTime,jdbcType=BIGINT}, + + + update_time = #{record.updateTime,jdbcType=BIGINT}, + + + + + + + + update sys_dept + set dept_id = #{record.deptId,jdbcType=BIGINT}, + pid = #{record.pid,jdbcType=BIGINT}, + sub_count = #{record.subCount,jdbcType=INTEGER}, + `name` = #{record.name,jdbcType=VARCHAR}, + dept_sort = #{record.deptSort,jdbcType=INTEGER}, + create_by = #{record.createBy,jdbcType=VARCHAR}, + update_by = #{record.updateBy,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + update_time = #{record.updateTime,jdbcType=BIGINT} + + + + + + update sys_dept + + + pid = #{pid,jdbcType=BIGINT}, + + + sub_count = #{subCount,jdbcType=INTEGER}, + + + `name` = #{name,jdbcType=VARCHAR}, + + + dept_sort = #{deptSort,jdbcType=INTEGER}, + + + create_by = #{createBy,jdbcType=VARCHAR}, + + + update_by = #{updateBy,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=BIGINT}, + + + update_time = #{updateTime,jdbcType=BIGINT}, + + + where dept_id = #{deptId,jdbcType=BIGINT} + + + update sys_dept + set pid = #{pid,jdbcType=BIGINT}, + sub_count = #{subCount,jdbcType=INTEGER}, + `name` = #{name,jdbcType=VARCHAR}, + dept_sort = #{deptSort,jdbcType=INTEGER}, + create_by = #{createBy,jdbcType=VARCHAR}, + update_by = #{updateBy,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + update_time = #{updateTime,jdbcType=BIGINT} + where dept_id = #{deptId,jdbcType=BIGINT} + + diff --git a/backend/src/main/java/com/ipsos/plugins/xpack/mapper/role/XpackExtRoleMapper.java b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/role/XpackExtRoleMapper.java new file mode 100644 index 0000000..e29efe9 --- /dev/null +++ b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/role/XpackExtRoleMapper.java @@ -0,0 +1,15 @@ +package com.ipsos.plugins.xpack.mapper.role; + +import com.ipsos.common.entity.XpackGridExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface XpackExtRoleMapper { + int deleteUserMapping(@Param("roleId") Long roleId); + + List query(XpackGridExample example); + + List queryAll(); + + int deleteMenuMapping(@Param("roleId") Long roleId); +} diff --git a/backend/src/main/java/com/ipsos/plugins/xpack/mapper/role/XpackExtRoleMapper.xml b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/role/XpackExtRoleMapper.xml new file mode 100644 index 0000000..e29790d --- /dev/null +++ b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/role/XpackExtRoleMapper.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + delete from sys_roles_menus where role_id = #{roleId} + + + + + delete from sys_users_roles where role_id = #{roleId} + + + + + + + + + diff --git a/backend/src/main/java/com/ipsos/plugins/xpack/mapper/role/XpackSysRoleMapper.java b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/role/XpackSysRoleMapper.java new file mode 100644 index 0000000..91c8288 --- /dev/null +++ b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/role/XpackSysRoleMapper.java @@ -0,0 +1,30 @@ +package com.ipsos.plugins.xpack.mapper.role; + +import com.ipsos.plugins.xpack.role.entity.XpackSysRole; +import com.ipsos.plugins.xpack.role.entity.XpackSysRoleExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface XpackSysRoleMapper { + int updateByPrimaryKeySelective(XpackSysRole role); + + long countByExample(XpackSysRoleExample example); + + int insertSelective(XpackSysRole role); + + int updateByExample(@Param("record") XpackSysRole record, @Param("example") XpackSysRoleExample example); + + int deleteByPrimaryKey(Long roleId); + + int insert(XpackSysRole sysRole); + + int deleteByExample(XpackSysRoleExample example); + + List selectByExample(XpackSysRoleExample example); + + int updateByPrimaryKey(XpackSysRole role); + + int updateByExampleSelective(@Param("record") XpackSysRole record, @Param("example") XpackSysRoleExample example); + + XpackSysRole selectByPrimaryKey(Long roleId); +} diff --git a/backend/src/main/java/com/ipsos/plugins/xpack/mapper/role/XpackSysRoleMapper.xml b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/role/XpackSysRoleMapper.xml new file mode 100644 index 0000000..ee8a6bd --- /dev/null +++ b/backend/src/main/java/com/ipsos/plugins/xpack/mapper/role/XpackSysRoleMapper.xml @@ -0,0 +1,243 @@ + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + role_id, `name`, description, create_by, update_by, create_time, update_time + + + + + delete from sys_role + where role_id = #{roleId,jdbcType=BIGINT} + + + delete from sys_role + + + + + + insert into sys_role (role_id, `name`, description, + create_by, update_by, create_time, + update_time) + values (#{roleId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, + #{createBy,jdbcType=VARCHAR}, #{updateBy,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, + #{updateTime,jdbcType=BIGINT}) + + + insert into sys_role + + + role_id, + + + `name`, + + + description, + + + create_by, + + + update_by, + + + create_time, + + + update_time, + + + + + #{roleId,jdbcType=BIGINT}, + + + #{name,jdbcType=VARCHAR}, + + + #{description,jdbcType=VARCHAR}, + + + #{createBy,jdbcType=VARCHAR}, + + + #{updateBy,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=BIGINT}, + + + #{updateTime,jdbcType=BIGINT}, + + + + + + update sys_role + + + role_id = #{record.roleId,jdbcType=BIGINT}, + + + `name` = #{record.name,jdbcType=VARCHAR}, + + + description = #{record.description,jdbcType=VARCHAR}, + + + create_by = #{record.createBy,jdbcType=VARCHAR}, + + + update_by = #{record.updateBy,jdbcType=VARCHAR}, + + + create_time = #{record.createTime,jdbcType=BIGINT}, + + + update_time = #{record.updateTime,jdbcType=BIGINT}, + + + + + + + + update sys_role + set role_id = #{record.roleId,jdbcType=BIGINT}, + `name` = #{record.name,jdbcType=VARCHAR}, + description = #{record.description,jdbcType=VARCHAR}, + create_by = #{record.createBy,jdbcType=VARCHAR}, + update_by = #{record.updateBy,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + update_time = #{record.updateTime,jdbcType=BIGINT} + + + + + + update sys_role + + + `name` = #{name,jdbcType=VARCHAR}, + + + description = #{description,jdbcType=VARCHAR}, + + + create_by = #{createBy,jdbcType=VARCHAR}, + + + update_by = #{updateBy,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=BIGINT}, + + + update_time = #{updateTime,jdbcType=BIGINT}, + + + where role_id = #{roleId,jdbcType=BIGINT} + + + update sys_role + set `name` = #{name,jdbcType=VARCHAR}, + description = #{description,jdbcType=VARCHAR}, + create_by = #{createBy,jdbcType=VARCHAR}, + update_by = #{updateBy,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + update_time = #{updateTime,jdbcType=BIGINT} + where role_id = #{roleId,jdbcType=BIGINT} + +