Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
antai-sport-http-server
Project
Project
Details
Activity
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
antai-sport
antai-sport-http-server
Commits
a5083862
Commit
a5083862
authored
Aug 19, 2021
by
liming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(初始化项目): 修改数据库连接、统一返回数据格式、全局异常处理
parent
97fea6c1
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
652 additions
and
41 deletions
+652
-41
pom.xml
code-generator/pom.xml
+48
-0
CodeGenerator.java
...antai/sport/http/server/code/generator/CodeGenerator.java
+140
-0
application-dev.yaml
code-generator/src/main/resources/application-dev.yaml
+4
-0
application.yaml
code-generator/src/main/resources/application.yaml
+8
-0
pom.xml
common/pom.xml
+25
-0
RespCodeEnum.java
...com/antai/sport/http/server/common/base/RespCodeEnum.java
+54
-0
Result.java
.../java/com/antai/sport/http/server/common/base/Result.java
+92
-0
BusinessException.java
...sport/http/server/common/exception/BusinessException.java
+22
-0
CustomerErrorController.java
...http/server/common/exception/CustomerErrorController.java
+40
-0
GlobalControllerExceptionHandler.java
...er/common/exception/GlobalControllerExceptionHandler.java
+54
-0
UUIDUtil.java
...ava/com/antai/sport/http/server/common/util/UUIDUtil.java
+15
-0
pom.xml
game-api/pom.xml
+6
-4
GameApiApplication.java
.../antai/sport/http/server/game/api/GameApiApplication.java
+2
-0
TestController.java
...sport/http/server/game/api/controller/TestController.java
+11
-7
pom.xml
pom.xml
+2
-0
application-common-db-dev.yml
profile/src/main/resources/application-common-db-dev.yml
+1
-1
application-common-db-prod.yml
profile/src/main/resources/application-common-db-prod.yml
+1
-1
SysRole.java
.../java/com/antai/sport/http/server/repository/SysRole.java
+0
-16
SysRoleMapper.java
...com/antai/sport/http/server/repository/SysRoleMapper.java
+0
-12
BaseArea.java
...ai/sport/http/server/repository/base/entity/BaseArea.java
+106
-0
BaseAreaMapper.java
...rt/http/server/repository/base/mapper/BaseAreaMapper.java
+16
-0
BaseAreaMapper.xml
repository/src/main/resources/mapper/base/BaseAreaMapper.xml
+5
-0
No files found.
code-generator/pom.xml
0 → 100644
View file @
a5083862
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
antai-sport-http-server
</artifactId>
<groupId>
com.antai.sport.http.server
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
code-generator
</artifactId>
<properties>
<maven.compiler.source>
11
</maven.compiler.source>
<maven.compiler.target>
11
</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>
com.antai.sport.http.server
</groupId>
<artifactId>
profile
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<scope>
runtime
</scope>
</dependency>
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
mybatis-plus-generator
</artifactId>
<version>
3.4.1
</version>
</dependency>
<dependency>
<groupId>
org.apache.velocity
</groupId>
<artifactId>
velocity-engine-core
</artifactId>
<version>
2.3
</version>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter
</artifactId>
<version>
2.4.2
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
code-generator/src/main/java/com/antai/sport/http/server/code/generator/CodeGenerator.java
0 → 100644
View file @
a5083862
package
com
.
antai
.
sport
.
http
.
server
.
code
.
generator
;
import
com.antai.sport.http.server.profile.EncryptUtil
;
import
com.baomidou.mybatisplus.core.exceptions.MybatisPlusException
;
import
com.baomidou.mybatisplus.core.toolkit.StringPool
;
import
com.baomidou.mybatisplus.generator.AutoGenerator
;
import
com.baomidou.mybatisplus.generator.InjectionConfig
;
import
com.baomidou.mybatisplus.generator.config.*
;
import
com.baomidou.mybatisplus.generator.config.po.TableInfo
;
import
com.baomidou.mybatisplus.generator.config.rules.NamingStrategy
;
import
com.baomidou.mybatisplus.generator.engine.VelocityTemplateEngine
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Scanner
;
public
class
CodeGenerator
{
/**
* <p>
* 读取控制台内容
* </p>
*/
public
static
String
scanner
(
String
tip
)
{
Scanner
scanner
=
new
Scanner
(
System
.
in
);
System
.
out
.
println
(
"请输入"
+
tip
+
":"
);
if
(
scanner
.
hasNext
())
{
String
ipt
=
scanner
.
next
();
if
(
StringUtils
.
isNotBlank
(
ipt
))
{
return
ipt
;
}
}
throw
new
MybatisPlusException
(
"请输入正确的"
+
tip
+
"!"
);
}
public
static
void
main
(
String
[]
args
)
{
String
author
=
"liming"
;
String
driver
=
"com.mysql.cj.jdbc.Driver"
;
String
parentPackage
=
"com.antai.sport.http.server.repository"
;
ConfigurableApplicationContext
context
=
SpringApplication
.
run
(
CodeGenerator
.
class
,
args
);
String
url
=
context
.
getEnvironment
().
getProperty
(
"spring.datasource.url"
);
String
username
=
context
.
getEnvironment
().
getProperty
(
"spring.datasource.username"
);
String
password
=
context
.
getEnvironment
().
getProperty
(
"spring.datasource.password"
);
String
salt
=
context
.
getEnvironment
().
getProperty
(
"jasypt.encryptor.password"
);
String
decryptPwd
;
if
(
password
!=
null
&&
password
.
contains
(
"ENC("
))
{
password
=
password
.
substring
(
4
,
password
.
length
()
-
1
);
decryptPwd
=
EncryptUtil
.
decryptPwd
(
salt
,
password
);
}
else
{
decryptPwd
=
password
;
}
// 代码生成器
AutoGenerator
mpg
=
new
AutoGenerator
();
// 包配置
PackageConfig
pc
=
new
PackageConfig
();
pc
.
setModuleName
(
scanner
(
"模块名"
));
pc
.
setParent
(
parentPackage
);
mpg
.
setPackageInfo
(
pc
);
// 全局配置
GlobalConfig
gc
=
new
GlobalConfig
();
String
projectPath
=
System
.
getProperty
(
"user.dir"
)
+
"/repository"
;
gc
.
setOutputDir
(
projectPath
+
"/src/main/java/"
);
gc
.
setAuthor
(
author
);
gc
.
setOpen
(
false
);
// gc.setSwagger2(true); 实体属性 Swagger2 注解
mpg
.
setGlobalConfig
(
gc
);
// 数据源配置
DataSourceConfig
dsc
=
new
DataSourceConfig
();
dsc
.
setUrl
(
url
);
// dsc.setSchemaName("public");
dsc
.
setDriverName
(
driver
);
dsc
.
setUsername
(
username
);
dsc
.
setPassword
(
decryptPwd
);
mpg
.
setDataSource
(
dsc
);
// 自定义配置
InjectionConfig
cfg
=
new
InjectionConfig
()
{
@Override
public
void
initMap
()
{
// to do nothing
}
};
// 如果模板引擎是 freemarker
// String templatePath = "/templates/mapper.xml.ftl";
// 如果模板引擎是 velocity
String
templatePath
=
"/templates/mapper.xml.vm"
;
// 自定义输出配置
List
<
FileOutConfig
>
focList
=
new
ArrayList
<>();
// 自定义配置会被优先输出
focList
.
add
(
new
FileOutConfig
(
templatePath
)
{
@Override
public
String
outputFile
(
TableInfo
tableInfo
)
{
// 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
return
projectPath
+
"/src/main/resources/mapper/"
+
pc
.
getModuleName
()
+
"/"
+
tableInfo
.
getEntityName
()
+
"Mapper"
+
StringPool
.
DOT_XML
;
}
});
cfg
.
setFileOutConfigList
(
focList
);
mpg
.
setCfg
(
cfg
);
// 配置模板
TemplateConfig
templateConfig
=
new
TemplateConfig
();
mpg
.
setTemplate
(
templateConfig
);
templateConfig
.
setXml
(
null
);
templateConfig
.
setController
(
null
);
templateConfig
.
setService
(
null
);
templateConfig
.
setServiceImpl
(
null
);
// 策略配置
StrategyConfig
strategy
=
new
StrategyConfig
();
strategy
.
setNaming
(
NamingStrategy
.
underline_to_camel
);
strategy
.
setColumnNaming
(
NamingStrategy
.
underline_to_camel
);
//strategy.setSuperEntityClass("你自己的父类实体,没有就不用设置!");
strategy
.
setEntityLombokModel
(
true
);
strategy
.
setRestControllerStyle
(
true
);
// 公共父类
//strategy.setSuperControllerClass("你自己的父类控制器,没有就不用设置!");
// 写于父类中的公共字段
//strategy.setSuperEntityColumns("id");
strategy
.
setInclude
(
scanner
(
"表名,多个英文逗号分割"
).
split
(
","
));
strategy
.
setControllerMappingHyphenStyle
(
true
);
// strategy.setTablePrefix(pc.getModuleName() + "_");
mpg
.
setStrategy
(
strategy
);
mpg
.
setTemplateEngine
(
new
VelocityTemplateEngine
());
mpg
.
execute
();
}
}
code-generator/src/main/resources/application-dev.yaml
0 → 100644
View file @
a5083862
spring
:
profiles
:
include
:
-
common-db-dev
\ No newline at end of file
code-generator/src/main/resources/application.yaml
0 → 100644
View file @
a5083862
spring
:
application
:
name
:
"
antai-sport-http-server-code-generator"
config
:
use-legacy-processing
:
true
profiles
:
active
:
dev
common/pom.xml
0 → 100644
View file @
a5083862
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
antai-sport-http-server
</artifactId>
<groupId>
com.antai.sport.http.server
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
common
</artifactId>
<properties>
<maven.compiler.source>
11
</maven.compiler.source>
<maven.compiler.target>
11
</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
common/src/main/java/com/antai/sport/http/server/common/base/RespCodeEnum.java
0 → 100644
View file @
a5083862
package
com
.
antai
.
sport
.
http
.
server
.
common
.
base
;
/**
* @Author liming
* @Date 2021/8/20 11:31
* @Email lmmax@126.com
* @Description:
*/
public
enum
RespCodeEnum
{
SUCCESS
(
"200"
,
""
),
PARAM_ERROR
(
"001"
,
"参数错误"
),
SYSTEM_ERROR
(
"002"
,
"系统错误"
),
SIGN_ERROR
(
"003"
,
"签名异常"
),
DATA_NOT_FOUND_ERROR
(
"005"
,
"查询数据不存在"
),
CONTROLLER_ERROR
(
"004"
,
"系统异常"
),
BUSINESS_ERROR
(
"006"
,
"业务异常"
),
DATA_CHANGE_ERROR
(
"007"
,
"当前数据已更新"
),
LOGIN_ERROR
(
"401"
,
"用户名或密码错误"
),
NOT_LOGIN
(
"401"
,
"未通过登录认证,请先进行登录"
),
BIND_ERROR
(
"402"
,
"用户绑定错误"
),
DATA_AUTH_ERROR
(
"403"
,
"没有当前功能操作权限,请联系管理员"
);
/**
* 返回码
*/
private
String
code
;
/**
* 返回结果描述
*/
private
String
message
;
RespCodeEnum
(
String
code
,
String
message
)
{
this
.
code
=
code
;
this
.
message
=
message
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getMessage
()
{
return
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
}
common/src/main/java/com/antai/sport/http/server/common/base/Result.java
0 → 100644
View file @
a5083862
package
com
.
antai
.
sport
.
http
.
server
.
common
.
base
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.ObjectError
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @Author liming
* @Date 2021/8/20 11:19
* @Email lmmax@126.com
* @Description:
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
Result
{
public
final
static
Integer
SUCCESS
=
1
;
public
final
static
Integer
FAIL
=
2
;
private
Integer
resultType
=
SUCCESS
;
private
String
respCode
;
private
String
respMsg
;
private
String
errorCode
;
private
Object
data
;
private
boolean
hasNewToken
;
private
String
longToken
;
private
String
shortToken
;
public
static
ResponseEntity
<
Result
>
error
(
RespCodeEnum
RespCodeEnum
)
{
Result
Result
=
new
Result
();
Result
.
setRespCode
(
RespCodeEnum
.
getCode
());
Result
.
setRespMsg
(
RespCodeEnum
.
getMessage
());
Result
.
setResultType
(
FAIL
);
return
new
ResponseEntity
<>(
Result
,
HttpStatus
.
OK
);
}
public
static
ResponseEntity
<
Result
>
error
(
RespCodeEnum
RespCodeEnum
,
String
errorMsg
)
{
Result
Result
=
new
Result
();
Result
.
setRespCode
(
RespCodeEnum
.
getCode
());
Result
.
setRespMsg
(
errorMsg
);
Result
.
setResultType
(
FAIL
);
return
new
ResponseEntity
<>(
Result
,
HttpStatus
.
OK
);
}
public
static
ResponseEntity
<
Result
>
error
(
RespCodeEnum
RespCodeEnum
,
BindingResult
bindingResult
)
{
Result
Result
=
new
Result
();
Result
.
setRespCode
(
RespCodeEnum
.
getCode
());
Result
.
setRespMsg
(
RespCodeEnum
.
getMessage
());
Result
.
setResultType
(
FAIL
);
StringBuilder
errorStr
=
new
StringBuilder
();
List
<
String
>
errorList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
bindingResult
.
getErrorCount
();
i
++)
{
ObjectError
oe
=
bindingResult
.
getAllErrors
().
get
(
i
);
errorList
.
add
(
oe
.
getDefaultMessage
());
if
(
i
==
0
)
{
errorStr
.
append
(
oe
.
getDefaultMessage
());
}
else
{
errorStr
.
append
(
","
).
append
(
oe
.
getDefaultMessage
());
}
}
Result
.
setData
(
errorStr
.
toString
());
return
new
ResponseEntity
<>(
Result
,
HttpStatus
.
OK
);
}
public
static
ResponseEntity
<
Result
>
success
(
HttpHeaders
httpHeaders
,
Object
object
)
{
Result
Result
=
new
Result
();
Result
.
setRespCode
(
RespCodeEnum
.
SUCCESS
.
getCode
());
Result
.
setRespMsg
(
RespCodeEnum
.
SUCCESS
.
getMessage
());
Result
.
setData
(
object
);
Result
.
setResultType
(
SUCCESS
);
return
new
ResponseEntity
<>(
Result
,
httpHeaders
,
HttpStatus
.
OK
);
}
public
static
ResponseEntity
<
Result
>
success
(
Object
object
)
{
Result
Result
=
new
Result
();
Result
.
setRespCode
(
RespCodeEnum
.
SUCCESS
.
getCode
());
Result
.
setRespMsg
(
RespCodeEnum
.
SUCCESS
.
getMessage
());
Result
.
setData
(
object
);
Result
.
setResultType
(
SUCCESS
);
return
new
ResponseEntity
<>(
Result
,
new
HttpHeaders
(),
HttpStatus
.
OK
);
}
}
common/src/main/java/com/antai/sport/http/server/common/exception/BusinessException.java
0 → 100644
View file @
a5083862
package
com
.
antai
.
sport
.
http
.
server
.
common
.
exception
;
/**
* @Author liming
* @Date 2021/8/20 11:10
* @Email lmmax@126.com
* @Description:
*/
public
class
BusinessException
extends
RuntimeException
{
/**
* serialVersionUID
*/
private
static
final
long
serialVersionUID
=
0L
;
public
BusinessException
()
{
super
();
}
public
BusinessException
(
String
message
)
{
super
(
message
);
}
}
common/src/main/java/com/antai/sport/http/server/common/exception/CustomerErrorController.java
0 → 100644
View file @
a5083862
package
com
.
antai
.
sport
.
http
.
server
.
common
.
exception
;
import
com.antai.sport.http.server.common.base.RespCodeEnum
;
import
com.antai.sport.http.server.common.base.Result
;
import
org.springframework.boot.web.servlet.error.ErrorController
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
/**
* @Author liming
* @Date 2021/8/20 11:53
* @Email lmmax@126.com
* @Description:
*/
@RestController
public
class
CustomerErrorController
implements
ErrorController
{
@RequestMapping
(
"/error"
)
public
ResponseEntity
<
Result
>
handleError
(
HttpServletRequest
request
)
{
Result
result
=
new
Result
();
Integer
statusCode
=
(
Integer
)
request
.
getAttribute
(
"javax.servlet.error.status_code"
);
result
.
setRespCode
(
statusCode
.
toString
());
if
(
RespCodeEnum
.
NOT_LOGIN
.
getCode
().
equals
(
result
.
getRespCode
()))
{
result
.
setRespMsg
(
RespCodeEnum
.
NOT_LOGIN
.
getMessage
());
}
else
{
result
.
setRespMsg
(
RespCodeEnum
.
SYSTEM_ERROR
.
getMessage
());
}
result
.
setResultType
(
Result
.
FAIL
);
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
}
@Override
public
String
getErrorPath
()
{
return
"/error"
;
}
}
common/src/main/java/com/antai/sport/http/server/common/exception/GlobalControllerExceptionHandler.java
0 → 100644
View file @
a5083862
package
com
.
antai
.
sport
.
http
.
server
.
common
.
exception
;
import
com.antai.sport.http.server.common.base.RespCodeEnum
;
import
com.antai.sport.http.server.common.base.Result
;
import
com.antai.sport.http.server.common.util.UUIDUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.ControllerAdvice
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
javax.servlet.http.HttpServletRequest
;
/**
* @Author liming
* @Date 2021/8/20 11:37
* @Email lmmax@126.com
* @Description:
*/
@ControllerAdvice
@ResponseBody
public
class
GlobalControllerExceptionHandler
{
Logger
logger
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
@Value
(
"${spring.profiles.active}"
)
public
String
profile
;
@ExceptionHandler
(
value
=
Exception
.
class
)
public
ResponseEntity
<
Result
>
businessExceptionHandler
(
HttpServletRequest
req
,
Exception
e
,
Model
model
)
throws
Exception
{
String
operateUser
=
"no-user"
;
//日志打印异常
String
errorCode
=
UUIDUtil
.
createUUID
().
substring
(
0
,
8
);
logger
.
error
(
operateUser
+
"->request:"
+
req
.
getRequestURI
()
+
"-异常代码:"
+
errorCode
,
e
);
Result
baseDTO
=
new
Result
();
if
(
e
instanceof
BusinessException
)
{
baseDTO
.
setRespCode
(
RespCodeEnum
.
BUSINESS_ERROR
.
getCode
());
baseDTO
.
setRespMsg
(
e
.
getMessage
());
}
else
{
baseDTO
.
setRespCode
(
RespCodeEnum
.
CONTROLLER_ERROR
.
getCode
());
if
(
profile
!=
null
&&
profile
.
equals
(
"prod"
))
{
baseDTO
.
setRespMsg
(
RespCodeEnum
.
CONTROLLER_ERROR
.
getMessage
());
}
else
{
baseDTO
.
setRespMsg
(
e
.
getMessage
());
}
}
baseDTO
.
setResultType
(
Result
.
FAIL
);
baseDTO
.
setErrorCode
(
errorCode
);
return
new
ResponseEntity
<>(
baseDTO
,
HttpStatus
.
OK
);
}
}
common/src/main/java/com/antai/sport/http/server/common/util/UUIDUtil.java
0 → 100644
View file @
a5083862
package
com
.
antai
.
sport
.
http
.
server
.
common
.
util
;
import
java.util.UUID
;
/**
* @Author liming
* @Date 2021/8/20 11:38
* @Email lmmax@126.com
* @Description:
*/
public
class
UUIDUtil
{
public
static
String
createUUID
()
{
return
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
);
}
}
game-api/pom.xml
View file @
a5083862
...
...
@@ -18,10 +18,7 @@
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
com.antai.sport.http.server
</groupId>
<artifactId>
profile
</artifactId>
...
...
@@ -32,6 +29,11 @@
<artifactId>
repository
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.antai.sport.http.server
</groupId>
<artifactId>
common
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
</dependencies>
<build>
...
...
game-api/src/main/java/com/antai/sport/http/server/game/api/GameApiApplication.java
View file @
a5083862
...
...
@@ -3,6 +3,7 @@ package com.antai.sport.http.server.game.api;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.context.annotation.ComponentScan
;
/**
* @author 厉明
...
...
@@ -12,6 +13,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
*/
@SpringBootApplication
@ComponentScan
(
value
=
"com.antai"
)
@MapperScan
(
"com.antai.**.repository"
)
public
class
GameApiApplication
{
public
static
void
main
(
String
[]
args
)
{
...
...
game-api/src/main/java/com/antai/sport/http/server/game/api/controller/TestController.java
View file @
a5083862
package
com
.
antai
.
sport
.
http
.
server
.
game
.
api
.
controller
;
import
com.antai.sport.http.server.repository.SysRole
;
import
com.antai.sport.http.server.repository.SysRoleMapper
;
import
com.antai.sport.http.server.common.base.Result
;
import
com.antai.sport.http.server.repository.base.entity.BaseArea
;
import
com.antai.sport.http.server.repository.base.mapper.BaseAreaMapper
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -10,6 +12,8 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
antai
.
sport
.
http
.
server
.
common
.
base
.
Result
.
success
;
/**
* @author 厉明
* @date 2021/8/18 11:40
...
...
@@ -19,14 +23,14 @@ import java.util.Map;
@RestController
public
class
TestController
{
@Resource
private
SysRoleMapper
sysRole
Mapper
;
private
BaseAreaMapper
baseArea
Mapper
;
@GetMapping
(
"test"
)
public
Map
<
String
,
Objec
t
>
test
()
{
public
ResponseEntity
<
Resul
t
>
test
()
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
List
<
SysRole
>
roleList
=
sysRole
Mapper
.
selectList
(
null
);
result
.
put
(
"
roleList"
,
role
List
);
return
result
;
List
<
BaseArea
>
areaList
=
baseArea
Mapper
.
selectList
(
null
);
result
.
put
(
"
areaList"
,
area
List
);
return
success
(
result
)
;
}
}
pom.xml
View file @
a5083862
...
...
@@ -17,6 +17,8 @@
<module>
repository
</module>
<module>
game-api
</module>
<module>
profile
</module>
<module>
code-generator
</module>
<module>
common
</module>
</modules>
...
...
profile/src/main/resources/application-common-db-dev.yml
View file @
a5083862
...
...
@@ -3,7 +3,7 @@ spring:
include
:
-
common-db
datasource
:
url
:
jdbc:mysql://39.106.215.44:3306/
baobeilianmeng
${project.mysql-url-params}
url
:
jdbc:mysql://39.106.215.44:3306/
antaisport
${project.mysql-url-params}
username
:
root
password
:
ENC(eeesjD8BM2hklNwdDv4FCDoaVZF9c8+2)
...
...
profile/src/main/resources/application-common-db-prod.yml
View file @
a5083862
...
...
@@ -3,7 +3,7 @@ spring:
include
:
-
common-db
datasource
:
url
:
jdbc:mysql://39.106.215.44:3306/
baobeilianmeng
${project.mysql-url-params}
url
:
jdbc:mysql://39.106.215.44:3306/
antaisport
${project.mysql-url-params}
username
:
root
password
:
ENC(gIm3rgivj5IjdeWkJ/gsFAtIwg/+bX78)
...
...
repository/src/main/java/com/antai/sport/http/server/repository/SysRole.java
deleted
100644 → 0
View file @
97fea6c1
package
com
.
antai
.
sport
.
http
.
server
.
repository
;
import
lombok.Data
;
/**
* @author 厉明
* @date 2021/8/18 15:02
* @email lmmax@126.com
* @description
*/
@Data
public
class
SysRole
{
private
Long
id
;
private
String
code
;
private
String
name
;
}
repository/src/main/java/com/antai/sport/http/server/repository/SysRoleMapper.java
deleted
100644 → 0
View file @
97fea6c1
package
com
.
antai
.
sport
.
http
.
server
.
repository
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
/**
* @author 厉明
* @date 2021/8/18 15:09
* @email lmmax@126.com
* @description
*/
public
interface
SysRoleMapper
extends
BaseMapper
<
SysRole
>
{
}
repository/src/main/java/com/antai/sport/http/server/repository/base/entity/BaseArea.java
0 → 100644
View file @
a5083862
package
com
.
antai
.
sport
.
http
.
server
.
repository
.
base
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
java.time.LocalDateTime
;
import
java.io.Serializable
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
* <p>
* 行政单位管理
* </p>
*
* @author liming
* @since 2021-08-20
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
public
class
BaseArea
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 主键
*/
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
/**
* 行政单位编码
*/
private
String
code
;
/**
* 行政单位名称
*/
private
String
name
;
/**
* 父节点id
*/
private
Long
parentId
;
/**
* 处于第几层
*/
private
Integer
level
;
/**
* 是否叶子节点
*/
private
Boolean
leaf
;
/**
* ID全路径
*/
private
String
idPath
;
/**
* 名称全路径
*/
private
String
namePath
;
/**
* 备注
*/
private
String
remark
;
/**
* 排序号
*/
private
Integer
showOrder
;
/**
* 删除标记
*/
private
Integer
deleted
;
/**
* 数据版本号
*/
private
Integer
version
;
/**
* 创建人
*/
private
Long
ctUserId
;
/**
* 创建时间
*/
private
LocalDateTime
ctDate
;
/**
* 最后修改人
*/
private
Long
lmUserId
;
/**
* 最后修改时间
*/
private
LocalDateTime
lmDate
;
}
repository/src/main/java/com/antai/sport/http/server/repository/base/mapper/BaseAreaMapper.java
0 → 100644
View file @
a5083862
package
com
.
antai
.
sport
.
http
.
server
.
repository
.
base
.
mapper
;
import
com.antai.sport.http.server.repository.base.entity.BaseArea
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
/**
* <p>
* 行政单位管理 Mapper 接口
* </p>
*
* @author liming
* @since 2021-08-20
*/
public
interface
BaseAreaMapper
extends
BaseMapper
<
BaseArea
>
{
}
repository/src/main/resources/mapper/base/BaseAreaMapper.xml
0 → 100644
View file @
a5083862
<?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.antai.sport.http.server.repository.base.mapper.BaseAreaMapper"
>
</mapper>
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