Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
znks
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
王夏晖
znks
Commits
6cc1b012
Commit
6cc1b012
authored
Sep 17, 2018
by
王夏晖
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://103.249.252.28:90/wangxiahui/znks
parents
04d68aef
b8cae1c8
Changes
37
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
1294 additions
and
303 deletions
+1294
-303
workspace.xml
.idea/workspace.xml
+391
-288
adc-da-main.iml
adc-da-main/adc-da-main.iml
+4
-1
pom.xml
adc-da-main/pom.xml
+13
-0
AdcDaApplication.java
adc-da-main/src/main/java/com/adc/da/AdcDaApplication.java
+1
-1
AdminController.java
...main/java/com/adc/da/znks/controller/AdminController.java
+125
-0
DeviceController.java
...ain/java/com/adc/da/znks/controller/DeviceController.java
+2
-0
LockRecordController.java
...java/com/adc/da/znks/controller/LockRecordController.java
+41
-0
UserController.java
.../main/java/com/adc/da/znks/controller/UserController.java
+32
-4
AdminDao.java
adc-da-main/src/main/java/com/adc/da/znks/dao/AdminDao.java
+40
-0
LockRecordDao.java
...main/src/main/java/com/adc/da/znks/dao/LockRecordDao.java
+6
-0
PositionDao.java
...a-main/src/main/java/com/adc/da/znks/dao/PositionDao.java
+3
-2
UserDao.java
adc-da-main/src/main/java/com/adc/da/znks/dao/UserDao.java
+9
-0
Admin.java
adc-da-main/src/main/java/com/adc/da/znks/entity/Admin.java
+83
-0
LockRecord.java
...main/src/main/java/com/adc/da/znks/entity/LockRecord.java
+2
-0
AdminService.java
...n/src/main/java/com/adc/da/znks/service/AdminService.java
+91
-0
LockRecordService.java
.../main/java/com/adc/da/znks/service/LockRecordService.java
+9
-0
UserService.java
...in/src/main/java/com/adc/da/znks/service/UserService.java
+18
-0
Base64Utils.java
...-main/src/main/java/com/adc/da/znks/util/Base64Utils.java
+35
-0
AdminSearch.java
...da-main/src/main/java/com/adc/da/znks/vo/AdminSearch.java
+42
-0
AdminVO.java
adc-da-main/src/main/java/com/adc/da/znks/vo/AdminVO.java
+33
-0
LockRecordVO.java
...a-main/src/main/java/com/adc/da/znks/vo/LockRecordVO.java
+74
-0
UserSearch.java
adc-da-main/src/main/java/com/adc/da/znks/vo/UserSearch.java
+40
-0
UserVO.java
adc-da-main/src/main/java/com/adc/da/znks/vo/UserVO.java
+52
-0
application-dev.properties
adc-da-main/src/main/resources/application-dev.properties
+1
-0
application-prd.properties
adc-da-main/src/main/resources/application-prd.properties
+2
-2
application.properties
adc-da-main/src/main/resources/application.properties
+5
-1
AdminMapper.xml
...in/src/main/resources/mybatis/mapper/znks/AdminMapper.xml
+50
-0
LockRecordMapper.xml
...c/main/resources/mybatis/mapper/znks/LockRecordMapper.xml
+28
-0
UserEOMapper.xml
...n/src/main/resources/mybatis/mapper/znks/UserEOMapper.xml
+29
-0
mybatis-config.xml
adc-da-main/src/main/resources/mybatis/mybatis-config.xml
+6
-0
CodeUtil.java
adc-da-main/src/test/java/com/adc/da/gen/CodeUtil.java
+1
-1
application-dev.properties
adc-da-main/target/classes/application-dev.properties
+1
-0
application-prd.properties
adc-da-main/target/classes/application-prd.properties
+2
-2
application.properties
adc-da-main/target/classes/application.properties
+5
-1
mybatis-config.xml
adc-da-main/target/classes/mybatis/mybatis-config.xml
+6
-0
CodeUtil.class
...da-main/target/test-classes/com/adc/da/gen/CodeUtil.class
+0
-0
adc-da.iml
adc-da.iml
+12
-0
No files found.
.idea/workspace.xml
View file @
6cc1b012
This diff is collapsed.
Click to expand it.
adc-da-main/adc-da-main.iml
View file @
6cc1b012
...
@@ -85,7 +85,6 @@
...
@@ -85,7 +85,6 @@
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.springframework.boot:spring-boot-test:1.5.5.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.springframework.boot:spring-boot-test:1.5.5.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot:1.5.5.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot:1.5.5.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.springframework.boot:spring-boot-test-autoconfigure:1.5.5.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: org.springframework.boot:spring-boot-test-autoconfigure:1.5.5.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-autoconfigure:1.5.5.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: com.jayway.jsonpath:json-path:2.2.0"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: com.jayway.jsonpath:json-path:2.2.0"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: net.minidev:json-smart:2.2.1"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: net.minidev:json-smart:2.2.1"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: net.minidev:accessors-smart:1.1"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"TEST"
name=
"Maven: net.minidev:accessors-smart:1.1"
level=
"project"
/>
...
@@ -145,6 +144,10 @@
...
@@ -145,6 +144,10 @@
<orderEntry
type=
"library"
name=
"Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:1.2.0"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:1.2.0"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:1.2.0"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:1.2.0"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.mybatis:mybatis-spring:1.3.0"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.mybatis:mybatis-spring:1.3.0"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: com.github.pagehelper:pagehelper:5.1.2"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: com.github.jsqlparser:jsqlparser:1.0"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.2.5"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-autoconfigure:1.5.5.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: net.sourceforge.javacsv:javacsv:2.0"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: net.sourceforge.javacsv:javacsv:2.0"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: net.sf.opencsv:opencsv:2.3"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: net.sf.opencsv:opencsv:2.3"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: commons-fileupload:commons-fileupload:1.3.3"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: commons-fileupload:commons-fileupload:1.3.3"
level=
"project"
/>
...
...
adc-da-main/pom.xml
View file @
6cc1b012
...
@@ -125,6 +125,19 @@
...
@@ -125,6 +125,19 @@
<artifactId>
mybatis-spring-boot-starter
</artifactId>
<artifactId>
mybatis-spring-boot-starter
</artifactId>
<version>
1.2.0
</version>
<version>
1.2.0
</version>
</dependency>
</dependency>
<!-- mybatis分页 -->
<!-- pageHelper -->
<dependency>
<groupId>
com.github.pagehelper
</groupId>
<artifactId>
pagehelper
</artifactId>
<version>
5.1.2
</version>
</dependency>
<dependency>
<groupId>
com.github.pagehelper
</groupId>
<artifactId>
pagehelper-spring-boot-autoconfigure
</artifactId>
<version>
1.2.5
</version>
</dependency>
<dependency>
<dependency>
<groupId>
net.sourceforge.javacsv
</groupId>
<groupId>
net.sourceforge.javacsv
</groupId>
...
...
adc-da-main/src/main/java/com/adc/da/AdcDaApplication.java
View file @
6cc1b012
...
@@ -17,7 +17,7 @@ import com.codahale.metrics.CsvReporter;
...
@@ -17,7 +17,7 @@ import com.codahale.metrics.CsvReporter;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.ComponentScan
;
/*@MapperScan("com.adc.da.**.dao")*/
@MapperScan
(
"com.adc.da.**.dao"
)
@ComponentScan
(
"com.adc"
)
@ComponentScan
(
"com.adc"
)
@ServletComponentScan
@ServletComponentScan
@SpringBootApplication
(
exclude
=
{
@SpringBootApplication
(
exclude
=
{
...
...
adc-da-main/src/main/java/com/adc/da/znks/controller/AdminController.java
0 → 100644
View file @
6cc1b012
package
com
.
adc
.
da
.
znks
.
controller
;
import
com.adc.da.znks.entity.Admin
;
import
com.adc.da.znks.entity.ResponseEntity
;
import
com.adc.da.znks.service.AdminService
;
import
com.adc.da.znks.util.GenResponse
;
import
com.adc.da.znks.vo.AdminSearch
;
import
com.adc.da.znks.vo.AdminVO
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* @author ley
**/
@RestController
@RequestMapping
(
"/api"
)
public
class
AdminController
{
@Autowired
private
AdminService
adminService
;
@PostMapping
(
"/admin"
)
public
ResponseEntity
saveOne
(
Admin
admin
)
{
try
{
int
result
=
adminService
.
insertAdmin
(
admin
);
if
(
result
==
1
){
return
GenResponse
.
success
(
String
.
valueOf
(
HttpStatus
.
OK
.
value
()),
"保存成功"
,
true
);
}
else
{
return
GenResponse
.
fail
(
"数据库已有该管理员名,插入失败!"
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
GenResponse
.
fail
(
"保存失败"
);
}
}
@PutMapping
(
"/admin"
)
public
ResponseEntity
<
Boolean
>
updateOne
(
Admin
admin
)
{
try
{
int
result
=
adminService
.
updateAdmin
(
admin
);
if
(
result
==
1
){
return
GenResponse
.
success
(
String
.
valueOf
(
HttpStatus
.
OK
.
value
()),
"更新成功"
,
true
);
}
else
{
return
GenResponse
.
success
(
String
.
valueOf
(
HttpStatus
.
OK
.
value
()),
"更新失败"
,
false
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
GenResponse
.
fail
(
"更新失败"
);
}
}
@DeleteMapping
(
"/admin/{adminName}"
)
public
ResponseEntity
deleteOne
(
@PathVariable
String
adminName
)
{
try
{
int
result
=
adminService
.
deleteAdmin
(
adminName
);
if
(
result
==
1
){
return
GenResponse
.
success
(
String
.
valueOf
(
HttpStatus
.
OK
.
value
()),
"删除成功"
,
true
);
}
else
{
return
GenResponse
.
success
(
String
.
valueOf
(
HttpStatus
.
OK
.
value
()),
"删除失败"
,
false
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
GenResponse
.
fail
(
"删除失败"
);
}
}
@GetMapping
(
"/admin/{adminName}"
)
public
ResponseEntity
<
Admin
>
findOne
(
@PathVariable
String
adminName
)
{
try
{
Admin
admin
=
adminService
.
findAdmin
(
adminName
);
return
GenResponse
.
success
(
String
.
valueOf
(
HttpStatus
.
OK
.
value
()),
"查询成功"
,
admin
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
GenResponse
.
fail
(
"查询失败"
);
}
}
@GetMapping
(
value
=
"/admin/page"
)
public
ResponseEntity
<
PageInfo
>
findByPage
(
AdminSearch
adminSearch
,
@RequestParam
(
defaultValue
=
"1"
)
Integer
pageNum
,
@RequestParam
(
defaultValue
=
"8"
)
Integer
pageSize
)
{
try
{
PageHelper
.
startPage
(
pageNum
,
pageSize
);
List
<
AdminVO
>
adminVOS
=
adminService
.
listAdminsByCondition
(
adminSearch
,
pageNum
,
pageSize
);
PageInfo
<
AdminVO
>
pageInfo
=
new
PageInfo
<
AdminVO
>(
adminVOS
);
return
GenResponse
.
success
(
String
.
valueOf
(
HttpStatus
.
OK
.
value
()),
"查询成功"
,
pageInfo
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
GenResponse
.
fail
(
"查询失败"
);
}
}
@CrossOrigin
@PostMapping
(
value
=
"/admin/login"
,
consumes
=
{
"application/x-www-form-urlencoded"
})
public
ResponseEntity
login
(
@RequestParam
String
adminName
,
@RequestParam
String
password
)
{
try
{
if
(
adminService
.
login
(
adminName
,
password
))
{
return
GenResponse
.
success
(
String
.
valueOf
(
HttpStatus
.
OK
.
value
()),
"登录成功"
,
true
);
}
else
{
return
GenResponse
.
fail
(
"登录失败"
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
GenResponse
.
fail
(
"登录失败"
);
}
}
}
adc-da-main/src/main/java/com/adc/da/znks/controller/DeviceController.java
View file @
6cc1b012
...
@@ -9,7 +9,9 @@ import com.adc.da.znks.service.DeviceService;
...
@@ -9,7 +9,9 @@ import com.adc.da.znks.service.DeviceService;
import
com.adc.da.znks.service.UserService
;
import
com.adc.da.znks.service.UserService
;
import
com.adc.da.znks.util.GenResponse
;
import
com.adc.da.znks.util.GenResponse
;
import
com.adc.da.znks.vo.DeviceVO
;
import
com.adc.da.znks.vo.DeviceVO
;
import
com.github.pagehelper.PageInfo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
...
adc-da-main/src/main/java/com/adc/da/znks/controller/LockRecordController.java
0 → 100644
View file @
6cc1b012
package
com
.
adc
.
da
.
znks
.
controller
;
import
com.adc.da.znks.entity.ResponseEntity
;
import
com.adc.da.znks.service.LockRecordService
;
import
com.adc.da.znks.util.GenResponse
;
import
com.adc.da.znks.vo.AdminVO
;
import
com.adc.da.znks.vo.LockRecordVO
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
@RestController
@RequestMapping
(
"/api"
)
public
class
LockRecordController
{
@Autowired
private
LockRecordService
lockRecordService
;
@ApiOperation
(
"lockRecord|开锁记录查询"
)
@GetMapping
(
"/lockRecord/page"
)
public
ResponseEntity
<
PageInfo
>
listLockRecordsByPage
(
String
phone
,
String
deviceName
,
@RequestParam
(
defaultValue
=
"1"
)
Integer
pageNum
,
@RequestParam
(
defaultValue
=
"8"
)
Integer
pageSize
)
{
try
{
PageHelper
.
startPage
(
pageNum
,
pageSize
);
List
<
LockRecordVO
>
lockRecordVOS
=
lockRecordService
.
listLockRecordVOs
(
phone
,
deviceName
,
pageNum
,
pageSize
);
PageInfo
<
LockRecordVO
>
pageInfo
=
new
PageInfo
<>(
lockRecordVOS
);
return
GenResponse
.
success
(
String
.
valueOf
(
HttpStatus
.
OK
.
value
()),
"查询成功"
,
pageInfo
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
GenResponse
.
fail
(
"没有可分页的锁记录"
);
}
}
}
adc-da-main/src/main/java/com/adc/da/znks/controller/UserController.java
View file @
6cc1b012
...
@@ -3,11 +3,16 @@ package com.adc.da.znks.controller;
...
@@ -3,11 +3,16 @@ package com.adc.da.znks.controller;
import
com.adc.da.base.web.BaseController
;
import
com.adc.da.base.web.BaseController
;
import
com.adc.da.util.http.ResponseMessage
;
import
com.adc.da.util.http.ResponseMessage
;
import
com.adc.da.util.http.Result
;
import
com.adc.da.util.http.Result
;
import
com.adc.da.util.utils.CollectionUtils
;
import
com.adc.da.znks.entity.ResponseEntity
;
import
com.adc.da.znks.entity.ResponseEntity
;
import
com.adc.da.znks.entity.User
;
import
com.adc.da.znks.entity.User
;
import
com.adc.da.znks.service.LockRecordService
;
import
com.adc.da.znks.service.LockRecordService
;
import
com.adc.da.znks.service.UserService
;
import
com.adc.da.znks.service.UserService
;
import
com.adc.da.znks.util.GenResponse
;
import
com.adc.da.znks.util.GenResponse
;
import
com.adc.da.znks.vo.UserSearch
;
import
com.adc.da.znks.vo.UserVO
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -16,6 +21,8 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -16,6 +21,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
/**
* @author David
* @author David
*/
*/
...
@@ -33,7 +40,7 @@ public class UserController extends BaseController<User> {
...
@@ -33,7 +40,7 @@ public class UserController extends BaseController<User> {
@ApiOperation
(
value
=
"|User|登录或者注册用户"
)
@ApiOperation
(
value
=
"|User|登录或者注册用户"
)
@PostMapping
(
value
=
{
"/loginOrRegisterUser"
})
@PostMapping
(
value
=
{
"/loginOrRegisterUser"
})
public
ResponseEntity
<
Boolean
>
loginOrRegisterUser
(
String
phoneNumber
,
String
password
)
{
public
ResponseEntity
<
Boolean
>
loginOrRegisterUser
(
String
phoneNumber
,
String
password
)
{
boolean
flag
=
userService
.
loginOrRegister
(
phoneNumber
,
password
);
boolean
flag
=
userService
.
loginOrRegister
(
phoneNumber
,
password
);
if
(
flag
)
{
if
(
flag
)
{
return
GenResponse
.
success
(
String
.
valueOf
(
HttpStatus
.
OK
.
value
()),
"登录或者注册用户成功"
,
flag
);
return
GenResponse
.
success
(
String
.
valueOf
(
HttpStatus
.
OK
.
value
()),
"登录或者注册用户成功"
,
flag
);
...
@@ -51,7 +58,7 @@ public class UserController extends BaseController<User> {
...
@@ -51,7 +58,7 @@ public class UserController extends BaseController<User> {
@ApiOperation
(
value
=
"|User|更新密码"
)
@ApiOperation
(
value
=
"|User|更新密码"
)
@PostMapping
(
"/updatePassword"
)
@PostMapping
(
"/updatePassword"
)
public
ResponseEntity
<
Boolean
>
update
(
String
phoneNumber
,
String
password
)
{
public
ResponseEntity
<
Boolean
>
update
(
String
phoneNumber
,
String
password
)
{
User
user
=
new
User
();
User
user
=
new
User
();
user
.
setTemphone
(
phoneNumber
);
user
.
setTemphone
(
phoneNumber
);
user
.
setPlainPassword
(
password
);
user
.
setPlainPassword
(
password
);
...
@@ -73,8 +80,29 @@ public class UserController extends BaseController<User> {
...
@@ -73,8 +80,29 @@ public class UserController extends BaseController<User> {
@ApiOperation
(
value
=
"开锁日志"
)
@ApiOperation
(
value
=
"开锁日志"
)
@GetMapping
(
"/listLockRecord"
)
@GetMapping
(
"/listLockRecord"
)
public
ResponseMessage
listLockRecord
(
String
phone
,
String
number
)
{
public
ResponseMessage
listLockRecord
(
String
phone
,
String
number
)
{
return
Result
.
success
(
lockRecordService
.
selectLockRecord
(
phone
,
number
));
return
Result
.
success
(
lockRecordService
.
selectLockRecord
(
phone
,
number
));
}
@ApiOperation
(
value
=
"|User|后台用户列表查询(默认第一页,每页8条)"
)
@GetMapping
(
"/page"
)
public
ResponseEntity
<
PageInfo
>
listUserVOs
(
UserSearch
userSearch
,
@RequestParam
(
defaultValue
=
"1"
)
Integer
pageNum
,
@RequestParam
(
defaultValue
=
"8"
)
Integer
pageSize
)
{
PageHelper
.
startPage
(
pageNum
,
pageSize
);
List
<
UserVO
>
userVOS
=
userService
.
listUserVOsByCondition
(
userSearch
,
pageNum
,
pageSize
);
try
{
if
(
CollectionUtils
.
isNotEmpty
(
userVOS
))
{
PageInfo
<
UserVO
>
pageInfo
=
new
PageInfo
<>(
userVOS
);
return
GenResponse
.
success
(
String
.
valueOf
(
HttpStatus
.
OK
.
value
()),
"分页查询成功"
,
pageInfo
);
}
else
{
return
GenResponse
.
success
(
String
.
valueOf
(
HttpStatus
.
OK
.
value
()),
"没有记录可以分页"
,
null
);
}
}
catch
(
Exception
e
)
{
return
GenResponse
.
fail
(
"分页查询失败"
);
}
}
}
}
}
adc-da-main/src/main/java/com/adc/da/znks/dao/AdminDao.java
0 → 100644
View file @
6cc1b012
package
com
.
adc
.
da
.
znks
.
dao
;
import
com.adc.da.znks.entity.Admin
;
import
com.adc.da.znks.vo.AdminSearch
;
import
com.adc.da.znks.vo.AdminVO
;
import
org.apache.ibatis.annotations.*
;
import
java.util.List
;
/**
* @author ley
**/
@Mapper
public
interface
AdminDao
{
@Insert
(
"insert into tb_admin(admin_id,admin_name,admin_password,create_time) "
+
"values(#{adminId},#{name},#{password},#{createTime})"
)
int
insertAdmin
(
Admin
admin
);
@Delete
(
"delete from tb_admin where admin_name = #{adminName}"
)
int
deleteAdmin
(
@Param
(
"adminName"
)
String
adminName
);
int
updateAdmin
(
Admin
admin
);
List
<
AdminVO
>
listAdminsByCondition
(
@Param
(
"adminSearch"
)
AdminSearch
adminSearch
,
@Param
(
"pageNum"
)
Integer
pageNum
,
@Param
(
"pageSize"
)
Integer
pageSize
);
@Select
(
"select * from tb_admin where admin_name = #{param1}"
)
@Results
({
@Result
(
column
=
"create_time"
,
property
=
"createTime"
),
@Result
(
column
=
"admin_name"
,
property
=
"name"
),
@Result
(
column
=
"admin_password"
,
property
=
"password"
),
@Result
(
column
=
"admin_id"
,
property
=
"adminId"
)
}
)
Admin
findAdminByAdminName
(
String
adminName
);
}
adc-da-main/src/main/java/com/adc/da/znks/dao/LockRecordDao.java
View file @
6cc1b012
...
@@ -3,8 +3,11 @@ package com.adc.da.znks.dao;
...
@@ -3,8 +3,11 @@ package com.adc.da.znks.dao;
import
com.adc.da.base.dao.BaseDao
;
import
com.adc.da.base.dao.BaseDao
;
import
com.adc.da.znks.entity.Device
;
import
com.adc.da.znks.entity.Device
;
import
com.adc.da.znks.entity.LockRecord
;
import
com.adc.da.znks.entity.LockRecord
;
import
com.adc.da.znks.vo.LockRecordVO
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Results
;
import
org.apache.ibatis.annotations.Select
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -19,4 +22,7 @@ public interface LockRecordDao extends BaseDao<LockRecord> {
...
@@ -19,4 +22,7 @@ public interface LockRecordDao extends BaseDao<LockRecord> {
List
<
Map
<
String
,
Object
>>
selectLockRecord
(
@Param
(
"mac"
)
String
mac
,
@Param
(
"deviceCode"
)
String
deviceCode
);
List
<
Map
<
String
,
Object
>>
selectLockRecord
(
@Param
(
"mac"
)
String
mac
,
@Param
(
"deviceCode"
)
String
deviceCode
);
List
<
LockRecordVO
>
getLockRecordVOs
(
@Param
(
"telphone"
)
String
phone
,
@Param
(
"deviceName"
)
String
deviceName
,
@Param
(
"pageNum"
)
Integer
pageNum
,
@Param
(
"pageSize"
)
Integer
pageSize
);
}
}
adc-da-main/src/main/java/com/adc/da/znks/dao/PositionDao.java
View file @
6cc1b012
...
@@ -2,7 +2,9 @@ package com.adc.da.znks.dao;
...
@@ -2,7 +2,9 @@ package com.adc.da.znks.dao;
import
com.adc.da.base.dao.BaseDao
;
import
com.adc.da.base.dao.BaseDao
;
import
com.adc.da.znks.entity.Position
;
import
com.adc.da.znks.entity.Position
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.*
;
import
java.util.Map
;
/**
/**
*
*
...
@@ -11,5 +13,4 @@ import org.apache.ibatis.annotations.Mapper;
...
@@ -11,5 +13,4 @@ import org.apache.ibatis.annotations.Mapper;
*/
*/
@Mapper
@Mapper
public
interface
PositionDao
extends
BaseDao
<
Position
>
{
public
interface
PositionDao
extends
BaseDao
<
Position
>
{
}
}
adc-da-main/src/main/java/com/adc/da/znks/dao/UserDao.java
View file @
6cc1b012
...
@@ -3,6 +3,8 @@ package com.adc.da.znks.dao;
...
@@ -3,6 +3,8 @@ package com.adc.da.znks.dao;
;
;
import
com.adc.da.base.dao.BaseDao
;
import
com.adc.da.base.dao.BaseDao
;
import
com.adc.da.znks.entity.User
;
import
com.adc.da.znks.entity.User
;
import
com.adc.da.znks.vo.UserSearch
;
import
com.adc.da.znks.vo.UserVO
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
org.apache.ibatis.annotations.Select
;
...
@@ -33,4 +35,11 @@ public interface UserDao extends BaseDao<User> {
...
@@ -33,4 +35,11 @@ public interface UserDao extends BaseDao<User> {
" and ur.temphone = #{phoneNumber}"
)
" and ur.temphone = #{phoneNumber}"
)
List
<
Map
<
String
,
Object
>>
getGateWayByPhoneNumber
(
@Param
(
"phoneNumber"
)
String
phoneNumber
);
List
<
Map
<
String
,
Object
>>
getGateWayByPhoneNumber
(
@Param
(
"phoneNumber"
)
String
phoneNumber
);
/**
* 获取用户列表
* **/
List
<
UserVO
>
listUserVOs
(
@Param
(
"userSearch"
)
UserSearch
userSearch
,
@Param
(
"pageNum"
)
Integer
pageNum
,
@Param
(
"pageSize"
)
Integer
pageSize
);
}
}
adc-da-main/src/main/java/com/adc/da/znks/entity/Admin.java
0 → 100644
View file @
6cc1b012
package
com
.
adc
.
da
.
znks
.
entity
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
java.util.Date
;
/**
* @author ley
* **/
public
class
Admin
{
private
String
name
;
private
String
password
;
@org
.
springframework
.
format
.
annotation
.
DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
@JSONField
(
format
=
"yyyy-MM-dd"
)
private
Date
createTime
;
private
transient
String
plainPassword
;
private
String
adminId
;
public
Admin
()
{
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
String
getPlainPassword
()
{
return
plainPassword
;
}
public
void
setPlainPassword
(
String
plainPassword
)
{
this
.
plainPassword
=
plainPassword
;
}
public
String
getAdminId
()
{
return
adminId
;
}
public
void
setAdminId
(
String
adminId
)
{
this
.
adminId
=
adminId
;
}
@Override
public
String
toString
()
{
final
StringBuilder
sb
=
new
StringBuilder
(
"{"
);
sb
.
append
(
"\"name\":\""
)
.
append
(
name
).
append
(
'\"'
);
sb
.
append
(
",\"password\":\""
)
.
append
(
password
).
append
(
'\"'
);
sb
.
append
(
",\"createTime\":\""
)
.
append
(
createTime
).
append
(
'\"'
);
sb
.
append
(
",\"adminId\":\""
)
.
append
(
adminId
).
append
(
'\"'
);
sb
.
append
(
'}'
);
return
sb
.
toString
();
}
}
adc-da-main/src/main/java/com/adc/da/znks/entity/LockRecord.java
View file @
6cc1b012
package
com
.
adc
.
da
.
znks
.
entity
;
package
com
.
adc
.
da
.
znks
.
entity
;
import
com.adc.da.base.entity.BaseEntity
;
import
com.adc.da.base.entity.BaseEntity
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -17,6 +18,7 @@ public class LockRecord extends BaseEntity {
...
@@ -17,6 +18,7 @@ public class LockRecord extends BaseEntity {
private
int
user
;
private
int
user
;
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
String
deviceId
;
private
String
deviceId
;
private
String
lockType
;
private
String
lockType
;
...
...
adc-da-main/src/main/java/com/adc/da/znks/service/AdminService.java
0 → 100644
View file @
6cc1b012
package
com
.
adc
.
da
.
znks
.
service
;
import
com.adc.da.util.utils.UUID
;
import
com.adc.da.znks.dao.AdminDao
;
import
com.adc.da.znks.entity.Admin
;
import
com.adc.da.znks.util.Base64Utils
;
import
com.adc.da.znks.vo.AdminSearch
;
import
com.adc.da.znks.vo.AdminVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.StringUtils
;
import
java.io.IOException
;
import
java.nio.charset.Charset
;
import
java.util.Date
;
import
java.util.List
;
/**
* @author ley
**/
@Service
@Transactional
(
value
=
"transactionManager"
,
propagation
=
Propagation
.
REQUIRED
,
rollbackFor
=
Throwable
.
class
)
public
class
AdminService
{
@Autowired
(
required
=
false
)
private
AdminDao
adminDao
;
public
List
<
AdminVO
>
listAdminsByCondition
(
AdminSearch
adminSearch
,
Integer
pageNum
,
Integer
pageSize
)
{
return
adminDao
.
listAdminsByCondition
(
adminSearch
,
pageNum
,
pageSize
);
}
public
int
insertAdmin
(
Admin
admin
)
{
Admin
findAdmin
=
adminDao
.
findAdminByAdminName
(
admin
.
getName
());
if
(
findAdmin
==
null
)
{
admin
.
setAdminId
(
UUID
.
randomUUID
());
admin
.
setCreateTime
(
new
Date
(
System
.
currentTimeMillis
()));
if
(
StringUtils
.
hasText
(
admin
.
getPlainPassword
()))
{
admin
.
setPassword
(
Base64Utils
.
encode
(
admin
.
getPlainPassword
().
getBytes
(
Charset
.
defaultCharset
())));
}
return
adminDao
.
insertAdmin
(
admin
);
}
else
{
//数据库已有该管理员名,不允许插入
return
-
1
;
}
}
public
int
deleteAdmin
(
String
adminId
)
{
return
adminDao
.
deleteAdmin
(
adminId
);
}
public
int
updateAdmin
(
Admin
admin
)
{
Admin
findAdmin
=
adminDao
.
findAdminByAdminName
(
admin
.
getName
());
if
(
findAdmin
!=
null
)
{
if
(
StringUtils
.
hasText
(
admin
.
getPlainPassword
()))
{
findAdmin
.
setPassword
(
Base64Utils
.
encode
(
admin
.
getPlainPassword
().
getBytes
(
Charset
.
defaultCharset
())));
}
return
adminDao
.
updateAdmin
(
findAdmin
);
}
else
{
//没有查询到,更新失败
return
-
1
;
}
}
public
Admin
findAdmin
(
String
adminName
)
{
return
adminDao
.
findAdminByAdminName
(
adminName
);
}
public
boolean
login
(
String
adminName
,
String
plainPassword
)
throws
IOException
{
Admin
admin
=
adminDao
.
findAdminByAdminName
(
adminName
);
if
(
admin
!=
null
)
{
String
adminPassword
=
admin
.
getPassword
();
if
(
StringUtils
.
hasText
(
plainPassword
)
&&
plainPassword
.
equals
(
new
String
(
Base64Utils
.
decode
(
adminPassword
),
Charset
.
defaultCharset
())))
{
return
true
;
}
else
{
//密码验证不成功
return
false
;
}
}
return
false
;
}
}
adc-da-main/src/main/java/com/adc/da/znks/service/LockRecordService.java
View file @
6cc1b012
...
@@ -6,6 +6,7 @@ import com.adc.da.znks.dao.DeviceDao;
...
@@ -6,6 +6,7 @@ import com.adc.da.znks.dao.DeviceDao;
import
com.adc.da.znks.dao.LockRecordDao
;
import
com.adc.da.znks.dao.LockRecordDao
;
import
com.adc.da.znks.entity.Device
;
import
com.adc.da.znks.entity.Device
;
import
com.adc.da.znks.entity.LockRecord
;
import
com.adc.da.znks.entity.LockRecord
;
import
com.adc.da.znks.vo.LockRecordVO
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -64,4 +65,12 @@ public class LockRecordService extends BaseService<LockRecord, String> {
...
@@ -64,4 +65,12 @@ public class LockRecordService extends BaseService<LockRecord, String> {
}
}
return
result
;
return
result
;
}
}
/**
* list lock record vos
* **/
public
List
<
LockRecordVO
>
listLockRecordVOs
(
String
phone
,
String
deviceName
,
Integer
pageNum
,
Integer
pageSize
){
return
dao
.
getLockRecordVOs
(
phone
,
deviceName
,
pageNum
,
pageSize
);
}
}
}
adc-da-main/src/main/java/com/adc/da/znks/service/UserService.java
View file @
6cc1b012
...
@@ -4,10 +4,14 @@ package com.adc.da.znks.service;
...
@@ -4,10 +4,14 @@ package com.adc.da.znks.service;
import
com.adc.da.base.service.BaseService
;
import
com.adc.da.base.service.BaseService
;
import
com.adc.da.util.utils.CollectionUtils
;
import
com.adc.da.util.utils.CollectionUtils
;
import
com.adc.da.util.utils.UUID
;
import
com.adc.da.util.utils.UUID
;
import
com.adc.da.znks.dao.PositionDao
;
import
com.adc.da.znks.dao.UserDao
;
import
com.adc.da.znks.dao.UserDao
;
import
com.adc.da.znks.entity.Position
;
import
com.adc.da.znks.entity.User
;
import
com.adc.da.znks.entity.User
;
import
com.adc.da.znks.page.UserPage
;
import
com.adc.da.znks.page.UserPage
;
import
com.adc.da.znks.util.SecurityUtils
;
import
com.adc.da.znks.util.SecurityUtils
;
import
com.adc.da.znks.vo.UserSearch
;
import
com.adc.da.znks.vo.UserVO
;
import
org.apache.http.util.Asserts
;
import
org.apache.http.util.Asserts
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -36,6 +40,10 @@ public class UserService extends BaseService<User, String> {
...
@@ -36,6 +40,10 @@ public class UserService extends BaseService<User, String> {
@Autowired
(
required
=
false
)
@Autowired
(
required
=
false
)
private
UserDao
dao
;
private
UserDao
dao
;
@Autowired
(
required
=
false
)
private
PositionDao
positionDao
;
@Override
@Override
public
UserDao
getDao
()
{
public
UserDao
getDao
()
{
return
dao
;
return
dao
;
...
@@ -141,4 +149,14 @@ public class UserService extends BaseService<User, String> {
...
@@ -141,4 +149,14 @@ public class UserService extends BaseService<User, String> {
public
List
<
Map
<
String
,
Object
>>
queryClientByMac
(
String
macAddress
){
public
List
<
Map
<
String
,
Object
>>
queryClientByMac
(
String
macAddress
){
return
dao
.
queryClientByMac
(
macAddress
);
return
dao
.
queryClientByMac
(
macAddress
);
}
}
/**
* 获取用户列表记录
* **/
public
List
<
UserVO
>
listUserVOsByCondition
(
UserSearch
userSearch
,
Integer
pageNUm
,
Integer
pageSize
){
List
<
UserVO
>
userVOS
=
dao
.
listUserVOs
(
userSearch
,
pageNUm
,
pageSize
);
return
userVOS
;
}
}
}
adc-da-main/src/main/java/com/adc/da/znks/util/Base64Utils.java
0 → 100644
View file @
6cc1b012
package
com
.
adc
.
da
.
znks
.
util
;
import
sun.misc.BASE64Decoder
;
import
sun.misc.BASE64Encoder
;
import
java.io.IOException
;
import
java.nio.charset.Charset
;
/**
* @author ley
* **/
public
class
Base64Utils
{
/**
* byte to base64
**/
public
static
String
encode
(
byte
[]
bytes
)
{
BASE64Encoder
base64Encoder
=
new
BASE64Encoder
();
return
base64Encoder
.
encode
(
bytes
);
}
/**
* base64 to byte
**/
public
static
byte
[]
decode
(
String
base64
)
throws
IOException
{
BASE64Decoder
base64Decoder
=
new
BASE64Decoder
();
return
base64Decoder
.
decodeBuffer
(
base64
);
}
public
static
void
main
(
String
[]
args
)
throws
IOException
{
final
String
testString
=
"hello,i am chenkangxian,good night!"
;
System
.
out
.
println
(
encode
(
testString
.
getBytes
()));
String
base64Str
=
"aGVsbG8saSBhbSBjaGVua2FuZ3hpYW4sZ29vZCBuaWdodCE="
;
System
.
out
.
println
(
new
String
(
decode
(
base64Str
),
Charset
.
defaultCharset
()));
}
}
adc-da-main/src/main/java/com/adc/da/znks/vo/AdminSearch.java
0 → 100644
View file @
6cc1b012
package
com
.
adc
.
da
.
znks
.
vo
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
org.springframework.util.StringUtils
;
/**
* @author ley
**/
public
class
AdminSearch
{
private
String
createTime1
;
@JSONField
(
format
=
"yyyy-MM-dd"
)
private
String
createTime2
;
@JSONField
(
format
=
"yyyy-MM-dd"
)
private
String
adminName
;
public
String
getCreateTime1
()
{
return
createTime1
;
}
public
void
setCreateTime1
(
String
createTime1
)
{
this
.
createTime1
=
createTime1
;
}
public
String
getCreateTime2
()
{
return
createTime2
;
}
public
void
setCreateTime2
(
String
createTime2
)
{
this
.
createTime2
=
createTime2
;
}
public
String
getAdminName
()
{
return
adminName
;
}
public
void
setAdminName
(
String
adminName
)
{
this
.
adminName
=
adminName
;
}
}
adc-da-main/src/main/java/com/adc/da/znks/vo/AdminVO.java
0 → 100644
View file @
6cc1b012
package
com
.
adc
.
da
.
znks
.
vo
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
java.util.Date
;
/**
* @author ley
* **/
public
class
AdminVO
{
private
String
adminName
;
@JSONField
(
format
=
"yyyy-MM-dd"
)
private
String
createTime
;
public
String
getAdminName
()
{
return
adminName
;
}
public
void
setAdminName
(
String
adminName
)
{
this
.
adminName
=
adminName
;
}
public
String
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
String
createTime
)
{
this
.
createTime
=
createTime
;
}
}
adc-da-main/src/main/java/com/adc/da/znks/vo/LockRecordVO.java
0 → 100644
View file @
6cc1b012
package
com
.
adc
.
da
.
znks
.
vo
;
import
com.alibaba.fastjson.annotation.JSONField
;
public
class
LockRecordVO
{
/**
* 设备名
* **/
private
String
deviceName
;
/**
* 锁类型
* **/
private
String
lockType
;
/**
* 手机号
* **/
private
String
telphone
;
/**
* 锁上用户
* **/
private
String
lockUser
;
/**
* 时间
*
* **/
@JSONField
(
format
=
"yyyy-MM-dd HH:mm:ss"
)
private
String
lockTime
;
public
String
getDeviceName
()
{
return
deviceName
;
}
public
void
setDeviceName
(
String
deviceName
)
{
this
.
deviceName
=
deviceName
;
}
public
String
getLockType
()
{
return
lockType
;
}
public
void
setLockType
(
String
lockType
)
{
this
.
lockType
=
lockType
;
}
public
String
getTelphone
()
{
return
telphone
;
}
public
void
setTelphone
(
String
telphone
)
{
this
.
telphone
=
telphone
;
}
public
String
getLockUser
()
{
return
lockUser
;
}
public
void
setLockUser
(
String
lockUser
)
{
this
.
lockUser
=
lockUser
;
}
public
String
getLockTime
()
{
return
lockTime
;
}
public
void
setLockTime
(
String
lockTime
)
{
this
.
lockTime
=
lockTime
;
}
}
adc-da-main/src/main/java/com/adc/da/znks/vo/UserSearch.java
0 → 100644
View file @
6cc1b012
package
com
.
adc
.
da
.
znks
.
vo
;
/**
* user search
* **/
public
class
UserSearch
{
private
String
createTime1
;
private
String
telphone
;
private
String
createTime2
;
public
String
getCreateTime1
()
{
return
createTime1
;
}
public
void
setCreateTime1
(
String
createTime1
)
{
this
.
createTime1
=
createTime1
;
}
public
String
getTelphone
()
{
return
telphone
;
}
public
void
setTelphone
(
String
telphone
)
{
this
.
telphone
=
telphone
;
}
public
String
getCreateTime2
()
{
return
createTime2
;
}
public
void
setCreateTime2
(
String
createTime2
)
{
this
.
createTime2
=
createTime2
;
}
}
adc-da-main/src/main/java/com/adc/da/znks/vo/UserVO.java
0 → 100644
View file @
6cc1b012
package
com
.
adc
.
da
.
znks
.
vo
;
import
com.alibaba.fastjson.annotation.JSONField
;
/**
*@author ley
* **/
public
class
UserVO
{
/**
* 创建时间
* **/
@JSONField
(
format
=
"yyyy-MM-dd"
)
private
String
createTime
;
/**
* app用户手机号
* **/
private
String
telphone
;
/**
* 设备数量
* **/
private
Integer
deviceNum
;
public
String
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
String
createTime
)
{
this
.
createTime
=
createTime
;
}
public
String
getTelphone
()
{
return
telphone
;
}
public
void
setTelphone
(
String
telphone
)
{
this
.
telphone
=
telphone
;
}
public
Integer
getDeviceNum
()
{
return
deviceNum
;
}
public
void
setDeviceNum
(
Integer
deviceNum
)
{
this
.
deviceNum
=
deviceNum
;
}
}
adc-da-main/src/main/resources/application-dev.properties
View file @
6cc1b012
...
@@ -13,6 +13,7 @@ spring.datasource.username = root
...
@@ -13,6 +13,7 @@ spring.datasource.username = root
#后端端口
#后端端口
server.port
=
8888
server.port
=
8888
#server.port=${random.int(8000,9000)}
useSSL
=
false
useSSL
=
false
...
...
adc-da-main/src/main/resources/application-prd.properties
View file @
6cc1b012
...
@@ -7,10 +7,10 @@ spring.datasource.username = adc_platform
...
@@ -7,10 +7,10 @@ spring.datasource.username = adc_platform
spring.datasource.password
=
adc_platform
spring.datasource.password
=
adc_platform
#后端端口
#后端端口
server.port
=
8080
server.port
=
${random.int(8000,9000)}
#验证码后台模式:1为不开启,2为开启,3为三次输错用户名或密码才开启,默认为1
#验证码后台模式:1为不开启,2为开启,3为三次输错用户名或密码才开启,默认为1
verifyCodeMode
=
1
verifyCodeMode
=
1
#密码Base64加密开关,true为开启,false为关闭
#密码Base64加密开关,true为开启,false为关闭
isPassEncrypted
=
false
isPassEncrypted
=
false
\ No newline at end of file
adc-da-main/src/main/resources/application.properties
View file @
6cc1b012
...
@@ -8,7 +8,6 @@
...
@@ -8,7 +8,6 @@
#spring.datasource.password = root
#spring.datasource.password = root
# ===============================
# ===============================
# = DATA SOURCE2
# = DATA SOURCE2
# ===============================
# ===============================
...
@@ -56,6 +55,11 @@ server.port=7777
...
@@ -56,6 +55,11 @@ server.port=7777
mybatis.config-locations
=
classpath:mybatis/mybatis-config.xml
mybatis.config-locations
=
classpath:mybatis/mybatis-config.xml
mybatis.mapper-locations
=
classpath*:mybatis/mapper/**/*.xml
mybatis.mapper-locations
=
classpath*:mybatis/mapper/**/*.xml
# mybatis pagehelper
pagehelper.params
=
pageNum=pageNum;pageSize=pageSize;
pagehelper.reasonable
=
true
pagehelper.support-methods-arguments
=
true
#显示sql
#显示sql
spring.profiles.active
=
dev
spring.profiles.active
=
dev
logging.level.com.adc
=
DEBUG
logging.level.com.adc
=
DEBUG
...
...
adc-da-main/src/main/resources/mybatis/mapper/znks/AdminMapper.xml
0 → 100644
View file @
6cc1b012
<?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.adc.da.znks.dao.AdminDao"
>
<!-- Result Map-->
<resultMap
id=
"BaseResultMap"
type=
"com.adc.da.znks.vo.AdminVO"
>
<result
column=
"admin_name"
property=
"adminName"
/>
<result
column=
"create_time"
property=
"createTime"
/>
</resultMap>
<!-- tb_position table all fields -->
<sql
id=
"Base_Column_List"
>
a.admin_name,a.create_time
</sql>
<update
id=
"updateAdmin"
parameterType=
"com.adc.da.znks.entity.Admin"
>
update tb_admin
<set>
<if
test=
"name != null and name != ''"
>
admin_name = #{name},
</if>
<if
test=
"password != null and password != ''"
>
admin_password = #{password},
</if>
</set>
<where>
admin_id = #{adminId}
</where>
</update>
<select
id=
"listAdminsByCondition"
parameterType=
"object"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tb_admin a
<where>
<trim
suffixOverrides=
"and"
>
<if
test=
"adminSearch.adminName!=null and adminSearch.adminName!= '' "
>
<bind
name=
"nameLike"
value=
"'%'+adminSearch.adminName+'%'"
/>
a.admin_name LIKE #{nameLike} and
</if>
<if
test=
"adminSearch.createTime1!=null"
>
a.create_time >= #{adminSearch.createTime1} and
</if>
<if
test=
"adminSearch.createTime2!=null"
>
a.create_time
<
= #{adminSearch.createTime2} and
</if>
</trim>
</where>
</select>
</mapper>
adc-da-main/src/main/resources/mybatis/mapper/znks/LockRecordMapper.xml
View file @
6cc1b012
...
@@ -29,4 +29,32 @@
...
@@ -29,4 +29,32 @@
insert into tb_lock_record(time,user,device_id,lock_type) values(#{time},#{user},#{deviceId},#{lockType})
insert into tb_lock_record(time,user,device_id,lock_type) values(#{time},#{user},#{deviceId},#{lockType})
</insert>
</insert>
<resultMap
id=
"lockRecordVOMap"
type=
"com.adc.da.znks.vo.LockRecordVO"
>
<result
column=
"telphone"
property=
"telphone"
/>
<result
column=
"deviceName"
property=
"deviceName"
/>
<result
column=
"lockType"
property=
"lockType"
/>
<result
column=
"lockUser"
property=
"lockUser"
/>
<result
column=
"lockTime"
property=
"lockTime"
/>
</resultMap>
<select
id=
"getLockRecordVOs"
parameterType=
"object"
resultMap=
"lockRecordVOMap"
>
select u.temphone as telphone,d.name as deviceName,lr.user as lockUser,
lr.lock_type as lockType,lr.time as lockTime
from tb_lock_record lr,tb_device d,tb_user u
<where>
<if
test=
"deviceName!=null and deviceName!=''"
>
<bind
name=
"deviceNameLike"
value=
"'%'+deviceName+'%'"
/>
d.name LIKE #{deviceNameLike} and
</if>
<if
test=
"telphone!=null and telphone !=''"
>
<bind
name=
"telphoneLike"
value=
"'%'+telphone+'%'"
/>
u.temphone LIKE #{telphoneLike} and
</if>
u.id = d.user_id and
d.code = lr.device_id
and lr.lock_type != ''
</where>
</select>
</mapper>
</mapper>
adc-da-main/src/main/resources/mybatis/mapper/znks/UserEOMapper.xml
View file @
6cc1b012
...
@@ -145,4 +145,33 @@
...
@@ -145,4 +145,33 @@
g.mac_address = #{macAddress}
g.mac_address = #{macAddress}
</select>
</select>
<resultMap
id=
"userVOMap"
type=
"com.adc.da.znks.vo.UserVO"
>
<result
column=
"createTime"
property=
"createTime"
/>
<result
column=
"telphone"
property=
"telphone"
/>
<result
column=
"deviceNum"
property=
"deviceNum"
/>
</resultMap>
<select
id=
"listUserVOs"
parameterType=
"object"
resultMap=
"userVOMap"
>
SELECT u.`create_time` AS createTime,u.`temphone` AS telphone,COUNT(d.`id`) AS deviceNum FROM tb_user u
LEFT JOIN tb_device d ON u.`id` = d.`user_id`
<where>
<trim
suffixOverrides=
"and"
>
<if
test=
"userSearch.telphone != null and userSearch.telphone != ''"
>
<bind
name=
"telphoneLike"
value=
"'%'+userSearch.telphone+'%'"
/>
u.`temphone` LIKE #{telphoneLike} and
</if>
<if
test=
"userSearch.createTime1!=null"
>
u.create_time >= #{userSearch.createTime1} and
</if>
<if
test=
"userSearch.createTime2!=null"
>
u.create_time
<
= #{userSearch.createTime2} and
</if>
</trim>
</where>
GROUP BY u.`id`
</select>
</mapper>
</mapper>
adc-da-main/src/main/resources/mybatis/mybatis-config.xml
View file @
6cc1b012
...
@@ -4,6 +4,11 @@
...
@@ -4,6 +4,11 @@
<configuration>
<configuration>
<!-- 全局参数 -->
<!-- 全局参数 -->
<settings>
<settings>
<!-- 延迟加载的开关,开启时,所有的关联对象都会延迟加载,默认为false -->
<setting
name=
"lazyLoadingEnabled"
value=
"true"
/>
<!-- 属性启用时,会使带有延迟加载属性的对象立即加载,默认为true -->
<setting
name=
"aggressiveLazyLoading"
value=
"false"
/>
<setting
name=
"logImpl"
value=
"STDOUT_LOGGING"
/>
<setting
name=
"callSettersOnNulls"
value=
"true"
/>
<setting
name=
"callSettersOnNulls"
value=
"true"
/>
</settings>
</settings>
<!-- 配置别名用 -->
<!-- 配置别名用 -->
...
@@ -11,4 +16,5 @@
...
@@ -11,4 +16,5 @@
</typeAliases>
</typeAliases>
</configuration>
</configuration>
\ No newline at end of file
adc-da-main/src/test/java/com/adc/da/gen/CodeUtil.java
View file @
6cc1b012
...
@@ -22,7 +22,7 @@ public class CodeUtil {
...
@@ -22,7 +22,7 @@ public class CodeUtil {
entityPackage
=
"entity"
;
entityPackage
=
"entity"
;
DbCodeGenerateFactory
.
codeGenerate
(
"tb_
positio
n"
,
entityPackage
);
DbCodeGenerateFactory
.
codeGenerate
(
"tb_
admi
n"
,
entityPackage
);
// DbCodeGenerateFactory.codeGenerate("TS_ROLE", entityPackage);
// DbCodeGenerateFactory.codeGenerate("TS_ROLE", entityPackage);
// DbCodeGenerateFactory.codeGenerate("TS_MENU", entityPackage);
// DbCodeGenerateFactory.codeGenerate("TS_MENU", entityPackage);
...
...
adc-da-main/target/classes/application-dev.properties
View file @
6cc1b012
...
@@ -13,6 +13,7 @@ spring.datasource.username = root
...
@@ -13,6 +13,7 @@ spring.datasource.username = root
#后端端口
#后端端口
server.port
=
8888
server.port
=
8888
#server.port=${random.int(8000,9000)}
useSSL
=
false
useSSL
=
false
...
...
adc-da-main/target/classes/application-prd.properties
View file @
6cc1b012
...
@@ -7,10 +7,10 @@ spring.datasource.username = adc_platform
...
@@ -7,10 +7,10 @@ spring.datasource.username = adc_platform
spring.datasource.password
=
adc_platform
spring.datasource.password
=
adc_platform
#后端端口
#后端端口
server.port
=
8080
server.port
=
${random.int(8000,9000)}
#验证码后台模式:1为不开启,2为开启,3为三次输错用户名或密码才开启,默认为1
#验证码后台模式:1为不开启,2为开启,3为三次输错用户名或密码才开启,默认为1
verifyCodeMode
=
1
verifyCodeMode
=
1
#密码Base64加密开关,true为开启,false为关闭
#密码Base64加密开关,true为开启,false为关闭
isPassEncrypted
=
false
isPassEncrypted
=
false
\ No newline at end of file
adc-da-main/target/classes/application.properties
View file @
6cc1b012
...
@@ -8,7 +8,6 @@
...
@@ -8,7 +8,6 @@
#spring.datasource.password = root
#spring.datasource.password = root
# ===============================
# ===============================
# = DATA SOURCE2
# = DATA SOURCE2
# ===============================
# ===============================
...
@@ -56,6 +55,11 @@ server.port=7777
...
@@ -56,6 +55,11 @@ server.port=7777
mybatis.config-locations
=
classpath:mybatis/mybatis-config.xml
mybatis.config-locations
=
classpath:mybatis/mybatis-config.xml
mybatis.mapper-locations
=
classpath*:mybatis/mapper/**/*.xml
mybatis.mapper-locations
=
classpath*:mybatis/mapper/**/*.xml
# mybatis pagehelper
pagehelper.params
=
pageNum=pageNum;pageSize=pageSize;
pagehelper.reasonable
=
true
pagehelper.support-methods-arguments
=
true
#显示sql
#显示sql
spring.profiles.active
=
dev
spring.profiles.active
=
dev
logging.level.com.adc
=
DEBUG
logging.level.com.adc
=
DEBUG
...
...
adc-da-main/target/classes/mybatis/mybatis-config.xml
View file @
6cc1b012
...
@@ -4,6 +4,11 @@
...
@@ -4,6 +4,11 @@
<configuration>
<configuration>
<!-- 全局参数 -->
<!-- 全局参数 -->
<settings>
<settings>
<!-- 延迟加载的开关,开启时,所有的关联对象都会延迟加载,默认为false -->
<setting
name=
"lazyLoadingEnabled"
value=
"true"
/>
<!-- 属性启用时,会使带有延迟加载属性的对象立即加载,默认为true -->
<setting
name=
"aggressiveLazyLoading"
value=
"false"
/>
<setting
name=
"logImpl"
value=
"STDOUT_LOGGING"
/>
<setting
name=
"callSettersOnNulls"
value=
"true"
/>
<setting
name=
"callSettersOnNulls"
value=
"true"
/>
</settings>
</settings>
<!-- 配置别名用 -->
<!-- 配置别名用 -->
...
@@ -11,4 +16,5 @@
...
@@ -11,4 +16,5 @@
</typeAliases>
</typeAliases>
</configuration>
</configuration>
\ No newline at end of file
adc-da-main/target/test-classes/com/adc/da/gen/CodeUtil.class
View file @
6cc1b012
No preview for this file type
adc-da.iml
0 → 100644
View file @
6cc1b012
<?xml version="1.0" encoding="UTF-8"?>
<module
org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule=
"true"
version=
"4"
>
<component
name=
"NewModuleRootManager"
LANGUAGE_LEVEL=
"JDK_1_7"
>
<output
url=
"file://$MODULE_DIR$/target/classes"
/>
<output-test
url=
"file://$MODULE_DIR$/target/test-classes"
/>
<content
url=
"file://$MODULE_DIR$"
>
<excludeFolder
url=
"file://$MODULE_DIR$/target"
/>
</content>
<orderEntry
type=
"inheritedJdk"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
</component>
</module>
\ No newline at end of file
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