| | |
| | | select a.*,b.menuid,c.name from lf.sys_role_menu_auth a inner join lf.sys_menu_auth b on a.menu_auth_id = b.id |
| | | inner join lf.sys_auth c on b.authid = c.id where a.roleid = 1 and b.menuid = 1 order by c.id; |
| | | ----------------------------------------------------------------------------------------------------- |
| | | select * from lf.sys_user; |
| | | select gid,gb,name,st_astext(a.geom) from bd.dlg_agnp a; |
| | | select * from lf.sys_menu; |
| | | |
| | | -- æ ¹æ®ç¨æ·Uidæ¥è¯¢èµæº |
| | | select distinct d.id,d.name,d.server 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 a.uid = 'admin'; |
| | | |
| | | -- æ ¹æ®ç¨æ·Uidæ¥è¯¢èå |
| | | select distinct e.id,e.pid,e.cn_name,e.en_name,e.url,e.type,e.icon,e.level,e.order_num,e.is_show |
| | | from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_menu_auth c on b.roleid = c.roleid |
| | | inner join lf.sys_menu_auth d on c.menu_auth_id = d.id |
| | | inner join lf.sys_menu e on d.menuid = e.id |
| | | where a.uid = 'admin'; |
| | | |
| | | -- æ ¹æ®ç¨æ·Uidæ¥è¯¢æé |
| | | select distinct f.id,e.cn_name,f.name,e.perms,f.tag |
| | | from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_menu_auth c on b.roleid = c.roleid |
| | | inner join lf.sys_menu_auth d on c.menu_auth_id = d.id |
| | | inner join lf.sys_menu e on d.menuid = e.id |
| | | inner join lf.sys_auth f on d.authid = f.id |
| | | where a.uid = 'admin'; |
| | | |
| | | |
| | | -- æ ¹æ®ç¨æ·Uidæ¥è¯¢æé2 |
| | | select distinct e.perms || f.tag as "perms" |
| | | from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_menu_auth c on b.roleid = c.roleid |
| | | inner join lf.sys_menu_auth d on c.menu_auth_id = d.id |
| | | inner join lf.sys_menu e on d.menuid = e.id |
| | | inner join lf.sys_auth f on d.authid = f.id |
| | | where a.uid = 'admin'; |
| | | |
| | | |
| | | |
| | |
| | | comment on column lf.sys_auth.update_user is 'æ´æ°äººID'; |
| | | comment on column lf.sys_auth.update_time is 'æ´æ°æ¶é´'; |
| | | comment on column lf.sys_auth.bak is '夿³¨'; |
| | | /* insert into lf.sys_auth (name,tag) values ('æ¥ç','select'); |
| | | insert into lf.sys_auth (name,tag) values ('æ°å¢','insert'); |
| | | insert into lf.sys_auth (name,tag) values ('ä¿®æ¹','update'); |
| | | insert into lf.sys_auth (name,tag) values ('å é¤','delete'); |
| | | insert into lf.sys_auth (name,tag) values ('ä¸ä¼ ','upload'); |
| | | insert into lf.sys_auth (name,tag) values ('ä¸è½½','download'); |
| | | insert into lf.sys_auth (name,tag) values ('ç»è®¡','count'); */ |
| | | /* insert into lf.sys_auth (name,tag) values ('æ¥ç','/select'); |
| | | insert into lf.sys_auth (name,tag) values ('æ°å¢','/insert'); |
| | | insert into lf.sys_auth (name,tag) values ('ä¿®æ¹','/update'); |
| | | insert into lf.sys_auth (name,tag) values ('å é¤','/delete'); |
| | | insert into lf.sys_auth (name,tag) values ('ä¸ä¼ ','/upload'); |
| | | insert into lf.sys_auth (name,tag) values ('ä¸è½½','/download'); |
| | | insert into lf.sys_auth (name,tag) values ('ç»è®¡','/count'); */ |
| | | |
| | | select * from lf.sys_auth; |
| | | ----------------------------------------------------------------------------------------------------- 11.è§è²è¡¨ |
| | |
| | | --insert into lf.sys_menu_auth (menuid,authid) values (1,1),(1,2),(1,3),(1,4),(1,5); |
| | | |
| | | select * from lf.sys_menu_auth; |
| | | ----------------------------------------------------------------------------------------------------- 14.è§è²-èå-æé表 |
| | | ----------------------------------------------------------------------------------------------------- 15.è§è²-èå-æé表 |
| | | -- DROP TABLE IF EXISTS lf.sys_role_menu_auth; |
| | | create table lf.sys_role_menu_auth( |
| | | id serial primary key, |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.lf.server.controller.all; |
| | | |
| | | import com.lf.server.aspect.SysLog; |
| | | import com.lf.server.entity.all.MenusAuthEntity; |
| | | import com.lf.server.entity.all.PermsAuthEntity; |
| | | import com.lf.server.entity.all.ResAuthEntity; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.service.all.PermsService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æææ§å¶å¨ |
| | | * @author WWW |
| | | */ |
| | | @Api(tags = "è¿ç»´ç®¡ç\\ææç®¡ç") |
| | | @RestController |
| | | @RequestMapping("/file") |
| | | public class PermsController extends BaseController { |
| | | @Autowired |
| | | PermsService permsService; |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ ¹æ®ç¨æ·Uidæ¥è¯¢èµæºææ") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "uid", value = "ç¨æ·Uid", dataType = "String", paramType = "query", example = "admin") |
| | | }) |
| | | @GetMapping(value = "/selectRes") |
| | | public ResponseMsg<List<ResAuthEntity>> selectRes(String uid) { |
| | | try { |
| | | List<ResAuthEntity> rs = permsService.selectRes(uid); |
| | | |
| | | return success(rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ ¹æ®ç¨æ·Uidæ¥è¯¢èåææ") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "uid", value = "ç¨æ·Uid", dataType = "String", paramType = "query", example = "admin") |
| | | }) |
| | | @GetMapping(value = "/selectMenus") |
| | | public ResponseMsg<List<MenusAuthEntity>> selectMenus(String uid) { |
| | | try { |
| | | List<MenusAuthEntity> rs = permsService.selectMenus(uid); |
| | | |
| | | return success(rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ ¹æ®ç¨æ·Uidæ¥è¯¢æéææ") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "uid", value = "ç¨æ·Uid", dataType = "String", paramType = "query", example = "admin") |
| | | }) |
| | | @GetMapping(value = "/selectPerms") |
| | | public ResponseMsg<List<PermsAuthEntity>> selectPerms(String uid) { |
| | | try { |
| | | List<PermsAuthEntity> rs = permsService.selectPerms(uid); |
| | | |
| | | return success(rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ ¹æ®ç¨æ·Uidæ¥è¯¢æéææ2") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "uid", value = "ç¨æ·Uid", dataType = "String", paramType = "query", example = "admin") |
| | | }) |
| | | @GetMapping(value = "/selectPerms2") |
| | | public ResponseMsg<List<String>> selectPerms2(String uid) { |
| | | try { |
| | | List<String> rs = permsService.selectPerms2(uid); |
| | | |
| | | return success(rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.lf.server.entity.all; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * èåææ |
| | | * @author WWW |
| | | */ |
| | | public class MenusAuthEntity implements Serializable { |
| | | private static final long serialVersionUID = -944664756113218L; |
| | | |
| | | private Integer id; |
| | | |
| | | private Integer pid; |
| | | |
| | | private String cnName; |
| | | |
| | | private String enName; |
| | | |
| | | private String url; |
| | | |
| | | private Integer type; |
| | | |
| | | private String icon; |
| | | |
| | | private Integer level; |
| | | |
| | | private Integer orderNum; |
| | | |
| | | private Integer isShow; |
| | | |
| | | public MenusAuthEntity() { |
| | | |
| | | } |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getPid() { |
| | | return pid; |
| | | } |
| | | |
| | | public void setPid(Integer pid) { |
| | | this.pid = pid; |
| | | } |
| | | |
| | | public String getCnName() { |
| | | return cnName; |
| | | } |
| | | |
| | | public void setCnName(String cnName) { |
| | | this.cnName = cnName; |
| | | } |
| | | |
| | | public String getEnName() { |
| | | return enName; |
| | | } |
| | | |
| | | public void setEnName(String enName) { |
| | | this.enName = enName; |
| | | } |
| | | |
| | | public String getUrl() { |
| | | return url; |
| | | } |
| | | |
| | | public void setUrl(String url) { |
| | | this.url = url; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getIcon() { |
| | | return icon; |
| | | } |
| | | |
| | | public void setIcon(String icon) { |
| | | this.icon = icon; |
| | | } |
| | | |
| | | public Integer getLevel() { |
| | | return level; |
| | | } |
| | | |
| | | public void setLevel(Integer level) { |
| | | this.level = level; |
| | | } |
| | | |
| | | public Integer getOrderNum() { |
| | | return orderNum; |
| | | } |
| | | |
| | | public void setOrderNum(Integer orderNum) { |
| | | this.orderNum = orderNum; |
| | | } |
| | | |
| | | public Integer getIsShow() { |
| | | return isShow; |
| | | } |
| | | |
| | | public void setIsShow(Integer isShow) { |
| | | this.isShow = isShow; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.lf.server.entity.all; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * æéææ |
| | | * @author WWW |
| | | */ |
| | | public class PermsAuthEntity implements Serializable { |
| | | private static final long serialVersionUID = -8948994757253139554L; |
| | | |
| | | private Integer id; |
| | | |
| | | private String cnName; |
| | | |
| | | private String name; |
| | | |
| | | private String perms; |
| | | |
| | | private String tag; |
| | | |
| | | public PermsAuthEntity() { |
| | | |
| | | } |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getCnName() { |
| | | return cnName; |
| | | } |
| | | |
| | | public void setCnName(String cnName) { |
| | | this.cnName = cnName; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getPerms() { |
| | | return perms; |
| | | } |
| | | |
| | | public void setPerms(String perms) { |
| | | this.perms = perms; |
| | | } |
| | | |
| | | public String getTag() { |
| | | return tag; |
| | | } |
| | | |
| | | public void setTag(String tag) { |
| | | this.tag = tag; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.lf.server.entity.all; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * èµæºææ |
| | | * @author WWW |
| | | */ |
| | | public class ResAuthEntity implements Serializable { |
| | | private static final long serialVersionUID = 7610553267313397837L; |
| | | |
| | | private Integer id; |
| | | |
| | | private String name; |
| | | |
| | | private String server; |
| | | |
| | | public ResAuthEntity() { |
| | | |
| | | } |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getServer() { |
| | | return server; |
| | | } |
| | | |
| | | public void setServer(String server) { |
| | | this.server = server; |
| | | } |
| | | } |
| | |
| | | * @throws Exception |
| | | */ |
| | | private static byte[] aesEncryptToBytes(String content, String encryptKey) throws Exception { |
| | | //KeyGenerator kGen = KeyGenerator.getInstance(KEY_ALGORITHM); |
| | | //kGen.init(128); |
| | | // KeyGenerator kGen = KeyGenerator.getInstance(KEY_ALGORITHM) |
| | | // kGen.init(128) |
| | | |
| | | Cipher cipher = Cipher.getInstance(ALGORITHMSTR); |
| | | cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(encryptKey.getBytes(), KEY_ALGORITHM)); |
| | |
| | | * @throws Exception |
| | | */ |
| | | private static String aesDecryptByBytes(byte[] encryptBytes, String decryptKey) throws Exception { |
| | | //KeyGenerator kGen = KeyGenerator.getInstance(KEY_ALGORITHM); |
| | | //kGen.init(128); |
| | | // KeyGenerator kGen = KeyGenerator.getInstance(KEY_ALGORITHM) |
| | | // kGen.init(128) |
| | | |
| | | Cipher cipher = Cipher.getInstance(ALGORITHMSTR); |
| | | cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(decryptKey.getBytes(), KEY_ALGORITHM)); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.lf.server.mapper.all; |
| | | |
| | | import com.lf.server.entity.all.MenusAuthEntity; |
| | | import com.lf.server.entity.all.PermsAuthEntity; |
| | | import com.lf.server.entity.all.ResAuthEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ææç®¡ç |
| | | * @author WWW |
| | | */ |
| | | @Mapper |
| | | @Repository |
| | | public interface PermsMapper { |
| | | /** |
| | | * æ ¹æ®ç¨æ·Uidæ¥è¯¢èµæºææ |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | public List<ResAuthEntity> selectRes(String uid); |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·Uidæ¥è¯¢èåææ |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | public List<MenusAuthEntity> selectMenus(String uid); |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·Uidæ¥è¯¢æéææ |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | public List<PermsAuthEntity> selectPerms(String uid); |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·Uidæ¥è¯¢æéææ2 |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | public List<String> selectPerms2(String uid); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.lf.server.service.all; |
| | | |
| | | import com.lf.server.entity.all.MenusAuthEntity; |
| | | import com.lf.server.entity.all.PermsAuthEntity; |
| | | import com.lf.server.entity.all.ResAuthEntity; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.mapper.all.PermsMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æææå¡ |
| | | * @author WWW |
| | | */ |
| | | @Service |
| | | public class PermsService implements PermsMapper { |
| | | @Autowired |
| | | PermsMapper permsMapper; |
| | | |
| | | @Override |
| | | public List<ResAuthEntity> selectRes(String uid) { |
| | | if (StringHelper.isEmpty(uid)) { |
| | | return null; |
| | | } |
| | | |
| | | return permsMapper.selectRes(uid); |
| | | } |
| | | |
| | | @Override |
| | | public List<MenusAuthEntity> selectMenus(String uid) { |
| | | if (StringHelper.isEmpty(uid)) { |
| | | return null; |
| | | } |
| | | |
| | | return permsMapper.selectMenus(uid); |
| | | } |
| | | |
| | | @Override |
| | | public List<PermsAuthEntity> selectPerms(String uid) { |
| | | if (StringHelper.isEmpty(uid)) { |
| | | return null; |
| | | } |
| | | |
| | | return permsMapper.selectPerms(uid); |
| | | } |
| | | |
| | | @Override |
| | | public List<String> selectPerms2(String uid) { |
| | | if (StringHelper.isEmpty(uid)) { |
| | | return null; |
| | | } |
| | | |
| | | return permsMapper.selectPerms2(uid); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.lf.server.mapper.all.PermsMapper"> |
| | | <select id="selectRes" resultType="com.lf.server.entity.all.ResAuthEntity"> |
| | | select distinct d.id,d.name,d.server 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 a.uid = #{uid} |
| | | </select> |
| | | |
| | | <select id="selectMenus" resultType="com.lf.server.entity.all.MenusAuthEntity"> |
| | | select distinct e.id,e.pid,e.cn_name,e.en_name,e.url,e.type,e.icon,e.level,e.order_num,e.is_show |
| | | from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_menu_auth c on b.roleid = c.roleid |
| | | inner join lf.sys_menu_auth d on c.menu_auth_id = d.id |
| | | inner join lf.sys_menu e on d.menuid = e.id |
| | | where a.uid = #{uid} |
| | | </select> |
| | | |
| | | <select id="selectPerms" resultType="com.lf.server.entity.all.PermsAuthEntity"> |
| | | select distinct f.id,e.cn_name,f.name,e.perms,f.tag |
| | | from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_menu_auth c on b.roleid = c.roleid |
| | | inner join lf.sys_menu_auth d on c.menu_auth_id = d.id |
| | | inner join lf.sys_menu e on d.menuid = e.id |
| | | inner join lf.sys_auth f on d.authid = f.id |
| | | where a.uid = #{uid} |
| | | </select> |
| | | |
| | | <select id="selectPerms2" resultType="java.lang.String"> |
| | | select distinct e.perms || f.tag as "perms" |
| | | from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_menu_auth c on b.roleid = c.roleid |
| | | inner join lf.sys_menu_auth d on c.menu_auth_id = d.id |
| | | inner join lf.sys_menu e on d.menuid = e.id |
| | | inner join lf.sys_auth f on d.authid = f.id |
| | | where a.uid = #{uid} |
| | | </select> |
| | | </mapper> |