Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dm_project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姚本章
dm_project
Commits
9f2f8553
Commit
9f2f8553
authored
Nov 24, 2020
by
DESKTOP-5KITOLR\Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
manage框架构建
parent
5e8bcf35
Changes
27
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
2051 additions
and
1 deletion
+2051
-1
pom.xml
jz-dm-manage/pom.xml
+117
-1
DelFlagEnum.java
...e/src/main/java/com/jz/manage/admin/Enum/DelFlagEnum.java
+52
-0
BaseController.java
...n/java/com/jz/manage/admin/controller/BaseController.java
+13
-0
UserController.java
...n/java/com/jz/manage/admin/controller/UserController.java
+30
-0
UserMapper.java
...age/src/main/java/com/jz/manage/admin/dao/UserMapper.java
+11
-0
UserService.java
...rc/main/java/com/jz/manage/admin/service/UserService.java
+9
-0
UserServiceImpl.java
...ava/com/jz/manage/admin/service/impl/UserServiceImpl.java
+35
-0
CommonsUtil.java
...src/main/java/com/jz/manage/commonsUtils/CommonsUtil.java
+46
-0
LoginUntil.java
.../src/main/java/com/jz/manage/commonsUtils/LoginUntil.java
+35
-0
RedisUntil.java
.../src/main/java/com/jz/manage/commonsUtils/RedisUntil.java
+568
-0
SpringApplicationProvider.java
...com/jz/manage/commonsUtils/SpringApplicationProvider.java
+65
-0
VerifyUtil.java
.../src/main/java/com/jz/manage/commonsUtils/VerifyUtil.java
+82
-0
SysOperaterLog.java
.../com/jz/manage/commonsUtils/intercept/SysOperaterLog.java
+25
-0
SystemLogAspect.java
...com/jz/manage/commonsUtils/intercept/SystemLogAspect.java
+181
-0
MyWebMVCConfig.java
...ge/src/main/java/com/jz/manage/config/MyWebMVCConfig.java
+64
-0
RedisConfig.java
...anage/src/main/java/com/jz/manage/config/RedisConfig.java
+52
-0
CredentialMatcher.java
...a/com/jz/manage/config/shiroConfig/CredentialMatcher.java
+26
-0
MyShiroRealm.java
...n/java/com/jz/manage/config/shiroConfig/MyShiroRealm.java
+91
-0
ShiroConfig.java
...in/java/com/jz/manage/config/shiroConfig/ShiroConfig.java
+195
-0
ShiroProperties.java
...ava/com/jz/manage/config/shiroConfig/ShiroProperties.java
+102
-0
manageApplication.java
...manage/src/main/java/com/jz/manage/manageApplication.java
+18
-0
application-prod.yml
jz-dm-manage/src/main/resources/application-prod.yml
+91
-0
application-test.yml
jz-dm-manage/src/main/resources/application-test.yml
+71
-0
application.yml
jz-dm-manage/src/main/resources/application.yml
+19
-0
UserMapper.xml
jz-dm-manage/src/main/resources/mapper/UserMapper.xml
+9
-0
manageApplicationTests.java
...e/src/test/java/com/jz/manage/manageApplicationTests.java
+29
-0
pom.xml
pom.xml
+15
-0
No files found.
jz-dm-manage/pom.xml
View file @
9f2f8553
...
...
@@ -13,4 +13,120 @@
<java.version>
1.8
</java.version>
</properties>
<dependencies>
<!-- spring-boot 相关依赖 -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-aop
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-freemarker
</artifactId>
</dependency>
<!--Redis集中存储Session-->
<dependency>
<groupId>
org.springframework.session
</groupId>
<artifactId>
spring-session-data-redis
</artifactId>
</dependency>
<!-- 引入boot-security权限框架 -->
<!--
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-ldap</artifactId>
</dependency>
<dependency>
<groupId>com.unboundid</groupId>
<artifactId>unboundid-ldapsdk</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
-->
<!-- fastjson -->
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
</dependency>
<!-- spring boot 和mybatis -->
<dependency>
<groupId>
org.mybatis.spring.boot
</groupId>
<artifactId>
mybatis-spring-boot-starter
</artifactId>
</dependency>
<!-- mybatis plus -->
<!--<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>-->
<!--mybatis分页插件 -->
<dependency>
<groupId>
com.github.pagehelper
</groupId>
<artifactId>
pagehelper
</artifactId>
</dependency>
<!-- druid数据库连接池 -->
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
druid
</artifactId>
</dependency>
<!-- mysql连接 -->
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
</dependency>
<!-- lombok -->
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>
src/main/java
</directory>
<includes>
<include>
**/*.xml
</include>
</includes>
</resource>
</resources>
</build>
</project>
\ No newline at end of file
jz-dm-manage/src/main/java/com/jz/manage/admin/Enum/DelFlagEnum.java
0 → 100644
View file @
9f2f8553
package
com
.
jz
.
manage
.
admin
.
Enum
;
public
enum
DelFlagEnum
{
/**
* 删除
*/
YES
(
"YES"
,
"Y"
),
/**
* 未删除
*/
NO
(
"NO"
,
"N"
),
;
private
String
code
;
private
String
value
;
private
DelFlagEnum
(
String
code
,
String
value
)
{
this
.
code
=
code
;
this
.
value
=
value
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getValue
()
{
return
value
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
public
static
DelFlagEnum
get
(
String
code
)
{
if
(
code
==
null
)
{
return
null
;
}
for
(
DelFlagEnum
status
:
values
())
{
if
(
status
.
getCode
().
equalsIgnoreCase
(
code
))
{
return
status
;
}
}
return
null
;
};
}
jz-dm-manage/src/main/java/com/jz/manage/admin/controller/BaseController.java
0 → 100644
View file @
9f2f8553
package
com
.
jz
.
manage
.
admin
.
controller
;
public
class
BaseController
{
/*public User getCurrentUser(){
User user = (User) SecurityUtils.getSubject().getPrincipals().iterator().next();
return user;
}
public Integer getCurrentUserId(){
return getCurrentUser().getUserId();
}*/
}
jz-dm-manage/src/main/java/com/jz/manage/admin/controller/UserController.java
0 → 100644
View file @
9f2f8553
package
com
.
jz
.
manage
.
admin
.
controller
;
import
com.jz.manage.admin.controller.BaseController
;
import
com.jz.manage.admin.service.UserService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.servlet.ModelAndView
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@RestController
@RequestMapping
(
"/user"
)
public
class
UserController
extends
BaseController
{
@Autowired
private
UserService
userService
;
@PostMapping
(
"/getTest"
)
public
List
<
Map
>
getTest
(){
System
.
out
.
print
(
userService
.
getTest
().
toString
());
return
userService
.
getTest
();
}
}
jz-dm-manage/src/main/java/com/jz/manage/admin/dao/UserMapper.java
0 → 100644
View file @
9f2f8553
package
com
.
jz
.
manage
.
admin
.
dao
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
import
java.util.Map
;
public
interface
UserMapper
{
List
<
Map
>
getTest
();
}
jz-dm-manage/src/main/java/com/jz/manage/admin/service/UserService.java
0 → 100644
View file @
9f2f8553
package
com
.
jz
.
manage
.
admin
.
service
;
import
java.util.List
;
import
java.util.Map
;
public
interface
UserService
{
List
<
Map
>
getTest
();
}
jz-dm-manage/src/main/java/com/jz/manage/admin/service/impl/UserServiceImpl.java
0 → 100644
View file @
9f2f8553
package
com
.
jz
.
manage
.
admin
.
service
.
impl
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
com.jz.manage.admin.dao.UserMapper
;
import
com.jz.manage.admin.service.UserService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.Map
;
@Service
public
class
UserServiceImpl
implements
UserService
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
UserServiceImpl
.
class
);
@Autowired
private
UserMapper
userMapper
;
@Autowired
RedisTemplate
redisTemplate
;
@Autowired
StringRedisTemplate
stringRedisTemplate
;
@Override
public
List
<
Map
>
getTest
()
{
return
userMapper
.
getTest
();
}
}
jz-dm-manage/src/main/java/com/jz/manage/commonsUtils/CommonsUtil.java
0 → 100644
View file @
9f2f8553
package
com
.
jz
.
manage
.
commonsUtils
;
import
java.io.Serializable
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
/**
* 工具类
*/
public
class
CommonsUtil
implements
Serializable
{
/**
* 返回字符串当前日期时间
*
* @return
*/
public
static
String
getCurrentTime
()
{
String
curDateFormat
=
"yyyy-MM-dd HH:mm:ss"
;
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
curDateFormat
);
String
sd
=
sdf
.
format
(
new
Date
());
return
sd
;
}
/**
* 根据指定的格式日期,返回日期时间
*
* @param strDate
* @param strDateformat
* @return
*/
public
static
Date
getString2Date
(
String
strDate
,
String
strDateformat
)
{
SimpleDateFormat
sdf
=
null
;
if
(
strDateformat
!=
""
||
strDateformat
!=
null
)
{
sdf
=
new
SimpleDateFormat
(
strDateformat
);
}
Date
dt
=
null
;
try
{
dt
=
sdf
.
parse
(
strDate
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
return
dt
;
}
}
jz-dm-manage/src/main/java/com/jz/manage/commonsUtils/LoginUntil.java
0 → 100644
View file @
9f2f8553
/*
package com.ma.demo.commonsUtils;
import com.ma.demo.service.UserService;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
public class LoginUntil implements Serializable {
private static UserService userService;
static {
userService = SpringApplicationProvider.getBean(UserService.class);
}
public static int loginLog(String userId) throws Exception{
Map map = new HashMap<>();
map.put("userId",userId);
map.put("loginTime", CommonsUtil.getCurrentTime());
map.put("status","01");
map.put("creTime", CommonsUtil.getCurrentTime());
userService.addLoginLog(map);
return 1;
}
public static int loginOutLog(String userId) throws Exception{
Map map = new HashMap<>();
map.put("userId",userId);
map.put("logOutTime", CommonsUtil.getCurrentTime());
map.put("status","02");
map.put("creTime", CommonsUtil.getCurrentTime());
return userService.addLoginOutLog(map);
}
}
*/
jz-dm-manage/src/main/java/com/jz/manage/commonsUtils/RedisUntil.java
0 → 100644
View file @
9f2f8553
This diff is collapsed.
Click to expand it.
jz-dm-manage/src/main/java/com/jz/manage/commonsUtils/SpringApplicationProvider.java
0 → 100644
View file @
9f2f8553
package
com
.
jz
.
manage
.
commonsUtils
;
import
org.springframework.beans.BeansException
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.stereotype.Component
;
/**
* spring 获取上下文工具类
*/
@Component
public
class
SpringApplicationProvider
implements
ApplicationContextAware
{
/**
* 上下文对象实例
*/
private
static
ApplicationContext
applicationContext
;
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
this
.
applicationContext
=
applicationContext
;
}
/**
* 获取applicationContext
*
* @return
*/
public
static
ApplicationContext
getApplicationContext
()
{
return
applicationContext
;
}
/**
* 通过name获取 Bean.
*
* @param name
* @return
*/
public
static
Object
getBean
(
String
name
)
{
return
getApplicationContext
().
getBean
(
name
);
}
/**
* 通过class获取Bean.
*
* @param clazz
* @param <T>
* @return
*/
public
static
<
T
>
T
getBean
(
Class
<
T
>
clazz
)
{
return
getApplicationContext
().
getBean
(
clazz
);
}
/**
* 通过name,以及Clazz返回指定的Bean
*
* @param name
* @param clazz
* @param <T>
* @return
*/
public
static
<
T
>
T
getBean
(
String
name
,
Class
<
T
>
clazz
)
{
return
getApplicationContext
().
getBean
(
name
,
clazz
);
}
}
jz-dm-manage/src/main/java/com/jz/manage/commonsUtils/VerifyUtil.java
0 → 100644
View file @
9f2f8553
package
com
.
jz
.
manage
.
commonsUtils
;
import
java.awt.*
;
import
java.awt.image.BufferedImage
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Random
;
/*
* 生成随机验证码
*
* */
public
class
VerifyUtil
{
// 验证码字符集
private
static
final
char
[]
CHARS
=
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
,
'g'
,
'h'
,
'i'
,
'j'
,
'k'
,
'l'
,
'm'
,
'n'
,
'o'
,
'p'
,
'q'
,
'r'
,
's'
,
't'
,
'u'
,
'v'
,
'w'
,
'x'
,
'y'
,
'z'
,
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
,
'G'
,
'H'
,
'I'
,
'J'
,
'K'
,
'L'
,
'M'
,
'N'
,
'O'
,
'P'
,
'Q'
,
'R'
,
'S'
,
'T'
,
'U'
,
'V'
,
'W'
,
'X'
,
'Y'
,
'Z'
};
// 字符数量
private
static
final
int
SIZE
=
4
;
// 干扰线数量
private
static
final
int
LINES
=
5
;
// 宽度
private
static
final
int
WIDTH
=
80
;
// 高度
private
static
final
int
HEIGHT
=
40
;
// 字体大小
private
static
final
int
FONT_SIZE
=
30
;
/**
* 生成随机验证码及图片
*/
public
static
Map
<
String
,
Object
>
createImage
()
{
StringBuffer
sb
=
new
StringBuffer
();
// 1.创建空白图片
BufferedImage
image
=
new
BufferedImage
(
WIDTH
,
HEIGHT
,
BufferedImage
.
TYPE_INT_RGB
);
// 2.获取图片画笔
Graphics
graphic
=
image
.
getGraphics
();
// 3.设置画笔颜色
graphic
.
setColor
(
Color
.
LIGHT_GRAY
);
// 4.绘制矩形背景
graphic
.
fillRect
(
0
,
0
,
WIDTH
,
HEIGHT
);
// 5.画随机字符
Random
ran
=
new
Random
();
for
(
int
i
=
0
;
i
<
SIZE
;
i
++)
{
// 取随机字符索引
int
n
=
ran
.
nextInt
(
CHARS
.
length
);
// 设置随机颜色
graphic
.
setColor
(
getRandomColor
());
// 设置字体大小
graphic
.
setFont
(
new
Font
(
null
,
Font
.
BOLD
+
Font
.
ITALIC
,
FONT_SIZE
));
// 画字符
graphic
.
drawString
(
CHARS
[
n
]
+
""
,
i
*
WIDTH
/
SIZE
,
HEIGHT
*
2
/
3
);
// 记录字符
sb
.
append
(
CHARS
[
n
]);
}
// 6.画干扰线
for
(
int
i
=
0
;
i
<
LINES
;
i
++)
{
// 设置随机颜色
graphic
.
setColor
(
getRandomColor
());
// 随机画线
graphic
.
drawLine
(
ran
.
nextInt
(
WIDTH
),
ran
.
nextInt
(
HEIGHT
),
ran
.
nextInt
(
WIDTH
),
ran
.
nextInt
(
HEIGHT
));
}
// 7.返回验证码和图片
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
//验证码
map
.
put
(
"code"
,
sb
.
toString
());
//图片
map
.
put
(
"image"
,
image
);
return
map
;
}
/**
* 随机取色
*/
public
static
Color
getRandomColor
()
{
Random
ran
=
new
Random
();
return
new
Color
(
ran
.
nextInt
(
256
),
ran
.
nextInt
(
256
),
ran
.
nextInt
(
256
));
}
}
jz-dm-manage/src/main/java/com/jz/manage/commonsUtils/intercept/SysOperaterLog.java
0 → 100644
View file @
9f2f8553
package
com
.
jz
.
manage
.
commonsUtils
.
intercept
;
import
java.lang.annotation.*
;
/**
* ClassName: SysOperateLog <br/>
* Function: AOP日志记录,自定义注解 <br/>
* date: 2020年6月7日 上午9:29:01 <br/>
* @author boss
*
* @Target({ ElementType.METHOD, ElementType.TYPE }) 表示该注解可以用在方法上或类上
* @Retention(RetentionPolicy.RUNTIME)表示运行时使用
* @Documented用于生成doc文档
*/
@Target
({
ElementType
.
PARAMETER
,
ElementType
.
METHOD
})
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
public
@interface
SysOperaterLog
{
String
module
()
default
""
;
//功能模块
String
remark
()
default
""
;
// 操作备注
String
operateType
()
default
""
;
// 操作类型:Add/Update/Delete/Search/Login等
}
jz-dm-manage/src/main/java/com/jz/manage/commonsUtils/intercept/SystemLogAspect.java
0 → 100644
View file @
9f2f8553
/*
package com.ma.demo.commonsUtils.intercept;
import com.alibaba.fastjson.JSON;
import com.ma.demo.commonsUtils.CommonsUtil;
import com.ma.demo.entity.SysOperateLog;
import com.ma.demo.entity.User;
import com.ma.demo.service.SysOperateLogService;
import org.apache.shiro.SecurityUtils;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method;
*/
/**
*
*定义AOP 切面
* *//*
@Aspect
@Component
@SuppressWarnings("rawtypes")
public class SystemLogAspect {
private static final Logger logger = LoggerFactory.getLogger(SystemLogAspect.class);
@Autowired
private SysOperateLogService sysOperateLogService;
*/
/**
* Service层切点
*//*
@Pointcut("@annotation( com.ma.demo.commonsUtils.intercept.SysOperaterLog)")
public void serviceAspect() {
}
*/
/**
* doServiceLog:获取注解参数,记录日志. <br/>
* @author lcma
* @param joinPoint 切入点参数
* @since JDK 1.7
*//*
@After("serviceAspect()")
public void doServiceLog(JoinPoint joinPoint) {
logger.info("***************日志记录**************");
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
//获取管理员用户信息
//CmsAdmin admin = WebUtils.getAdminInfo(request);
User user = (User)SecurityUtils.getSubject().getPrincipals().iterator().next();
try {
//保存至数据库日志
SysOperateLog sysOperateLog = new SysOperateLog();
sysOperateLog.setOperateType(getServiceMthodType(joinPoint));//放法的操作类型
sysOperateLog.setModuleName(getServiceMthodTableModule(joinPoint));//模块名称
sysOperateLog.setRemark(getServiceMthodReMark(joinPoint));//获取日志描述信息
sysOperateLog.setUsername(user.getUsername());
sysOperateLog.setUserId(String.valueOf(user.getUserId()));
sysOperateLog.setCreTime(CommonsUtil.getCurrentTime());
sysOperateLogService.insert(sysOperateLog);//保存至数据库
} catch (Exception e) {
logger.error("异常信息:{}", e);
}
}
*/
/**
* getServiceMthodDescription:获取注解中对方法的描述信息 用于service层注解 . <br/>
* @author lcma
* @param joinPoint 切点
* @return 方法描述
* @throws Exception
*//*
private String getServiceMthodReMark(JoinPoint joinPoint) throws Exception {
String targetName = joinPoint.getTarget().getClass().getName();
String methodName = joinPoint.getSignature().getName();
Object[] arguments = joinPoint.getArgs();
Class targetClass = Class.forName(targetName);
Method[] methods = targetClass.getMethods();
String description = "";
for(Method method : methods) {
if(method.getName().equals(methodName)) {
Class[] clazzs = method.getParameterTypes();
if(clazzs.length == arguments.length) {
description = method.getAnnotation(SysOperaterLog.class).remark();
break;
}
}
}
return description;
}
*/
/**
* getServiceMthodTableModule:获取注解中对方法的模块名用于service层注解 . <br/>
* @author lcma
* @param joinPoint
* @return
* @throws Exception
*//*
private String getServiceMthodTableModule(JoinPoint joinPoint) throws Exception {
String targetName = joinPoint.getTarget().getClass().getName();
String methodName = joinPoint.getSignature().getName();
Object[] arguments = joinPoint.getArgs();
Class targetClass = Class.forName(targetName);
Method[] methods = targetClass.getMethods();
String tableType ="";
for (Method method : methods) {
if (method.getName().equals(methodName)) {
Class[] clazzs = method.getParameterTypes();
if (clazzs.length == arguments.length) {
tableType = method.getAnnotation(SysOperaterLog.class).module();
break;
}
}
}
return tableType;
}
*/
/**
* getServiceMthodType:获取注解中对方法的操作类型用于service层注解 . <br/>
* @author lcma
* @param joinPoint
* @return
* @throws Exception
*//*
private String getServiceMthodType(JoinPoint joinPoint) throws Exception {
String targetName = joinPoint.getTarget().getClass().getName();
String methodName = joinPoint.getSignature().getName();
Object[] arguments = joinPoint.getArgs();
Class targetClass = Class.forName(targetName);
Method[] methods = targetClass.getMethods();
String operateType ="";
for (Method method : methods) {
if (method.getName().equals(methodName)) {
Class[] clazzs = method.getParameterTypes();
if (clazzs.length == arguments.length) {
operateType = method.getAnnotation(SysOperaterLog.class).operateType();
break;
}
}
}
return operateType;
}
*/
/**
* getServiceMthodParams:获取json格式的参数. <br/>
* @author lcma
* @param joinPoint
* @return
* @throws Exception
* @since JDK 1.7
*//*
private String getServiceMthodParams(JoinPoint joinPoint) throws Exception {
Object[] arguments = joinPoint.getArgs();
String params = JSON.toJSONString(arguments);
return params;
}
}
*/
jz-dm-manage/src/main/java/com/jz/manage/config/MyWebMVCConfig.java
0 → 100644
View file @
9f2f8553
/*
package com.jz.manage.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.*;
import org.springframework.web.servlet.handler.MappedInterceptor;
import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
@Configuration
public class MyWebMVCConfig implements WebMvcConfigurer {
// @Override
// public void addInterceptors(InterceptorRegistry registry) {
// registry.addInterceptor(new MyInterceptor()).addPathPatterns("/**").excludePathPatterns("/js/**","/css/**","/images/**");
// }
*/
/**
* 自定义一个springboot静态资源配置,定向到D盘根目录下,
* 通过addResourceHandler添加映射路径,然后通过addResourceLocations来指定路径
* @param registry
*//*
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
}
*/
/**
* 跨域支持
* @param registry
*//*
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
// 授权的源控制
.allowedOrigins("*")
// 控制是否开启与Ajax的Cookie提交方式
.allowCredentials(true)
// 允许请求的HTTP Method
.allowedMethods("POST","GET","DELETE","PATCH", "PUT")
// 授权的时间
.maxAge(3600*24);
}
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/table").setViewName("table");
registry.addViewController("/form").setViewName("form");
}
//配置视图解析器,如果在这里配置了就不需要在application.yml里面配置了
*/
/**
@Override
public void configureViewResolvers(ViewResolverRegistry registry) {
registry.jsp("/WEB-INF/jsp",".jsp");
registry.enableContentNegotiation(new MappingJackson2JsonView());
}
*//*
}
*/
jz-dm-manage/src/main/java/com/jz/manage/config/RedisConfig.java
0 → 100644
View file @
9f2f8553
package
com
.
jz
.
manage
.
config
;
import
com.fasterxml.jackson.annotation.JsonAutoDetect
;
import
com.fasterxml.jackson.annotation.PropertyAccessor
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.redis.connection.RedisConnectionFactory
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer
;
import
java.net.UnknownHostException
;
@Configuration
public
class
RedisConfig
{
@Bean
@ConditionalOnMissingBean
(
name
=
"redisTemplate"
)
public
RedisTemplate
<
String
,
Object
>
redisTemplate
(
RedisConnectionFactory
redisConnectionFactory
)
throws
UnknownHostException
{
Jackson2JsonRedisSerializer
<
Object
>
jackson2JsonRedisSerializer
=
new
Jackson2JsonRedisSerializer
<
Object
>(
Object
.
class
);
ObjectMapper
om
=
new
ObjectMapper
();
om
.
setVisibility
(
PropertyAccessor
.
ALL
,
JsonAutoDetect
.
Visibility
.
ANY
);
om
.
enableDefaultTyping
(
ObjectMapper
.
DefaultTyping
.
NON_FINAL
);
jackson2JsonRedisSerializer
.
setObjectMapper
(
om
);
RedisTemplate
<
String
,
Object
>
template
=
new
RedisTemplate
<
String
,
Object
>();
template
.
setConnectionFactory
(
redisConnectionFactory
);
template
.
setKeySerializer
(
jackson2JsonRedisSerializer
);
template
.
setValueSerializer
(
jackson2JsonRedisSerializer
);
template
.
setHashKeySerializer
(
jackson2JsonRedisSerializer
);
template
.
setHashValueSerializer
(
jackson2JsonRedisSerializer
);
template
.
afterPropertiesSet
();
return
template
;
}
@Bean
@ConditionalOnMissingBean
(
StringRedisTemplate
.
class
)
public
StringRedisTemplate
stringRedisTemplate
(
RedisConnectionFactory
redisConnectionFactory
)
throws
UnknownHostException
{
StringRedisTemplate
template
=
new
StringRedisTemplate
();
template
.
setConnectionFactory
(
redisConnectionFactory
);
return
template
;
}
}
jz-dm-manage/src/main/java/com/jz/manage/config/shiroConfig/CredentialMatcher.java
0 → 100644
View file @
9f2f8553
/*
package com.ma.demo.config.shiroConfig;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.authc.credential.SimpleCredentialsMatcher;
*/
/*
* 密码比较器
* *//*
public class CredentialMatcher extends SimpleCredentialsMatcher {
@Override
public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) {
UsernamePasswordToken usernamePasswordToken = (UsernamePasswordToken) token;
//获得用登录输入的密码:(可以采用加盐(salt)的方式去检验)
String password = new String(usernamePasswordToken.getPassword());
//获得数据库中的密码
String dbPassword = (String) info.getCredentials();
return this.equals(password, dbPassword);
}
}
*/
jz-dm-manage/src/main/java/com/jz/manage/config/shiroConfig/MyShiroRealm.java
0 → 100644
View file @
9f2f8553
/*
package com.ma.demo.config.shiroConfig;
import com.ma.demo.entity.Menu;
import com.ma.demo.entity.Roles;
import com.ma.demo.entity.User;
import com.ma.demo.service.UserService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.shiro.authc.*;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
public class MyShiroRealm extends AuthorizingRealm {
private final static Logger log = LoggerFactory.getLogger(MyShiroRealm.class);
@Autowired
private UserService userService;
*/
/*
*身份认证,登录,获取身份验证信息
* Shiro中,最终是通过 Realm 来获取应用程序中的用户、角色及权限信息的
*//*
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
UsernamePasswordToken utoken = (UsernamePasswordToken) token;//获取用户输入的token
//String userToken = (String) token.getCredentials();
log.info("******用户的token" + token.getPrincipal() + "******");
String username = utoken.getUsername();
log.info(username);
User user = userService.selectByUsername(username);
log.info(user.toString());
//放入shiro.调用CredentialsMatcher检验密码
return new SimpleAuthenticationInfo(user, user.getPassword(), this.getClass().getName());
}
*/
/*
*授权
* @param principals 权限信息 身份集合
* *//*
@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
User user = (User) principals.fromRealm(this.getClass().getName()).iterator().next();
List<String> permissionList = new ArrayList();
List<String> roleNameList = new ArrayList();
Set<Roles> roleSet = user.getRoles();
if (CollectionUtils.isNotEmpty(roleSet)) {
for (Roles role : roleSet) {
roleNameList.add(role.getRoleName());
Set<Menu> menusSet = role.getMenus();
if (CollectionUtils.isNotEmpty(menusSet)) {
for (Menu menu : menusSet) {
permissionList.add(menu.getMenuName());
}
}
}
}
SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
info.addStringPermissions(permissionList);
info.addRoles(roleNameList);
return info;
}
*/
/**
* 清除当前用户的权限认证缓存
*
* @param principals 权限信息 身份集合
*//*
@Override
public void clearCache(PrincipalCollection principals) {
super.clearCache(principals);
}
}
*/
jz-dm-manage/src/main/java/com/jz/manage/config/shiroConfig/ShiroConfig.java
0 → 100644
View file @
9f2f8553
/*
package com.ma.demo.config.shiroConfig;
import at.pollux.thymeleaf.shiro.dialect.ShiroDialect;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
import org.apache.shiro.cache.MemoryConstrainedCacheManager;
import org.apache.shiro.codec.Base64;
import org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.mgt.CookieRememberMeManager;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.apache.shiro.web.servlet.SimpleCookie;
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.apache.shiro.mgt.SecurityManager;
import java.util.LinkedHashMap;
@Configuration
public class ShiroConfig {
*/
/**
* 部分配置文件,详细见application.yml
*//*
@Autowired
private ShiroProperties shiroProperties;
*/
/**
* shiro的拦截器
**//*
@Bean
public ShiroFilterFactoryBean shiroFilterFactoryBean(SecurityManager securityManager) {
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
// 设置 securityManager
shiroFilterFactoryBean.setSecurityManager(securityManager);
// 登录的 url
shiroFilterFactoryBean.setLoginUrl(shiroProperties.getLoginUrl());
// 登录成功后跳转的 url
shiroFilterFactoryBean.setSuccessUrl(shiroProperties.getSuccessUrl());
// 未授权 url
shiroFilterFactoryBean.setUnauthorizedUrl(shiroProperties.getUnauthorizedUrl());
// 这里配置授权链,跟mvc的xml配置一样
LinkedHashMap<String, String> filterChainDefinitionMap = new LinkedHashMap();
// 设置免认证 url
String[] anonUrls = StringUtils.splitByWholeSeparatorPreserveAllTokens(shiroProperties.getAnonUrl(), ",");
for (String url : anonUrls) {
filterChainDefinitionMap.put(url, "anon");
}
// 配置退出过滤器,其中具体的退出代码 Shiro已经替我们实现了
//filterChainDefinitionMap.put(shiroProperties.getLogoutUrl(), "logout");
// 除上以外所有 url都必须认证通过才可以访问,未通过认证自动访问 LoginUrl
filterChainDefinitionMap.put("/**", "authc");
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
return shiroFilterFactoryBean;
}
*/
/**
* 配置各种安全事务管理器
**//*
@Bean("securityManager")
public SecurityManager securityManager(@Qualifier("myShiroRealm") MyShiroRealm myShiroRealm) {
System.err.println("----------- shiro加载 -----------");
DefaultWebSecurityManager manager = new DefaultWebSecurityManager();
manager.setRealm(myShiroRealm);
return manager;
}
*/
/*
* 配置自定义的权限登录
* *//*
@Bean("myShiroRealm")
public MyShiroRealm myShiroRealm(@Qualifier("credentialsMatcher") CredentialMatcher matcher) {
MyShiroRealm authRealm = new MyShiroRealm();
authRealm.setCacheManager(new MemoryConstrainedCacheManager());
authRealm.setCredentialsMatcher(matcher);
return authRealm;
}
*/
/**
* 生成一个ShiroRedisCacheManager
**//*
*/
/* private ShiroRedisCacheManager cacheManager(RedisTemplate template){
return new ShiroRedisCacheManager(template);
}*//*
*/
/**
* 这是我自己的realm 我自定义了一个密码解析器
*//*
*/
/* @Bean
@DependsOn({"hashedCredentialsMatcher"})
public ShiroRealm shiroRealm(HashedCredentialsMatcher matcher, SysUserService userService) {
// 配置 Realm,需自己实现
return new ShiroRealm(matcher,userService);
}*//*
*/
/*
* 配置自定义的密码比较器
* *//*
@Bean(name = "credentialsMatcher")
public CredentialMatcher credentialsMatcher() {
return new CredentialMatcher();
}
*/
/**
* 密码解析器 有好几种,我这是MD5 1024次加密
* @return
*//*
@Bean
public HashedCredentialsMatcher createMatcher(){
HashedCredentialsMatcher matcher = new HashedCredentialsMatcher("MD5");
matcher.setHashIterations(2);//散列次数
return matcher;
}
*/
/**
* rememberMe cookie 效果是重开浏览器后无需重新登录
*//*
@Bean
public SimpleCookie rememberMeCookie() {
//这个参数是cookie的名称,对应前端的checkbox的name = rememberMe
// 这里的Cookie的默认名称是 CookieRememberMeManager.DEFAULT_REMEMBER_ME_COOKIE_NAME
SimpleCookie cookie = new SimpleCookie(CookieRememberMeManager.DEFAULT_REMEMBER_ME_COOKIE_NAME);
// 是否只在https情况下传输
cookie.setSecure(false);
// 设置 cookie 的过期时间,单位为秒,这里为一天
cookie.setMaxAge(shiroProperties.getCookieTimeout());
return cookie;
}
*/
/**
* cookie管理对象,;记住我功能
*//*
@Bean
public CookieRememberMeManager rememberMeManager() {
CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager();
cookieRememberMeManager.setCookie(rememberMeCookie());
// cookieRememberMeManager.setCipherKey用来设置加密的Key,参数类型byte[],字节数组长度要求16
// rememberMe cookie 加密的密钥
cookieRememberMeManager.setCipherKey(Base64.decode("ZWvohmPdUsAWT3=KpPqda"));
return cookieRememberMeManager;
}
*/
/**
* 用于开启 Thymeleaf 中的 shiro 标签的使用
*//*
@Bean
public ShiroDialect shiroDialect() {
return new ShiroDialect();
}
*/
/**
* session 管理对象
*//*
@Bean(name = "sessionManager")
public DefaultWebSessionManager sessionManager() {
DefaultWebSessionManager sessionManager = new DefaultWebSessionManager();
// 设置session超时时间,单位为毫秒
sessionManager.setGlobalSessionTimeout(shiroProperties.getSessionTimeout());
sessionManager.setSessionIdCookie(new SimpleCookie(shiroProperties.getSessionIdName()));
// 网上各种说要自定义sessionDAO 其实完全不必要,shiro自己就自定义了一个,可以直接使用,还有其他的DAO,自行查看源码即可
sessionManager.setSessionDAO(new EnterpriseCacheSessionDAO());
return sessionManager;
}
}
*/
jz-dm-manage/src/main/java/com/jz/manage/config/shiroConfig/ShiroProperties.java
0 → 100644
View file @
9f2f8553
/*
package com.ma.demo.config.shiroConfig;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Service;
@ConfigurationProperties("hayek.shiro") //指明前缀
@Service
public class ShiroProperties {
private String anonUrl;
private String loginUrl;
private String successUrl;
private String logoutUrl;
private String unauthorizedUrl;
private int cookieTimeout;
private String sessionIdName;
private long sessionTimeout;
public int getCookieTimeout() {
return cookieTimeout;
}
public void setCookieTimeout(int cookieTimeout) {
this.cookieTimeout = cookieTimeout;
}
public String getAnonUrl() {
return anonUrl;
}
public void setAnonUrl(String anonUrl) {
this.anonUrl = anonUrl;
}
public String getLoginUrl() {
return loginUrl;
}
public void setLoginUrl(String loginUrl) {
this.loginUrl = loginUrl;
}
public String getSuccessUrl() {
return successUrl;
}
public void setSuccessUrl(String successUrl) {
this.successUrl = successUrl;
}
public String getLogoutUrl() {
return logoutUrl;
}
public void setLogoutUrl(String logoutUrl) {
this.logoutUrl = logoutUrl;
}
public String getUnauthorizedUrl() {
return unauthorizedUrl;
}
public void setUnauthorizedUrl(String unauthorizedUrl) {
this.unauthorizedUrl = unauthorizedUrl;
}
public String getSessionIdName() {
return sessionIdName;
}
public void setSessionIdName(String sessionIdName) {
this.sessionIdName = sessionIdName;
}
public long getSessionTimeout() {
return sessionTimeout;
}
public void setSessionTimeout(long sessionTimeout) {
this.sessionTimeout = sessionTimeout;
}
public String getExpireIn() {
return expireIn;
}
public void setExpireIn(String expireIn) {
this.expireIn = expireIn;
}
private String expireIn;
}
*/
jz-dm-manage/src/main/java/com/jz/manage/manageApplication.java
0 → 100644
View file @
9f2f8553
package
com
.
jz
.
manage
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.context.annotation.EnableAspectJAutoProxy
;
import
org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession
;
@SpringBootApplication
@MapperScan
(
"com.jz.manage.admin.dao"
)
@EnableAspectJAutoProxy
//启动对@AspectJ注解的支持
//@EnableRedisHttpSession //Redis集中存储Session
public
class
manageApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
manageApplication
.
class
,
args
);
}
}
jz-dm-manage/src/main/resources/application-prod.yml
0 → 100644
View file @
9f2f8553
server
:
port
:
8086
#contextPath: /resource
management
:
port
:
54000
health
:
mail
:
enabled
:
false
spring
:
profiles
:
prod
datasource1
:
url
:
jdbc:mysql://10.24.1.171:3306/dmp_web?characterEncoding=utf8&useSSL=false
driver-class-name
:
com.mysql.jdbc.Driver
username
:
dmp
password
:
dmp_PGroup@2019_!
hikari
:
maxLifetime
:
1765000
maximumPoolSize
:
20
connectionTimeout
:
30000
idleTimeout
:
600000
datasource2
:
url
:
jdbc:mysql://10.24.1.171:3306/dmp_openapi?characterEncoding=utf8&useSSL=false
driver-class-name
:
com.mysql.jdbc.Driver
username
:
dmp
password
:
dmp_PGroup@2019_!
hikari
:
maxLifetime
:
1765000
maximumPoolSize
:
20
connectionTimeout
:
30000
idleTimeout
:
600000
cache
:
type
:
CAFFEINE
caffeine
:
spec
:
maximumSize=1000,expireAfterWrite=30s
public-key
:
rajZdV0xpCox+2vEHFLsKq2o2XVdMaQq
redis
:
cluster
:
nodes
:
-
10.24.1.171:8001
-
10.24.1.171:8002
-
10.24.1.172:8001
-
10.24.1.172:8002
-
10.24.1.173:8001
-
10.24.1.173:8002
mail
:
host
:
smtp.exmail.qq.com
username
:
service@mail.cn
password
:
myPasswor
properties
:
mail
:
smtp
:
auth
:
true
starttls
:
enable
:
true
required
:
true
ldap
:
urls
:
ldap://10.24.1.160:389
base
:
dc=platenogroup,dc=com
username
:
cn=Manager,dc=platenogroup,dc=com
password
:
ldap_PGroup@2019_!
data
:
mongodb
:
uri
:
mongodb://10.0.108.50:27017/kudustat
remote
:
execute
:
command
:
server
:
192.168.204.121
user
:
root
password
:
123
submit-sycning-task-cmd
:
"
source
/etc/profile;/data/disk4/run_new_bigdata_etl_process.sh
"
query-sycning-task-status
:
"
yarn
application
-status
"
stop-sycning-task-cmd
:
"
yarn
application
-kill
"
cat-sycning-task-log
:
"
source
/etc/profile;cat
/data/disk4/log/"
dmp
:
eslog
:
http://10.0.108.56:9565/_xpack/sql
ignoreRedis
:
true
rePrefix
:
open
url
:
http://10.0.108.56:8889/jz/realtime/receive
openapi
:
user
:
91b777e1a8ba4e30a4175b55494bc72f
sysId
:
T0000038
timeout
:
default
:
5000
max
:
5000
evn
:
open
:
false
name
:
jz-dm-manage/src/main/resources/application-test.yml
0 → 100644
View file @
9f2f8553
# 测试环境配置
server
:
port
:
8082
#contextPath: /resource
management
:
port
:
54001
health
:
mail
:
enabled
:
false
spring
:
profiles
:
test
datasource
:
url
:
jdbc:mysql://localhost:13308/daping?characterEncoding=utf8&useSSL=false
driverClassName
:
com.mysql.jdbc.Driver
username
:
root
password
:
123456
type
:
com.alibaba.druid.pool.DruidDataSource
#监控统计拦截的filters
filters
:
stat
#配置初始化大小/最小/最大
initialSize
:
1
minIdle
:
1
maxActive
:
20
#获取连接等待超时时间
maxWait
:
60000
#间隔多久进行一次检测,检测需要关闭的空闲连接
timeBetweenEvictionRunsMillis
:
60000
#一个连接在池中最小生存的时间
minEvictableIdleTimeMillis
:
300000
validationQuery
:
SELECT 'x'
testWhileIdle
:
true
testOnBorrow
:
false
testOnReturn
:
false
#打开PSCache,并指定每个连接上PSCache的大小。
#oracle设为true,mysql设为false。分库分表较多推荐设置为false
poolPreparedStatements
:
false
maxPoolPreparedStatementPerConnectionSize
:
20
cache
:
type
:
CAFFEINE
caffeine
:
spec
:
maximumSize=1000,expireAfterWrite=30s
public-key
:
rajZdV0xpCox+2vEHFLsKq2o2XVdMaQq
redis
:
#database: 0
#host: 119.23.13.83
#port: 8007
#timeout: 5000
cluster
:
nodes
:
-
192.168.31.167:6379
-
192.168.31.167:6380
-
192.168.31.167:6381
-
192.168.31.167:6382
-
192.168.31.167:6383
-
192.168.31.167:6384
#使用redis管理session设置为redis,否则none
session
:
store-type
:
none
#mybatis的配置
mybatis
:
#配置mapper.xml文件所在路径
mapper-locations
:
classpath:mapper/*.xml
#配置映射类所在的包名
type-aliases-package
:
com.jz.manage.admin.entity
logging
:
level
:
com.jz.manage
:
debug
\ No newline at end of file
jz-dm-manage/src/main/resources/application.yml
0 → 100644
View file @
9f2f8553
# 系统信息
info
:
app
:
name
:
"
@project.name@"
description
:
"
@project.description@"
version
:
"
@project.version@"
spring-boot-version
:
"
@project.parent.version@"
spring
:
profiles
:
active
:
test
sysProperties
:
session-timeout
:
3600
developerList
:
-
name
:
九章
value
:
jz-dm-manage/src/main/resources/mapper/UserMapper.xml
0 → 100644
View file @
9f2f8553
<?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.jz.manage.admin.dao.UserMapper"
>
<select
id=
"getTest"
resultType=
"map"
>
select * from tb_user;
</select>
</mapper>
\ No newline at end of file
jz-dm-manage/src/test/java/com/jz/manage/manageApplicationTests.java
0 → 100644
View file @
9f2f8553
package
com
.
jz
.
manage
;
import
com.jz.manage.admin.service.UserService
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
java.util.Map
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
manageApplicationTests
{
@Autowired
private
UserService
userService
;
@Test
public
void
contextLoads
()
{
}
@Test
public
void
aa
()
{
System
.
out
.
print
(
userService
.
getTest
().
toString
());
userService
.
getTest
();
}
}
pom.xml
View file @
9f2f8553
...
...
@@ -41,6 +41,8 @@
<dom4j.version>
1.6.1
</dom4j.version>
<!-- baidu disconf -->
<disconf.version>
2.6.35
</disconf.version>
<junit.version>
4.12
</junit.version>
<commons-lang3.version>
3.8.1
</commons-lang3.version>
</properties>
<dependencyManagement>
...
...
@@ -169,6 +171,19 @@
<artifactId>
disconf-client
</artifactId>
<version>
${disconf.version}
</version>
</dependency>
<!--单元测试-->
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
${junit.version}
</version>
<scope>
test
</scope>
</dependency>
<!--工具类-->
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-lang3
</artifactId>
<version>
${commons-lang3.version}
</version>
</dependency>
</dependencies>
</dependencyManagement>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment