Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
polysoft-nafmii
/
polysoft-parent
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit fa74cfed
authored
Apr 26, 2021
by
zhoujinghao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
app用户注册相关代码提交
1 parent
9cec0563
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
445 additions
and
120 deletions
nafmii-app/pom.xml
nafmii-app/src/main/java/org/nafmii/controller/UserController.java
nafmii-app/src/main/java/org/nafmii/dto/user/RegisterDto.java
nafmii-app/src/main/java/org/nafmii/entity/AppUser.java → nafmii-app/src/main/java/org/nafmii/entity/user/AppUser.java
nafmii-mbg/src/main/java/org/nafmii/nafmiimbg/model/CenterRoleExample.java → nafmii-app/src/main/java/org/nafmii/entity/user/AppUserExample.java
nafmii-app/src/main/java/org/nafmii/enums/UserEnum.java
nafmii-app/src/main/java/org/nafmii/mapper/user/AppUserMapper.java
nafmii-app/src/main/java/org/nafmii/service/UserService.java
nafmii-app/src/main/java/org/nafmii/service/impl/UserServiceImpl.java
nafmii-mbg/src/main/resources/org/nafmii/nafmiimbg/mapper/CenterRoleMapper.xml → nafmii-app/src/main/resources/mapper/AppUserMapper.xml
nafmii-common/pom.xml
nafmii-common/src/main/java/org/nafmii/utils/GuavaUtil.java
nafmii-common/src/main/java/org/nafmii/utils/SnowFlakeUtil.java
nafmii-mbg/src/main/java/org/nafmii/nafmiimbg/mapper/CenterRoleMapper.java
nafmii-mbg/src/main/java/org/nafmii/nafmiimbg/model/CenterRole.java
nafmii-mbg/src/main/resources/generatorConfig.xml
nafmii-app/pom.xml
View file @
fa74cfe
nafmii-app/src/main/java/org/nafmii/controller/UserController.java
View file @
fa74cfe
...
@@ -2,15 +2,13 @@ package org.nafmii.controller;
...
@@ -2,15 +2,13 @@ package org.nafmii.controller;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.nafmii.dto.user.RegisterDto
;
import
org.nafmii.response.Result
;
import
org.nafmii.response.Result
;
import
org.nafmii.service.UserService
;
import
org.nafmii.service.UserService
;
import
org.nafmii.vo.UserVO
;
import
org.nafmii.vo.UserVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
;
import
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
/**
/**
* @author:zhoujh
* @author:zhoujh
...
@@ -21,12 +19,13 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -21,12 +19,13 @@ import org.springframework.web.bind.annotation.RestController;
* @remark:
* @remark:
*/
*/
@RestController
@RestController
@RequestMapping
(
"
/auth
"
)
@RequestMapping
(
"
app/nafmii/user
"
)
@Api
(
tags
=
"
1.0.0"
,
description
=
"模拟用户操作
"
)
@Api
(
tags
=
"
2.0.0"
,
description
=
"用户登陆注册操作操作【zjh】
"
)
public
class
UserController
{
public
class
UserController
{
@Autowired
@Autowired
private
UserService
userService
;
private
UserService
userService
;
@ApiOperation
(
value
=
"登陆"
,
notes
=
"登陆"
)
@ApiOperation
(
value
=
"模拟用户登陆"
,
notes
=
"模拟用户登陆"
)
@PostMapping
(
"/login"
)
@PostMapping
(
"/login"
)
@ResponseBody
@ResponseBody
public
Result
<
UserVO
>
login
(){
public
Result
<
UserVO
>
login
(){
...
@@ -34,5 +33,13 @@ public class UserController {
...
@@ -34,5 +33,13 @@ public class UserController {
return
login
;
return
login
;
}
}
@ApiOperation
(
value
=
"app用户注册接口"
,
notes
=
"app用户注册接口"
)
@PostMapping
(
"/register"
)
@ResponseBody
public
Result
register
(
@RequestBody
RegisterDto
registerDto
){
Result
register
=
userService
.
register
(
registerDto
);
return
register
;
}
}
}
nafmii-app/src/main/java/org/nafmii/dto/user/RegisterDto.java
0 → 100644
View file @
fa74cfe
package
org
.
nafmii
.
dto
.
user
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
import
java.util.Date
;
/**
* @author:zhoujh
* @Function:TODO
* @date 2021/4/26 13:39
* @ClassName:
* @version:
* @remark:
*/
@Data
@ApiModel
(
"app用户注册参数对象"
)
public
class
RegisterDto
{
@NotNull
(
message
=
"手机号或登录账号不能为空"
)
@ApiModelProperty
(
"手机号/登录账号"
)
private
String
phone
;
@ApiModelProperty
(
"头像图片地址"
)
private
String
headPicture
;
@NotNull
(
message
=
"验证码不能为空"
)
@ApiModelProperty
(
"验证码"
)
private
String
code
;
@NotNull
(
message
=
"注册密码不能为空"
)
@ApiModelProperty
(
"登陆密码"
)
private
String
loginPwd
;
@NotNull
(
message
=
"确认密码不能为空"
)
@ApiModelProperty
(
"确认密码"
)
private
String
confirmPwd
;
}
nafmii-app/src/main/java/org/nafmii/entity/AppUser.java
→
nafmii-app/src/main/java/org/nafmii/entity/
user/
AppUser.java
View file @
fa74cfe
package
org
.
nafmii
.
entity
;
package
org
.
nafmii
.
entity
.
user
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
...
...
nafmii-
mbg/src/main/java/org/nafmii/nafmiimbg/model/CenterRole
Example.java
→
nafmii-
app/src/main/java/org/nafmii/entity/user/AppUser
Example.java
View file @
fa74cfe
This diff is collapsed.
Click to expand it.
nafmii-app/src/main/java/org/nafmii/enums/UserEnum.java
0 → 100644
View file @
fa74cfe
package
org
.
nafmii
.
enums
;
/**
* @author:zhoujh
* @Function:TODO
* @date 2021/4/26 14:23
* @ClassName:用户枚举
* @version:
* @remark:
*/
public
enum
UserEnum
{
/**
* 是否开启人脸识别登录 0 未开启 1 已开启
*/
FACE
(
"1"
,
"已开启"
),
NOTFACE
(
"0"
,
"未开启"
),
/**
* 是否开启指纹登录 0 未开启 1 已开启
*/
FINGERPRINT
(
"1"
,
"已开启"
),
NOTFINGERPRINT
(
"0"
,
"未开启"
),
/**
* 是否有效标识 0 有效用户 1无效用户
*/
ENABLE
(
"0"
,
"有效用户"
),
NOTENABLE
(
"1"
,
"无效用户"
),
;
UserEnum
(
String
code
,
String
name
){
this
.
code
=
code
;
this
.
name
=
name
;
}
private
String
name
;
private
String
code
;
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
}
nafmii-app/src/main/java/org/nafmii/mapper/user/AppUserMapper.java
0 → 100644
View file @
fa74cfe
package
org
.
nafmii
.
mapper
.
user
;
import
org.apache.ibatis.annotations.Param
;
import
org.nafmii.entity.user.AppUser
;
import
org.nafmii.entity.user.AppUserExample
;
import
java.util.List
;
public
interface
AppUserMapper
{
long
countByExample
(
AppUserExample
example
);
int
deleteByExample
(
AppUserExample
example
);
int
deleteByPrimaryKey
(
Long
id
);
int
insert
(
AppUser
record
);
int
insertSelective
(
AppUser
record
);
List
<
AppUser
>
selectByExample
(
AppUserExample
example
);
AppUser
selectByPrimaryKey
(
Long
id
);
int
updateByExampleSelective
(
@Param
(
"record"
)
AppUser
record
,
@Param
(
"example"
)
AppUserExample
example
);
int
updateByExample
(
@Param
(
"record"
)
AppUser
record
,
@Param
(
"example"
)
AppUserExample
example
);
int
updateByPrimaryKeySelective
(
AppUser
record
);
int
updateByPrimaryKey
(
AppUser
record
);
}
\ No newline at end of file
\ No newline at end of file
nafmii-app/src/main/java/org/nafmii/service/UserService.java
View file @
fa74cfe
package
org
.
nafmii
.
service
;
package
org
.
nafmii
.
service
;
import
org.nafmii.dto.user.RegisterDto
;
import
org.nafmii.response.Result
;
import
org.nafmii.response.Result
;
import
org.nafmii.vo.UserVO
;
import
org.nafmii.vo.UserVO
;
...
@@ -12,5 +13,8 @@ import org.nafmii.vo.UserVO;
...
@@ -12,5 +13,8 @@ import org.nafmii.vo.UserVO;
* @remark:
* @remark:
*/
*/
public
interface
UserService
{
public
interface
UserService
{
//模拟用户登陆接口
Result
<
UserVO
>
login
();
Result
<
UserVO
>
login
();
//app注册接口
Result
register
(
RegisterDto
registerDto
);
}
}
nafmii-app/src/main/java/org/nafmii/service/impl/UserServiceImpl.java
View file @
fa74cfe
...
@@ -2,26 +2,44 @@ package org.nafmii.service.impl;
...
@@ -2,26 +2,44 @@ package org.nafmii.service.impl;
import
lombok.extern.slf4j.Slf4j
;
import
org.nafmii.dto.user.RegisterDto
;
import
org.nafmii.entity.user.AppUser
;
import
org.nafmii.enums.UserEnum
;
import
org.nafmii.exception.BusinessException
;
import
org.nafmii.mapper.user.AppUserMapper
;
import
org.nafmii.response.Result
;
import
org.nafmii.response.Result
;
import
org.nafmii.service.UserService
;
import
org.nafmii.service.UserService
;
import
org.nafmii.utils.GuavaUtil
;
import
org.nafmii.utils.JwtUtils
;
import
org.nafmii.utils.JwtUtils
;
import
org.nafmii.utils.SnowFlakeUtil
;
import
org.nafmii.vo.UserAndRoleVo
;
import
org.nafmii.vo.UserAndRoleVo
;
import
org.nafmii.vo.UserVO
;
import
org.nafmii.vo.UserVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
/**
/**
* @author:zhoujh
* @author:zhoujh
* @Function:TODO
* @Function:TODO
* @date 2021/4/25 10:20
* @date 2021/4/25 10:20
* @ClassName:
* @ClassName:
app用户实现类
* @version:
* @version:
* @remark:
* @remark:
*/
*/
@Service
@Service
@Slf4j
public
class
UserServiceImpl
implements
UserService
{
public
class
UserServiceImpl
implements
UserService
{
@Autowired
private
AppUserMapper
appUserMapper
;
/**
* 模拟用户登陆
* @return
*/
@Override
@Override
public
Result
<
UserVO
>
login
()
{
public
Result
<
UserVO
>
login
()
{
Result
result
=
new
Result
();
Result
result
=
new
Result
();
...
@@ -50,4 +68,46 @@ public class UserServiceImpl implements UserService {
...
@@ -50,4 +68,46 @@ public class UserServiceImpl implements UserService {
result
.
setData
(
userVO
);
result
.
setData
(
userVO
);
return
result
;
return
result
;
}
}
/**
* app用户注册接口
* @param registerDto
* @return
*/
@Override
public
Result
register
(
RegisterDto
registerDto
)
{
//用户实体类
AppUser
appUser
=
new
AppUser
();
appUser
.
setId
(
SnowFlakeUtil
.
nextId
());
appUser
.
setFaceidFalg
(
UserEnum
.
NOTFACE
.
getCode
());
appUser
.
setFigerprintFalg
(
UserEnum
.
NOTFINGERPRINT
.
getCode
());
appUser
.
setHeadPicture
(
registerDto
.
getHeadPicture
());
appUser
.
setIsEnable
(
UserEnum
.
ENABLE
.
getCode
());
appUser
.
setPhone
(
registerDto
.
getPhone
());
//判断注册密码和再次输入密码
if
(!
registerDto
.
getLoginPwd
().
equals
(
registerDto
.
getConfirmPwd
())){
throw
new
BusinessException
(
"两次密码输入不相同,请再次输入"
);
}
appUser
.
setLoginPwd
(
registerDto
.
getLoginPwd
());
appUser
.
setCreateTime
(
new
Date
());
appUser
.
setUpdateTime
(
new
Date
());
log
.
info
(
"用户注册实体==============>"
+
appUser
);
//将验证码放入到缓存当中(过期时间60s)test
// GuavaUtil.putTrackGuava(registerDto.getPhone(),registerDto.getCode());
//重缓存中获取(通过手机号获取)
String
code
=
(
String
)
GuavaUtil
.
getTrackGuava
(
registerDto
.
getPhone
());
log
.
info
(
"冲缓存中获取的验证码===============》{}"
,
code
);
if
(
null
==
code
){
throw
new
BusinessException
(
"验证码已过期"
);
}
if
(!
code
.
equals
(
registerDto
.
getCode
())){
throw
new
BusinessException
(
"验证码错误请重新输入"
);
}
int
i
=
appUserMapper
.
insertSelective
(
appUser
);
if
(
i
<
0
){
return
Result
.
failed
(
"新增失败"
);
}
return
Result
.
success
(
null
);
}
}
}
nafmii-
mbg/src/main/resources/org/nafmii/nafmiimbg/mapper/CenterRole
Mapper.xml
→
nafmii-
app/src/main/resources/mapper/AppUser
Mapper.xml
View file @
fa74cfe
This diff is collapsed.
Click to expand it.
nafmii-common/pom.xml
View file @
fa74cfe
...
@@ -169,6 +169,18 @@
...
@@ -169,6 +169,18 @@
<version>
3.9
</version>
<version>
3.9
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
javax.cache
</groupId>
<artifactId>
cache-api
</artifactId>
<version>
1.1.0
</version>
</dependency>
<dependency>
<groupId>
com.google.guava
</groupId>
<artifactId>
guava
</artifactId>
<version>
27.0-android
</version>
</dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-ooxml-schemas
</artifactId>
<artifactId>
poi-ooxml-schemas
</artifactId>
<version>
3.9
</version>
<version>
3.9
</version>
...
...
nafmii-common/src/main/java/org/nafmii/utils/GuavaUtil.java
0 → 100644
View file @
fa74cfe
package
org
.
nafmii
.
utils
;
import
com.google.common.cache.Cache
;
import
com.google.common.cache.CacheBuilder
;
import
lombok.Synchronized
;
import
javax.annotation.PostConstruct
;
import
java.util.HashMap
;
import
java.util.concurrent.TimeUnit
;
/**
* @Author: zjh
* @Date: 2020/7/8 13:28
* @Description:
*/
public
class
GuavaUtil
{
private
static
Cache
<
String
,
Object
>
guavaCache
;
private
static
Cache
<
String
,
Object
>
guavaCacheForFaceData
;
public
GuavaUtil
()
{
}
/**
* 跟踪连缓存
* @return
*/
public
static
Cache
<
String
,
Object
>
getGuavaCache
()
{
if
(
guavaCache
==
null
)
{
guavaCache
=
CacheBuilder
.
newBuilder
().
concurrencyLevel
(
10
)
// 存活时间 10 分钟
.
expireAfterWrite
(
10
,
TimeUnit
.
MINUTES
).
maximumSize
(
100000000
).
build
();
}
return
guavaCache
;
}
/**
*
* @return
*/
public
static
Cache
<
String
,
Object
>
getGuavaCacheForFaceData
()
{
if
(
guavaCacheForFaceData
==
null
)
{
guavaCacheForFaceData
=
CacheBuilder
.
newBuilder
().
concurrencyLevel
(
10
)
.
expireAfterWrite
(
1
,
TimeUnit
.
MINUTES
).
maximumSize
(
100000000
).
build
();
}
return
guavaCacheForFaceData
;
}
@Synchronized
public
static
Object
putTrackGuava
(
String
str
,
Object
obj
){
if
(
guavaCache
==
null
)
{
guavaCache
=
CacheBuilder
.
newBuilder
().
concurrencyLevel
(
10
)
.
expireAfterWrite
(
1
,
TimeUnit
.
MINUTES
).
maximumSize
(
100000000
).
build
();
}
return
guavaCache
.
asMap
().
put
(
str
,
obj
);
}
public
static
Object
getTrackGuava
(
String
str
){
if
(
guavaCache
==
null
)
{
guavaCache
=
CacheBuilder
.
newBuilder
().
build
();
}
return
guavaCache
.
asMap
().
get
(
str
);
}
public
static
void
deleteTrackGuava
(
String
str
){
guavaCache
=
CacheBuilder
.
newBuilder
().
build
();
guavaCache
.
invalidate
(
str
);
}
@Synchronized
public
static
Object
putFaceGuava
(
String
str
,
Object
obj
){
return
guavaCacheForFaceData
.
asMap
().
put
(
str
,
obj
);
}
public
static
Object
getFaceGuava
(
String
str
){
return
guavaCacheForFaceData
.
asMap
().
get
(
str
);
}
public
static
void
deleteFaceGuava
(
String
str
){
guavaCacheForFaceData
.
invalidate
(
str
);
}
public
static
void
main
(
String
[]
args
)
{
// Cache<String, Object> guavaCache = GuavaUtil.getGuavaCache();
//
// guavaCache.asMap().put("asd","asd");
// String asd = (String) guavaCache.asMap().get("asd");
// System.out.println(asd);
GuavaUtil
.
putTrackGuava
(
"test"
,
"1"
);
String
test
=
(
String
)
GuavaUtil
.
getTrackGuava
(
"test"
);
System
.
out
.
println
(
test
);
}
}
nafmii-common/src/main/java/org/nafmii/utils/SnowFlakeUtil.java
0 → 100644
View file @
fa74cfe
package
org
.
nafmii
.
utils
;
import
java.lang.management.ManagementFactory
;
import
java.lang.management.RuntimeMXBean
;
import
java.net.NetworkInterface
;
import
java.net.SocketException
;
import
java.util.Enumeration
;
/**
* @description: 雪花算法
* @author: DINGZIYAO
* @date: 2020/9/14 13:59
* @version: v1.0
*/
public
class
SnowFlakeUtil
{
private
final
static
long
TWEPOCH
=
12888349746579L
;
// 机器标识位数
private
final
static
long
WORKER_ID_BITS
=
5L
;
// 数据中心标识位数
private
final
static
long
DATACENTER_ID_BITS
=
5L
;
// 毫秒内自增位数
private
final
static
long
SEQUENCE_BITS
=
12L
;
// 机器ID偏左移12位
private
final
static
long
WORKER_ID_SHIFT
=
SEQUENCE_BITS
;
// 数据中心ID左移17位
private
final
static
long
DATACENTER_ID_SHIFT
=
SEQUENCE_BITS
+
WORKER_ID_BITS
;
// 时间毫秒左移22位
private
final
static
long
TIMESTAMP_LEFT_SHIFT
=
SEQUENCE_BITS
+
WORKER_ID_BITS
+
DATACENTER_ID_BITS
;
//sequence掩码,确保sequnce不会超出上限
private
final
static
long
SEQUENCE_MASK
=
~(-
1L
<<
SEQUENCE_BITS
);
//上次时间戳
private
static
long
lastTimestamp
=
-
1L
;
//序列
private
long
sequence
=
0L
;
//服务器ID
private
long
workerId
=
1L
;
private
static
final
long
WORKER_MASK
=
~(-
1L
<<
WORKER_ID_BITS
);
//进程编码
private
long
processId
=
1L
;
private
static
final
long
PROCESS_MASK
=
~(-
1L
<<
DATACENTER_ID_BITS
);
private
static
SnowFlakeUtil
snowFlake
=
null
;
static
{
snowFlake
=
new
SnowFlakeUtil
();
}
public
static
synchronized
long
nextId
(){
return
snowFlake
.
getNextId
();
}
private
SnowFlakeUtil
()
{
//获取机器编码
this
.
workerId
=
this
.
getMachineNum
();
//获取进程编码
RuntimeMXBean
runtimeMXBean
=
ManagementFactory
.
getRuntimeMXBean
();
this
.
processId
=
Long
.
parseLong
(
runtimeMXBean
.
getName
().
split
(
"@"
)[
0
]);
//避免编码超出最大值
this
.
workerId
=
workerId
&
WORKER_MASK
;
this
.
processId
=
processId
&
PROCESS_MASK
;
}
public
synchronized
long
getNextId
()
{
//获取时间戳
long
timestamp
=
timeGen
();
//如果时间戳小于上次时间戳则报错
if
(
timestamp
<
lastTimestamp
)
{
try
{
throw
new
Exception
(
"Clock moved backwards. Refusing to generate id for "
+
(
lastTimestamp
-
timestamp
)
+
" milliseconds"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
//如果时间戳与上次时间戳相同
if
(
lastTimestamp
==
timestamp
)
{
// 当前毫秒内,则+1,与sequenceMask确保sequence不会超出上限
sequence
=
(
sequence
+
1
)
&
SEQUENCE_MASK
;
if
(
sequence
==
0
)
{
// 当前毫秒内计数满了,则等待下一秒
timestamp
=
tilNextMillis
(
lastTimestamp
);
}
}
else
{
sequence
=
0
;
}
lastTimestamp
=
timestamp
;
// ID偏移组合生成最终的ID,并返回ID
long
nextId
=
((
timestamp
-
TWEPOCH
)
<<
TIMESTAMP_LEFT_SHIFT
)
|
(
processId
<<
DATACENTER_ID_SHIFT
)
|
(
workerId
<<
WORKER_ID_SHIFT
)
|
sequence
;
return
nextId
;
}
/**
* 再次获取时间戳直到获取的时间戳与现有的不同
* @param lastTimestamp
* @return 下一个时间戳
*/
private
long
tilNextMillis
(
final
long
lastTimestamp
)
{
long
timestamp
=
this
.
timeGen
();
while
(
timestamp
<=
lastTimestamp
)
{
timestamp
=
this
.
timeGen
();
}
return
timestamp
;
}
private
long
timeGen
()
{
return
System
.
currentTimeMillis
();
}
/**
* 获取机器编码
* @return
*/
private
long
getMachineNum
(){
long
machinePiece
;
StringBuilder
sb
=
new
StringBuilder
();
Enumeration
<
NetworkInterface
>
e
=
null
;
try
{
e
=
NetworkInterface
.
getNetworkInterfaces
();
}
catch
(
SocketException
e1
)
{
e1
.
printStackTrace
();
}
while
(
e
.
hasMoreElements
())
{
NetworkInterface
ni
=
e
.
nextElement
();
sb
.
append
(
ni
.
toString
());
}
machinePiece
=
sb
.
toString
().
hashCode
();
return
machinePiece
;
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
SnowFlakeUtil
.
nextId
());
// 8073480304000524288
// 8073480926335623168
}
}
nafmii-mbg/src/main/java/org/nafmii/nafmiimbg/mapper/CenterRoleMapper.java
deleted
100644 → 0
View file @
9cec056
package
org
.
nafmii
.
nafmiimbg
.
mapper
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
import
org.nafmii.nafmiimbg.model.CenterRole
;
import
org.nafmii.nafmiimbg.model.CenterRoleExample
;
public
interface
CenterRoleMapper
{
long
countByExample
(
CenterRoleExample
example
);
int
deleteByExample
(
CenterRoleExample
example
);
int
deleteByPrimaryKey
(
Long
id
);
int
insert
(
CenterRole
record
);
int
insertSelective
(
CenterRole
record
);
List
<
CenterRole
>
selectByExample
(
CenterRoleExample
example
);
CenterRole
selectByPrimaryKey
(
Long
id
);
int
updateByExampleSelective
(
@Param
(
"record"
)
CenterRole
record
,
@Param
(
"example"
)
CenterRoleExample
example
);
int
updateByExample
(
@Param
(
"record"
)
CenterRole
record
,
@Param
(
"example"
)
CenterRoleExample
example
);
int
updateByPrimaryKeySelective
(
CenterRole
record
);
int
updateByPrimaryKey
(
CenterRole
record
);
}
\ No newline at end of file
\ No newline at end of file
nafmii-mbg/src/main/java/org/nafmii/nafmiimbg/model/CenterRole.java
deleted
100644 → 0
View file @
9cec056
package
org
.
nafmii
.
nafmiimbg
.
model
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
import
java.util.Date
;
public
class
CenterRole
implements
Serializable
{
@ApiModelProperty
(
value
=
"主键"
)
private
Long
id
;
@ApiModelProperty
(
value
=
"角色名称"
)
private
String
rName
;
@ApiModelProperty
(
value
=
"创建时间"
)
private
Date
creatTime
;
@ApiModelProperty
(
value
=
"更新时间"
)
private
Date
updateTime
;
@ApiModelProperty
(
value
=
"启用禁用 0 启用 1禁用"
)
private
String
isEnable
;
private
static
final
long
serialVersionUID
=
1L
;
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
String
getrName
()
{
return
rName
;
}
public
void
setrName
(
String
rName
)
{
this
.
rName
=
rName
;
}
public
Date
getCreatTime
()
{
return
creatTime
;
}
public
void
setCreatTime
(
Date
creatTime
)
{
this
.
creatTime
=
creatTime
;
}
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
public
String
getIsEnable
()
{
return
isEnable
;
}
public
void
setIsEnable
(
String
isEnable
)
{
this
.
isEnable
=
isEnable
;
}
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
getClass
().
getSimpleName
());
sb
.
append
(
" ["
);
sb
.
append
(
"Hash = "
).
append
(
hashCode
());
sb
.
append
(
", id="
).
append
(
id
);
sb
.
append
(
", rName="
).
append
(
rName
);
sb
.
append
(
", creatTime="
).
append
(
creatTime
);
sb
.
append
(
", updateTime="
).
append
(
updateTime
);
sb
.
append
(
", isEnable="
).
append
(
isEnable
);
sb
.
append
(
", serialVersionUID="
).
append
(
serialVersionUID
);
sb
.
append
(
"]"
);
return
sb
.
toString
();
}
}
\ No newline at end of file
\ No newline at end of file
nafmii-mbg/src/main/resources/generatorConfig.xml
View file @
fa74cfe
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
<javaClientGenerator
type=
"XMLMAPPER"
targetPackage=
"org.nafmii.nafmiimbg.mapper"
<javaClientGenerator
type=
"XMLMAPPER"
targetPackage=
"org.nafmii.nafmiimbg.mapper"
targetProject=
"nafmii-mbg\src\main\java"
/>
targetProject=
"nafmii-mbg\src\main\java"
/>
<!--生成全部表tableName设为%-->
<!--生成全部表tableName设为%-->
<table
tableName=
"
CENTER_ROLE
"
>
<table
tableName=
"
APP_USER
"
>
<!--<generatedKey column="id" sqlStatement="MySql" identity="true"/>-->
<!--<generatedKey column="id" sqlStatement="MySql" identity="true"/>-->
</table>
</table>
</context>
</context>
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment