zy-asrs-admin/src/assets/main.css
@@ -8,7 +8,7 @@ .trigger { font-size: 18px; line-height: 64px; padding: 0 24px; padding: 0 6px; cursor: pointer; transition: color 0.3s; color: #000000; zy-asrs-admin/src/config.js
@@ -4,12 +4,15 @@ url: 'http://127.0.0.1:8081/wms', token: '', user: null, locale: 'zhCN' locale: 'zhCN', currentHost: null, }); export const logout = () => { globalState.token = null; globalState.user = null; globalState.currentHost = null; localStorage.removeItem('token') localStorage.removeItem('user') } zy-asrs-admin/src/router/index.js
@@ -57,6 +57,9 @@ const modules = import.meta.glob('/src/views/**/index.vue'); const resp = await get('/api/auth/router', {}); let result = resp.data; if(result.code != 200) { return null; } let data = result.data; data.forEach((item) => { const module = modules[`/src/views${item.route}/index.vue`]; zy-asrs-admin/src/views/IndexView.vue
@@ -13,6 +13,7 @@ RedoOutlined, UserOutlined, TranslationOutlined, ApartmentOutlined, } from "@ant-design/icons-vue"; import { formatMessage } from '@/utils/localeUtils.js'; @@ -25,6 +26,7 @@ let currentCache = ref(null); let isRouterAlive = ref(true); const menuCache = ref([]); const hostList = ref([]); const components = { ...Icons, @@ -71,8 +73,6 @@ } }) console.log(tmpList); if (tmp == 0) { router.push({ path: '/' @@ -106,6 +106,14 @@ } } function closeAllTabs() { routerCache.value = []; routerCacheList.value = []; router.push({ path: '/' }) } function switchTabs(item) { router.push({ path: item.key @@ -119,6 +127,41 @@ globalState.locale = locale; localStorage.setItem('locale', locale) reloadTabs() } getHostList() function getHostList() { post('/api/show/host.action', {}).then((resp) => { let result = resp.data; let data = result.data; let hostId = data.hostId; if (data.root) { post('/api/host/list', {}).then((resp) => { let result = resp.data; let data = result.data; hostList.value = data; data.forEach((item) => { if (item.id == hostId) { globalState.currentHost = item; } }) }) } }) } const switchHost = (item) => { globalState.currentHost = item; postForm('/api/root/change/host/auth', { hostId: item.id }).then((resp) => { let result = resp.data; if (result.code == 200) { window.location.reload(); } else { message.error(formatMessage('common.fail', '加载失败')); } }) } </script> @@ -159,6 +202,20 @@ <MenuFoldOutlined v-else class="trigger" @click="() => (collapsed = !collapsed)" /> </div> <div class="header-top-right"> <div class="trigger" v-if="globalState.currentHost"> <a-dropdown> <div> <ApartmentOutlined /> {{ globalState.currentHost?.name }} </div> <template #overlay> <a-menu> <a-menu-item v-for="(item, index) in hostList" :key="index" @click="switchHost(item)" :class="globalState.currentHost?.id == item.id ? 'active' : ''">{{ item.name }}</a-menu-item> </a-menu> </template> </a-dropdown> </div> <div class="trigger"> <a-dropdown> <TranslationOutlined /> zy-asrs-admin/src/views/login/LoginView.vue
@@ -8,6 +8,8 @@ let copyrightLargeShow = ref(false); let username = ref(""); let password = ref(""); let hostId = ref(null); let hostList = ref([]); function loginConfirm() { if (username.value == "" || password.value == "") { @@ -17,7 +19,8 @@ post('/api/login', { username: username.value, password: password.value password: password.value, hostId: hostId.value, }).then((result) => { if (result.data.code == 200) { let data = result.data.data; @@ -31,6 +34,25 @@ } }) } getHostList() function getHostList() { get('/api/auth/host', {}).then((result) => { if (result.data.code == 200) { let data = result.data.data; let tmp = [] data.forEach((item) => { tmp.push({ label: item.name, value: item.id }) }) hostList.value = tmp; } else { message.error(result.data.msg) } }) } </script> @@ -59,6 +81,11 @@ </p> <p style="margin-top: -10px;"><span class="login100-form-title p-t-20 p-b-45" style="color: #868686;font-size: 24px">WMS</span></p> <div class="inputContainer"> <a-select v-model:value="hostId" style="width: 100%;" :options="hostList"></a-select> </div> <div class="inputContainer"> <svg viewBox="0 0 16 16" fill="#2e2e2e" height="16" width="16" xmlns="http://www.w3.org/2000/svg" class="inputIcon"> zy-asrs-wms/src/main/java/com/zy/asrs/wms/common/config/MybatisPlusConfig.java
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor; import com.zy.asrs.wms.system.entity.User; import com.zy.asrs.wms.system.entity.UserLogin; import net.sf.jsqlparser.expression.Expression; import net.sf.jsqlparser.expression.LongValue; import net.sf.jsqlparser.expression.NullValue; @@ -72,6 +73,9 @@ if (object instanceof User) { return new LongValue(((User) object).getHostId()); } if (object instanceof UserLogin) { return new LongValue(((UserLogin) object).getHostId()); } } } catch (Exception e) { System.out.println(e.getMessage()); zy-asrs-wms/src/main/java/com/zy/asrs/wms/common/security/JwtAuthenticationFilter.java
@@ -1,12 +1,16 @@ package com.zy.asrs.wms.common.security; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.zy.asrs.common.domain.enums.LoginSystemType; import com.zy.asrs.framework.common.Cools; import com.zy.asrs.wms.common.config.ConfigProperties; import com.zy.asrs.wms.common.constant.Constants; import com.zy.asrs.wms.system.entity.Menu; import com.zy.asrs.wms.system.entity.Role; import com.zy.asrs.wms.system.entity.User; import com.zy.asrs.wms.system.entity.UserLogin; import com.zy.asrs.wms.system.service.UserLoginService; import com.zy.asrs.wms.system.service.UserRoleService; import com.zy.asrs.wms.system.service.UserService; import com.zy.asrs.wms.utils.HttpUtils; import com.zy.asrs.wms.utils.JwtUtil; @@ -50,6 +54,8 @@ private UserService userService; @Resource private UserLoginService userLoginService; @Resource private UserRoleService userRoleService; @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException { @@ -82,10 +88,23 @@ if (user == null) { throw new UsernameNotFoundException("Username not found"); } boolean root = false; List<Role> roles = userRoleService.listByUserId(user.getId()); for (Role role : roles) { if (role.getId() == 1) { root = true; break; } } UserLogin userLogin = null; if (root) { userLogin = userLoginService.superFindByUserId(user.getId(), String.valueOf(LoginSystemType.WMS)); } List<Menu> authorities = user.getAuthorities().stream() .filter(m -> !Cools.isEmpty(m.getAuthority())).collect(Collectors.toList()); UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken( user, null, authorities); userLogin == null ? user : userLogin, null, authorities); SecurityContextHolder.getContext().setAuthentication(authentication); // token将要过期签发新token, 防止突然退出登录 long expiration = (claims.getExpiration().getTime() - new Date().getTime()) / 1000 / 60; zy-asrs-wms/src/main/java/com/zy/asrs/wms/system/controller/AuthController.java
@@ -1,8 +1,11 @@ package com.zy.asrs.wms.system.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.zy.asrs.common.domain.enums.LoginSystemType; import com.zy.asrs.framework.annotations.ManagerAuth; import com.zy.asrs.framework.common.Cools; import com.zy.asrs.framework.common.R; import com.zy.asrs.framework.exception.CoolException; import com.zy.asrs.wms.common.annotation.OperationLog; import com.zy.asrs.wms.common.config.ConfigProperties; import com.zy.asrs.wms.common.security.JwtSubject; @@ -72,7 +75,7 @@ @GetMapping("/auth/menu") public R userMenu() { List<Menu> menus = roleMenuService.listMenuByUserId(getLoginUserId(), Menu.TYPE_MENU); List<Menu> menus = roleMenuService.listMenuByUserId(getLoginUserId(), Menu.TYPE_MENU, getHostId()); return R.ok().add(Utils.toTreeData(menus, 0L, Menu::getParentId, Menu::getId, Menu::setChildren)); } @@ -150,4 +153,46 @@ return R.ok().add(menuList); } @RequestMapping("/show/host.action") @ManagerAuth public R showHosts() { Long hostId = getHostId(); String hostName = null; if (hostId != null) { Host host = hostService.getById(hostId); if (host != null) { hostName = host.getName(); } } boolean root = false; List<Role> roles = userRoleService.listByUserId(getLoginUserId()); for (Role role : roles) { if (role.getId() == 1) { root = true; break; } } return R.ok().add(Cools .add("root", root) .add("host", hostId == null) .add("hostId", hostId) .add("hostName", hostName) ); } @RequestMapping(value = "/root/change/host/auth") @ManagerAuth public R rootChangeHost(@RequestParam Long hostId) { UserLogin userLogin = userLoginService.superFindByUserId(getLoginUserId(), String.valueOf(LoginSystemType.WMS)); if (userLogin != null) { userLogin.setHostId(hostId); if (!userLoginService.updateById(userLogin)) { throw new CoolException("修改商户失败"); } return R.ok(); } else { return R.error(); } } } zy-asrs-wms/src/main/java/com/zy/asrs/wms/system/controller/BaseController.java
@@ -1,16 +1,32 @@ package com.zy.asrs.wms.system.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.zy.asrs.common.domain.enums.LoginSystemType; import com.zy.asrs.wms.common.domain.BaseParam; import com.zy.asrs.wms.system.entity.Role; import com.zy.asrs.wms.system.entity.User; import com.zy.asrs.wms.system.entity.UserLogin; import com.zy.asrs.wms.system.service.UserLoginService; import com.zy.asrs.wms.system.service.UserRoleService; import com.zy.asrs.wms.system.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import java.util.List; import java.util.Map; /** * Created by vincent on 1/30/2024 */ public class BaseController { @Autowired private UserLoginService userLoginService; @Autowired private UserRoleService userRoleService; @Autowired private UserService userService; public User getLoginUser() { try { @@ -19,6 +35,11 @@ Object object = authentication.getPrincipal(); if (object instanceof User) { return (User) object; } if(object instanceof UserLogin) { UserLogin userLogin = (UserLogin) object; User user = userService.superGetById(userLogin.getUserId()); return user; } } } catch (Exception e) { @@ -34,7 +55,7 @@ public Long getHostId() { User loginUser = getLoginUser(); return loginUser == null ? null : loginUser.getHostId(); return loginUser.getHostId(); } public <T extends BaseParam> T buildParam(Map<String, Object> map, Class<T> clz) { zy-asrs-wms/src/main/java/com/zy/asrs/wms/system/controller/HostController.java
@@ -4,15 +4,21 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.zy.asrs.framework.common.Cools; import com.zy.asrs.framework.common.R; import com.zy.asrs.framework.exception.CoolException; import com.zy.asrs.wms.common.annotation.OperationLog; import com.zy.asrs.wms.common.domain.BaseParam; import com.zy.asrs.wms.common.domain.KeyValVo; import com.zy.asrs.wms.common.domain.PageParam; import com.zy.asrs.wms.system.entity.Host; import com.zy.asrs.wms.system.entity.Menu; import com.zy.asrs.wms.system.entity.RoleMenu; import com.zy.asrs.wms.system.service.HostService; import com.zy.asrs.wms.system.service.MenuService; import com.zy.asrs.wms.system.service.RoleMenuService; import com.zy.asrs.wms.utils.ExcelUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; @@ -24,6 +30,10 @@ @Autowired private HostService hostService; @Autowired private MenuService menuService; @Autowired private RoleMenuService roleMenuService; @PreAuthorize("hasAuthority('system:host:list')") @PostMapping("/host/page") @@ -48,12 +58,68 @@ @PreAuthorize("hasAuthority('system:host:save')") @OperationLog("添加机构") @PostMapping("/host/save") @Transactional public R save(@RequestBody Host host) { host.setCreateTime(new Date()); host.setUpdateTime(new Date()); if (!hostService.save(host)) { return R.error("添加失败"); } //创建系统默认菜单 Menu menu = new Menu(); menu.setName("系统管理"); menu.setParentId(0L); menu.setRoute("/system"); menu.setType(0); menu.setIcon("UserOutlined"); menu.setSort(1); menu.setLanguageId("system.system"); menu.setHostId(host.getId()); boolean save = menuService.save(menu); if (!save) { throw new CoolException("添加失败"); } List<Menu> menuList = menuService.selectByPathName("系统管理", 0); for (Menu menu1 : menuList) { menu1.setId(null); menu1.setHostId(host.getId()); menu1.setParentId(menu.getId()); boolean save1 = menuService.save(menu1); if (!save1) { throw new CoolException("添加失败"); } List<Menu> menuList2 = menuService.selectByPathName(menu1.getName(), 1); for (Menu menu2 : menuList2) { menu2.setId(null); menu2.setHostId(host.getId()); menu2.setParentId(menu1.getId()); boolean save2 = menuService.save(menu2); if (!save2) { throw new CoolException("添加失败"); } } } //创建默认权限 for (Menu menu1 : menuList) { RoleMenu roleMenu = new RoleMenu(); roleMenu.setRoleId(1L); roleMenu.setMenuId(menu1.getId()); boolean save1 = roleMenuService.save(roleMenu); if (!save1) { throw new CoolException("添加失败"); } } RoleMenu roleMenu = new RoleMenu(); roleMenu.setRoleId(1L); roleMenu.setMenuId(menu.getId()); boolean save1 = roleMenuService.save(roleMenu); if (!save1) { throw new CoolException("添加失败"); } return R.ok("添加成功"); } @@ -71,7 +137,32 @@ @PreAuthorize("hasAuthority('system:host:remove')") @OperationLog("删除机构") @PostMapping("/host/remove/{ids}") @Transactional public R remove(@PathVariable Long[] ids) { List<Host> list = hostService.list(new LambdaQueryWrapper<Host>().in(Host::getId, ids)); for (Host host : list) { if (host.getId() == 1) { throw new CoolException("根节点不可被删除"); } ArrayList<Long> menuIds = new ArrayList<>(); for (Menu menu : menuService.selectByHostId(host.getId())) { menuIds.add(menu.getId()); } if (!menuIds.isEmpty()) { boolean result = roleMenuService.remove(new LambdaQueryWrapper<RoleMenu>().in(RoleMenu::getMenuId, menuIds)); if (!result) { throw new CoolException("删除失败"); } boolean result1 = menuService.removeByHostId(host.getId()); if (!result1) { throw new CoolException("删除失败"); } } } if (!hostService.removeByIds(Arrays.asList(ids))) { return R.error("删除失败"); } zy-asrs-wms/src/main/java/com/zy/asrs/wms/system/entity/User.java
@@ -2,14 +2,13 @@ import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.zy.asrs.common.domain.enums.LoginSystemType; import com.zy.asrs.framework.common.Cools; import com.zy.asrs.framework.common.SpringUtils; import com.zy.asrs.wms.system.service.DeptService; import com.zy.asrs.wms.system.service.HostService; import com.zy.asrs.wms.system.service.UserRoleService; import com.zy.asrs.wms.system.service.UserService; import com.zy.asrs.wms.system.service.*; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import net.sf.jsqlparser.expression.LongValue; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.security.core.userdetails.UserDetails; @@ -357,4 +356,25 @@ return true; } public Long getHostId() { boolean root = false; UserRoleService userRoleService = SpringUtils.getBean(UserRoleService.class); UserLoginService userLoginService = SpringUtils.getBean(UserLoginService.class); List<Role> roles = userRoleService.listByUserId(this.id); for (Role role : roles) { if (role.getId() == 1) { root = true; break; } } if (root) { UserLogin userLogin = userLoginService.superFindByUserId(this.id, String.valueOf(LoginSystemType.WMS)); if (userLogin != null) { return userLogin.getHostId(); } } return this.hostId; } } zy-asrs-wms/src/main/java/com/zy/asrs/wms/system/mapper/MenuMapper.java
@@ -1,12 +1,24 @@ package com.zy.asrs.wms.system.mapper; import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import com.zy.asrs.wms.system.entity.Menu; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; import org.springframework.stereotype.Repository; import java.util.List; @Mapper @Repository public interface MenuMapper extends BaseMapper<Menu> { @InterceptorIgnore(tenantLine = "true") List<Menu> selectByPathName(String pathName, Integer type); @InterceptorIgnore(tenantLine = "true") List<Menu> selectByHostId(Long hostId); @InterceptorIgnore(tenantLine = "true") int removeByHostId(Long hostId); } zy-asrs-wms/src/main/java/com/zy/asrs/wms/system/mapper/RoleMenuMapper.java
@@ -15,7 +15,7 @@ public interface RoleMenuMapper extends BaseMapper<RoleMenu> { @InterceptorIgnore(tenantLine = "true") List<Menu> listMenuByUserId(@Param("userId") Long userId, @Param("type") Integer menuType); List<Menu> listMenuByUserId(@Param("userId") Long userId, @Param("type") Integer menuType, @Param("hostId") Long hostId); List<Long> listStrictlyMenuByRoleId(@Param("roleId") Long roleId); zy-asrs-wms/src/main/java/com/zy/asrs/wms/system/mapper/UserLoginMapper.java
@@ -1,5 +1,6 @@ package com.zy.asrs.wms.system.mapper; import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import com.zy.asrs.wms.system.entity.UserLogin; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; @@ -9,4 +10,7 @@ @Repository public interface UserLoginMapper extends BaseMapper<UserLogin> { @InterceptorIgnore(tenantLine = "true") // 忽略多租户拦截器 UserLogin superFindByUserId(Long userId, String system); } zy-asrs-wms/src/main/java/com/zy/asrs/wms/system/mapper/UserMapper.java
@@ -20,4 +20,7 @@ @InterceptorIgnore(tenantLine = "true") User selectByUsername(@Param("username") String username, @Param("hostId") Long hostId); @InterceptorIgnore(tenantLine = "true") User superGetById(@Param("id") Long id); } zy-asrs-wms/src/main/java/com/zy/asrs/wms/system/mapper/UserRoleMapper.java
@@ -1,5 +1,6 @@ package com.zy.asrs.wms.system.mapper; import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.zy.asrs.wms.system.entity.Role; import com.zy.asrs.wms.system.entity.UserRole; @@ -13,6 +14,7 @@ @Repository public interface UserRoleMapper extends BaseMapper<UserRole> { @InterceptorIgnore(tenantLine = "true") // 忽略多租户拦截器 List<Role> selectByUserId(@Param("userId") Long userId); } zy-asrs-wms/src/main/java/com/zy/asrs/wms/system/service/MenuService.java
@@ -3,6 +3,14 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.zy.asrs.wms.system.entity.Menu; import java.util.List; public interface MenuService extends IService<Menu> { List<Menu> selectByPathName(String pathName, Integer type); List<Menu> selectByHostId(Long hostId); boolean removeByHostId(Long hostId); } zy-asrs-wms/src/main/java/com/zy/asrs/wms/system/service/RoleMenuService.java
@@ -10,6 +10,8 @@ List<Menu> listMenuByUserId(Long userId, Integer menuType); List<Menu> listMenuByUserId(Long userId, Integer menuType, Long hostId); List<Long> listStrictlyMenuByRoleId(Long roleId); } zy-asrs-wms/src/main/java/com/zy/asrs/wms/system/service/UserLoginService.java
@@ -9,4 +9,6 @@ void saveAsync(Long userId, String token, Integer type, Long hostId, String memo, HttpServletRequest request); UserLogin superFindByUserId(Long userId, String system); } zy-asrs-wms/src/main/java/com/zy/asrs/wms/system/service/UserService.java
@@ -18,4 +18,6 @@ String encodePassword(String password); User superGetById(Long id); } zy-asrs-wms/src/main/java/com/zy/asrs/wms/system/service/impl/MenuServiceImpl.java
@@ -6,7 +6,24 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; import java.util.Collections; import java.util.List; @Service("menuService") public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements MenuService { @Override public List<Menu> selectByPathName(String pathName, Integer type) { return this.baseMapper.selectByPathName('%' + pathName + '%', type); } @Override public List<Menu> selectByHostId(Long hostId) { return this.baseMapper.selectByHostId(hostId); } @Override public boolean removeByHostId(Long hostId) { return this.baseMapper.removeByHostId(hostId) > 0; } } zy-asrs-wms/src/main/java/com/zy/asrs/wms/system/service/impl/RoleMenuServiceImpl.java
@@ -7,6 +7,7 @@ import com.zy.asrs.wms.system.service.RoleMenuService; import org.springframework.stereotype.Service; import java.util.Collections; import java.util.List; @Service("roleMenuService") @@ -14,7 +15,12 @@ @Override public List<Menu> listMenuByUserId(Long userId, Integer menuType) { return baseMapper.listMenuByUserId(userId, menuType); return baseMapper.listMenuByUserId(userId, menuType, null); } @Override public List<Menu> listMenuByUserId(Long userId, Integer menuType, Long hostId) { return baseMapper.listMenuByUserId(userId, menuType, hostId); } @Override zy-asrs-wms/src/main/java/com/zy/asrs/wms/system/service/impl/UserLoginServiceImpl.java
@@ -1,5 +1,6 @@ package com.zy.asrs.wms.system.service.impl; import com.zy.asrs.common.domain.enums.LoginSystemType; import com.zy.asrs.common.utils.IpTools; import com.zy.asrs.wms.system.mapper.UserLoginMapper; import com.zy.asrs.wms.system.entity.UserLogin; @@ -25,7 +26,13 @@ userLogin.setType(type); userLogin.setIp(IpTools.gainRealIp(request)); userLogin.setMemo(memo); userLogin.setSystem(String.valueOf(LoginSystemType.WMS)); userLogin.setHostId(hostId); baseMapper.insert(userLogin); } @Override public UserLogin superFindByUserId(Long userId, String system) { return this.baseMapper.superFindByUserId(userId, system); } } zy-asrs-wms/src/main/java/com/zy/asrs/wms/system/service/impl/UserServiceImpl.java
@@ -63,4 +63,8 @@ return password == null ? null : bCryptPasswordEncoder.encode(password); } @Override public User superGetById(Long id) { return this.baseMapper.superGetById(id); } } zy-asrs-wms/src/main/resources/mapper/system/MenuMapper.xml
@@ -2,4 +2,25 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.zy.asrs.wms.system.mapper.MenuMapper"> <select id="selectByPathName" resultType="com.zy.asrs.wms.system.entity.Menu"> select * from sys_menu where path_name like #{pathName} and type = #{type} and host_id = 1 and deleted = 0 order by id </select> <select id="selectByHostId" resultType="com.zy.asrs.wms.system.entity.Menu"> select * from sys_menu where host_id = #{hostId} and deleted = 0 order by id </select> <delete id="removeByHostId"> delete from sys_menu where host_id = #{hostId} </delete> </mapper> zy-asrs-wms/src/main/resources/mapper/system/RoleMenuMapper.xml
@@ -8,6 +8,9 @@ <if test="type != null"> AND type = #{type} </if> <if test="hostId != null"> AND host_id = #{hostId} </if> and deleted = 0 and id in ( select menu_id from sys_role_menu zy-asrs-wms/src/main/resources/mapper/system/UserLoginMapper.xml
@@ -2,4 +2,12 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.zy.asrs.wms.system.mapper.UserLoginMapper"> <select id="superFindByUserId" resultType="com.zy.asrs.wms.system.entity.UserLogin"> select * from sys_user_login where user_id = #{userId} and system = #{system} order by create_time desc limit 0,1 </select> </mapper> zy-asrs-wms/src/main/resources/mapper/system/UserMapper.xml
@@ -13,6 +13,13 @@ </if> </select> <select id="superGetById" resultType="com.zy.asrs.wms.system.entity.User"> select * from sys_user where 1=1 and deleted = 0 and id = #{id} </select> <select id="selectPageRel" resultType="com.zy.asrs.wms.system.entity.User"> select su.*