正在显示
9 个修改的文件
包含
136 行增加
和
9 行删除
@@ -2,10 +2,12 @@ | @@ -2,10 +2,12 @@ | ||
2 | web: | 2 | web: |
3 | upload-path: upload/ | 3 | upload-path: upload/ |
4 | server: | 4 | server: |
5 | - port: 8002 | 5 | + port: 8066 |
6 | servlet: | 6 | servlet: |
7 | context-path: ${SERVER_CONTEXTPATH:} | 7 | context-path: ${SERVER_CONTEXTPATH:} |
8 | spring: | 8 | spring: |
9 | + devtools: | ||
10 | + add-properties: false | ||
9 | profiles: | 11 | profiles: |
10 | active: dev | 12 | active: dev |
11 | mvc: | 13 | mvc: |
@@ -17,7 +19,7 @@ spring: | @@ -17,7 +19,7 @@ spring: | ||
17 | static-locations: classpath:/META-INF/resources/,classpath:/static,classpath:/resources/,file:${web.upload-path} | 19 | static-locations: classpath:/META-INF/resources/,classpath:/static,classpath:/resources/,file:${web.upload-path} |
18 | 20 | ||
19 | application: | 21 | application: |
20 | - name: hqpt-user-center | 22 | + name: cloud-user-center |
21 | redis: | 23 | redis: |
22 | host: 192.168.1.53 | 24 | host: 192.168.1.53 |
23 | port: 6379 | 25 | port: 6379 |
@@ -50,10 +52,10 @@ spring: | @@ -50,10 +52,10 @@ spring: | ||
50 | #username=CGOETL | 52 | #username=CGOETL |
51 | #password=1q2w3e4r | 53 | #password=1q2w3e4r |
52 | #spring datasource mysql,注意编码配置,缺少数据库编码配置容易引起中文入库乱码 | 54 | #spring datasource mysql,注意编码配置,缺少数据库编码配置容易引起中文入库乱码 |
53 | - url: jdbc:mysql://118.31.66.166:3306/HQPT_USER?useUnicode=true&characterEncoding=utf8 | 55 | + url: jdbc:mysql://118.31.66.166:3306/statistics?useUnicode=true&characterEncoding=utf8 |
54 | username: 110 | 56 | username: 110 |
55 | password: QAHqCJf2kFYCLirM | 57 | password: QAHqCJf2kFYCLirM |
56 | - driver-class-name: com.mysql.jdbc.Driver | 58 | + driver-class-name: com.mysql.cj.jdbc.Driver |
57 | max-idle: 10 | 59 | max-idle: 10 |
58 | max-wait: 10000 | 60 | max-wait: 10000 |
59 | min-idle: 5 | 61 | min-idle: 5 |
@@ -85,16 +87,29 @@ eureka: | @@ -85,16 +87,29 @@ eureka: | ||
85 | prefer-ip-address: true | 87 | prefer-ip-address: true |
86 | instance-id: ${spring.cloud.client.ip-address}:${server.port} | 88 | instance-id: ${spring.cloud.client.ip-address}:${server.port} |
87 | hostname: ${spring.cloud.client.ip-address} | 89 | hostname: ${spring.cloud.client.ip-address} |
90 | + lease-renewal-interval-in-seconds: 15 | ||
91 | + lease-expiration-duration-in-seconds: 45 | ||
92 | + health-check-url-path: /actuator/health | ||
88 | client: | 93 | client: |
89 | #eureka注册中心服务器地址 | 94 | #eureka注册中心服务器地址 |
90 | service-url: | 95 | service-url: |
91 | defaultZone: http://192.168.1.53:12345/eureka/ | 96 | defaultZone: http://192.168.1.53:12345/eureka/ |
92 | registry-fetch-interval-seconds: 30 | 97 | registry-fetch-interval-seconds: 30 |
93 | - lease-renewal-interval-in-seconds: 15 | ||
94 | - lease-expiration-duration-in-seconds: 45 | ||
95 | 98 | ||
96 | 99 | ||
97 | 100 | ||
101 | +management: | ||
102 | + endpoints: | ||
103 | + enabled-by-default: true | ||
104 | + web: | ||
105 | + exposure: | ||
106 | + include: "*" | ||
107 | + endpoint: | ||
108 | + health: | ||
109 | + show-details: always | ||
110 | + shutdown: | ||
111 | + enabled: true | ||
112 | + | ||
98 | mybatis: | 113 | mybatis: |
99 | mapper-locations: classpath:mapping/*.xml | 114 | mapper-locations: classpath:mapping/*.xml |
100 | type-aliases-package: com.tianbo.warehouse.model | 115 | type-aliases-package: com.tianbo.warehouse.model |
@@ -125,3 +140,7 @@ logging: | @@ -125,3 +140,7 @@ logging: | ||
125 | #Java Web Token 时效时间,单位秒 | 140 | #Java Web Token 时效时间,单位秒 |
126 | jwt: | 141 | jwt: |
127 | max-alive: 30000 | 142 | max-alive: 30000 |
143 | + | ||
144 | +info: | ||
145 | + version: 2.0 | ||
146 | + description: "具有公司及部门管理级别的用户管理中心" |
docker/Dockerfile
0 → 100644
1 | +FROM java:8u111 | ||
2 | +VOLUME /tmp | ||
3 | + | ||
4 | +ENV PINPOINT_VERSION="2.3.1" | ||
5 | +ENV AGENT_ID="usercenter-master1.0" | ||
6 | +ENV APP_NAME="usercenter-master" | ||
7 | +ENV JAVA_OPTS="-javaagent:/pinpoint-agent/pinpoint-bootstrap-${PINPOINT_VERSION}.jar -Dpinpoint.agentId=${AGENT_ID} -Dpinpoint.applicationName=${APP_NAME} -Dspring.profiles.active=${SPRING_PROFILES}" | ||
8 | + | ||
9 | +ADD *.jar app.jar | ||
10 | +EXPOSE 8066 | ||
11 | +RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | ||
12 | +RUN echo "Asia/Shanghai" > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata | ||
13 | +#ENTRYPOINT ["java","$JAVA_OPTS","-jar","/app.jar"] | ||
14 | +ENTRYPOINT java $JAVA_OPTS -jar /app.jar | ||
15 | +# Ubuntu 时区 | ||
16 | + |
@@ -289,6 +289,22 @@ | @@ -289,6 +289,22 @@ | ||
289 | <verbose>true</verbose> | 289 | <verbose>true</verbose> |
290 | </configuration> | 290 | </configuration> |
291 | </plugin> | 291 | </plugin> |
292 | + <plugin> | ||
293 | + <artifactId>maven-antrun-plugin</artifactId> | ||
294 | + <executions> <execution> | ||
295 | + <id>gen-webadmin</id> | ||
296 | + <phase>package</phase> | ||
297 | + <configuration> | ||
298 | + <tasks> | ||
299 | + <copy todir="docker" file="target/${project.artifactId}-${project.version}.${project.packaging}" /> | ||
300 | + </tasks> | ||
301 | + </configuration> | ||
302 | + <goals> | ||
303 | + <goal>run</goal> | ||
304 | + </goals> | ||
305 | + </execution> | ||
306 | + </executions> | ||
307 | + </plugin> | ||
292 | </plugins> | 308 | </plugins> |
293 | </build> | 309 | </build> |
294 | 310 |
@@ -94,4 +94,11 @@ public class PermssionController { | @@ -94,4 +94,11 @@ public class PermssionController { | ||
94 | } | 94 | } |
95 | return resultJson; | 95 | return resultJson; |
96 | } | 96 | } |
97 | + | ||
98 | + @GetMapping("/userMenu") | ||
99 | + public ResultJson<List<PERMISSION>> userMenu( | ||
100 | + @RequestParam(value = "userId", required = true) Integer userId){ | ||
101 | + return new ResultJson<List<PERMISSION>>("200","success",permissionService.getUserMenuTreeByUserId(userId)); | ||
102 | + | ||
103 | + } | ||
97 | } | 104 | } |
@@ -25,7 +25,11 @@ public interface PERMISSIONMapper { | @@ -25,7 +25,11 @@ public interface PERMISSIONMapper { | ||
25 | 25 | ||
26 | List<PERMISSION> findByUserId(Integer userId); | 26 | List<PERMISSION> findByUserId(Integer userId); |
27 | 27 | ||
28 | + List<PERMISSION> getUserMenuTreeByUserId(Integer userId); | ||
29 | + | ||
30 | + List<PERMISSION> getChildMenu(Integer parentId); | ||
31 | + | ||
28 | List<String> findRoleListByUrl(String permissionUrl); | 32 | List<String> findRoleListByUrl(String permissionUrl); |
29 | 33 | ||
30 | List<PERMISSION> getRolePermisson(Integer roleId); | 34 | List<PERMISSION> getRolePermisson(Integer roleId); |
31 | -} | ||
35 | +} |
1 | package com.tianbo.warehouse.model; | 1 | package com.tianbo.warehouse.model; |
2 | 2 | ||
3 | +import lombok.Data; | ||
4 | + | ||
3 | import java.util.List; | 5 | import java.util.List; |
4 | 6 | ||
7 | +@Data | ||
5 | public class PERMISSION { | 8 | public class PERMISSION { |
6 | private Integer permissionId; | 9 | private Integer permissionId; |
7 | 10 | ||
@@ -120,4 +123,4 @@ public class PERMISSION { | @@ -120,4 +123,4 @@ public class PERMISSION { | ||
120 | public void setChildren(List<PERMISSION> children) { | 123 | public void setChildren(List<PERMISSION> children) { |
121 | this.children = children; | 124 | this.children = children; |
122 | } | 125 | } |
123 | -} | ||
126 | +} |
@@ -23,4 +23,11 @@ public interface PermissionService { | @@ -23,4 +23,11 @@ public interface PermissionService { | ||
23 | int updateByPrimaryKeySelective(PERMISSION permission); | 23 | int updateByPrimaryKeySelective(PERMISSION permission); |
24 | 24 | ||
25 | int deleteByPrimaryKey(String companyId); | 25 | int deleteByPrimaryKey(String companyId); |
26 | + | ||
27 | + /** | ||
28 | + * 用户菜单树形 | ||
29 | + * @param userId | ||
30 | + * @return | ||
31 | + */ | ||
32 | + List<PERMISSION> getUserMenuTreeByUserId(Integer userId); | ||
26 | } | 33 | } |
@@ -10,12 +10,13 @@ import com.tianbo.warehouse.service.PermissionService; | @@ -10,12 +10,13 @@ import com.tianbo.warehouse.service.PermissionService; | ||
10 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
11 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
12 | 12 | ||
13 | +import javax.annotation.Resource; | ||
13 | import java.util.*; | 14 | import java.util.*; |
14 | 15 | ||
15 | @Service("PermissionService") | 16 | @Service("PermissionService") |
16 | public class PermissionServiceImp implements PermissionService{ | 17 | public class PermissionServiceImp implements PermissionService{ |
17 | 18 | ||
18 | - @Autowired | 19 | + @Resource |
19 | PERMISSIONMapper permissionMapper; | 20 | PERMISSIONMapper permissionMapper; |
20 | 21 | ||
21 | @Override | 22 | @Override |
@@ -121,4 +122,8 @@ public class PermissionServiceImp implements PermissionService{ | @@ -121,4 +122,8 @@ public class PermissionServiceImp implements PermissionService{ | ||
121 | } | 122 | } |
122 | } | 123 | } |
123 | 124 | ||
125 | + @Override | ||
126 | + public List<PERMISSION> getUserMenuTreeByUserId(Integer userId) { | ||
127 | + return permissionMapper.getUserMenuTreeByUserId(userId); | ||
128 | + } | ||
124 | } | 129 | } |
@@ -15,6 +15,9 @@ | @@ -15,6 +15,9 @@ | ||
15 | <result column="iconCls" property="iconCls" jdbcType="VARCHAR" /> | 15 | <result column="iconCls" property="iconCls" jdbcType="VARCHAR" /> |
16 | <result column="component" property="component" jdbcType="VARCHAR" /> | 16 | <result column="component" property="component" jdbcType="VARCHAR" /> |
17 | </resultMap> | 17 | </resultMap> |
18 | + <resultMap id="treeMap" type="com.tianbo.warehouse.model.PERMISSION" extends="BaseResultMap"> | ||
19 | + <collection property="children" ofType="com.tianbo.warehouse.model.PERMISSION" javaType="java.util.ArrayList" column="permission_id" select="getChildMenu"></collection> | ||
20 | + </resultMap> | ||
18 | <sql id="Base_Column_List" > | 21 | <sql id="Base_Column_List" > |
19 | permission_id, name, permission_order, description, ismenu,hidden,parent_id, | 22 | permission_id, name, permission_order, description, ismenu,hidden,parent_id, |
20 | path, url, method, iconCls, component | 23 | path, url, method, iconCls, component |
@@ -112,6 +115,53 @@ where P.url = #{permissionUrl,jdbcType=VARCHAR} ORDER BY permission_order | @@ -112,6 +115,53 @@ where P.url = #{permissionUrl,jdbcType=VARCHAR} ORDER BY permission_order | ||
112 | ) | 115 | ) |
113 | ) ORDER BY permission_order | 116 | ) ORDER BY permission_order |
114 | </select> | 117 | </select> |
118 | + <select id="getUserMenuTreeByUserId" parameterType="java.lang.Integer" resultMap="treeMap"> | ||
119 | + SELECT | ||
120 | + P.* | ||
121 | + FROM | ||
122 | + permission P | ||
123 | + WHERE | ||
124 | + parent_id = 0 | ||
125 | + AND | ||
126 | + ismenu = 1 | ||
127 | + AND | ||
128 | + P.permission_id IN ( | ||
129 | + SELECT | ||
130 | + RP.permission_id | ||
131 | + FROM | ||
132 | + role_permission RP | ||
133 | + WHERE | ||
134 | + RP.role_id IN ( | ||
135 | + SELECT | ||
136 | + R.role_id | ||
137 | + FROM | ||
138 | + role R | ||
139 | + WHERE | ||
140 | + R.role_id IN ( | ||
141 | + SELECT | ||
142 | + UR.role_id | ||
143 | + FROM | ||
144 | + user_role UR | ||
145 | + WHERE | ||
146 | + UR.user_id = #{userId,jdbcType=INTEGER} | ||
147 | + ) | ||
148 | + ) | ||
149 | + ) | ||
150 | + ORDER BY | ||
151 | + permission_order | ||
152 | + </select> | ||
153 | + <select id="getChildMenu" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | ||
154 | + SELECT | ||
155 | + * | ||
156 | + FROM | ||
157 | + permission | ||
158 | + WHERE | ||
159 | + ismenu = 1 | ||
160 | + AND | ||
161 | + parent_id = #{parentId,jdbcType=INTEGER} | ||
162 | + ORDER BY | ||
163 | + permission_order | ||
164 | + </select> | ||
115 | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > | 165 | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > |
116 | delete from permission | 166 | delete from permission |
117 | where permission_id = #{permissionId,jdbcType=INTEGER} | 167 | where permission_id = #{permissionId,jdbcType=INTEGER} |
-
请 注册 或 登录 后发表评论