| | |
| | | package com.moon.server.config; |
| | | |
| | | import com.moon.server.entity.all.StaticData; |
| | | import com.moon.server.service.all.TestService; |
| | | import com.moon.server.service.all.UploadAttachService; |
| | | import com.moon.server.service.sys.ArgsService; |
| | | import com.moon.server.helper.GdalHelper; |
| | |
| | | @Resource |
| | | Environment env; |
| | | |
| | | //@Resource |
| | | //TestService testService; |
| | | @Resource |
| | | TestService testService; |
| | | |
| | | @Override |
| | | public void run(ApplicationArguments args) { |
| | |
| | | GdalHelper.init(env.getProperty("sys.gdal_path")); |
| | | UploadAttachService.init(env.getProperty("sys.attachTabs")); |
| | | |
| | | //testService.testRegister(); |
| | | //testService.testPerms(); |
| | | |
| | | pathHelper.init(); |
| | | StaticData.ADMIN = env.getProperty("sys.admin"); |
| | | argsService.initSettingData(); |
| | |
| | | package com.moon.server.controller.all; |
| | | |
| | | import com.moon.server.annotation.SysLog; |
| | | import com.moon.server.entity.data.LayerEntity; |
| | | import com.moon.server.entity.sys.MenuEntity; |
| | | import com.moon.server.entity.sys.ResEntity; |
| | | import com.moon.server.entity.sys.UserEntity; |
| | | import com.moon.server.service.all.PermsService; |
| | | import com.moon.server.service.data.LayerService; |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¥è¯¢å½åç¨æ·çèµæºææ") |
| | | @GetMapping(value = "/selectRes") |
| | | public ResponseMsg<List<ResAuthEntity>> selectRes(HttpServletRequest req) { |
| | | public ResponseMsg<Object> selectRes(HttpServletRequest req) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue == null) { |
| | |
| | | } |
| | | |
| | | String uid = StaticData.ADMIN.equals(ue.getUid()) ? null : ue.getUid(); |
| | | List<ResAuthEntity> rs = permsService.selectRes(uid); |
| | | List<ResEntity> rs = permsService.selectRes(uid); |
| | | |
| | | return success(rs); |
| | | } catch (Exception ex) { |
| | |
| | | |
| | | import com.moon.server.entity.all.MenusAuthEntity; |
| | | import com.moon.server.entity.all.PermsAuthEntity; |
| | | import com.moon.server.entity.all.ResAuthEntity; |
| | | import com.moon.server.entity.sys.MenuEntity; |
| | | import com.moon.server.entity.sys.ResEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | public List<ResAuthEntity> selectRes(String uid); |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·Uidæ¥è¯¢èµæºå表 |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | public List<ResEntity> selectResList(String uid); |
| | | public List<ResEntity> selectRes(String uid); |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·Uidæ¥è¯¢èåææ |
| | |
| | | RedisService redisService; |
| | | |
| | | @Override |
| | | public List<ResAuthEntity> selectRes(String uid) { |
| | | public List<ResEntity> selectRes(String uid) { |
| | | String key = RedisCacheKey.permsResKey(uid); |
| | | Object obj = redisService.get(key); |
| | | if (obj instanceof List<?>) { |
| | | return (List<ResAuthEntity>) obj; |
| | | } |
| | | |
| | | List<ResAuthEntity> list = permsMapper.selectRes(uid); |
| | | if (list != null && list.size() > 0) { |
| | | redisService.put(key, list, SettingData.CACHE_EXPIRE, TimeUnit.MINUTES); |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<ResEntity> selectResList(String uid) { |
| | | String key = RedisCacheKey.permsResListKey(uid); |
| | | Object obj = redisService.get(key); |
| | | if (obj instanceof List<?>) { |
| | | return (List<ResEntity>) obj; |
| | | } |
| | | |
| | | List<ResEntity> list = permsMapper.selectResList(uid); |
| | | List<ResEntity> list = permsMapper.selectRes(uid); |
| | | if (list != null && list.size() > 0) { |
| | | redisService.put(key, list, SettingData.CACHE_EXPIRE, TimeUnit.MINUTES); |
| | | } |
| | |
| | | |
| | | import com.moon.server.entity.all.MenusAuthEntity; |
| | | import com.moon.server.entity.all.PermsAuthEntity; |
| | | import com.moon.server.entity.all.ResAuthEntity; |
| | | import com.moon.server.entity.data.CoordEntity; |
| | | import com.moon.server.entity.data.MetaEntity; |
| | | import com.moon.server.entity.data.MetaFileEntity; |
| | | import com.moon.server.entity.sys.ResEntity; |
| | | import com.moon.server.helper.*; |
| | | import com.moon.server.service.data.MetaService; |
| | | import com.moon.server.service.data.UploadService; |
| | |
| | | } |
| | | |
| | | public void testPerms() { |
| | | List<ResAuthEntity> raeList = permsService.selectRes("admin"); |
| | | List<ResAuthEntity> raeList2 = permsService.selectRes("admin"); |
| | | List<ResEntity> raeList = permsService.selectRes("admin"); |
| | | List<ResEntity> raeList2 = permsService.selectRes("admin"); |
| | | |
| | | List<MenusAuthEntity> maeList = permsService.selectMenus("admin"); |
| | | List<MenusAuthEntity> maeList2 = permsService.selectMenus("admin"); |
| | |
| | | */ |
| | | private ResEntity getResEntity(UserEntity ue, int resId) { |
| | | String uid = StaticData.ADMIN.equals(ue.getUid()) ? null : ue.getUid(); |
| | | List<ResEntity> rs = permsService.selectResList(uid); |
| | | List<ResEntity> rs = permsService.selectRes(uid); |
| | | if (null == rs || rs.isEmpty()) { |
| | | return null; |
| | | } |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.moon.server.mapper.all.PermsMapper"> |
| | | <select id="selectRes" resultType="com.moon.server.entity.all.ResAuthEntity"> |
| | | select distinct d.id, d.name, d.url, d.proxy |
| | | <select id="selectRes" resultType="com.moon.server.entity.sys.ResEntity"> |
| | | select distinct d.* |
| | | from lf.sys_user a |
| | | inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_res c on b.roleid = c.roleid |
| | |
| | | and a.uid = #{uid} |
| | | </if> |
| | | </where> |
| | | order by d.id |
| | | order by d.id; |
| | | </select> |
| | | |
| | | <select id="selectResList" resultType="com.moon.server.entity.sys.ResEntity"> |
| | | select distinct d.* |
| | | from lf.sys_user a |
| | | inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_res c on b.roleid = c.roleid |
| | | inner join lf.sys_res d on c.resid = d.id |
| | | <where> |
| | | d.status = 1 |
| | | <if test="uid != null"> |
| | | and a.uid = #{uid} |
| | | </if> |
| | | </where> |
| | | order by d.id |
| | | </select> |
| | | |
| | | ` |
| | | <select id="selectMenus" resultType="com.moon.server.entity.all.MenusAuthEntity"> |
| | | select distinct e.id,e.pid,e.cn_name,e.en_name,e.url,e.perms,e.type,e.css,e.icon,e.level,e.order_num,e.is_show |
| | | from lf.sys_user a |