Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ioc_sixiang_license
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
zengtianlai3
ioc_sixiang_license
Commits
e7e1a2d4
Commit
e7e1a2d4
authored
Jun 08, 2022
by
zengtianlai3
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'm33' into 'master'
完善剩余接口 See merge request
!5
parents
9f33c1b4
bd82e7c6
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
566 additions
and
146 deletions
+566
-146
DeviceController.java
...java/iot/sixiang/license/controller/DeviceController.java
+40
-13
DeviceTypeController.java
.../iot/sixiang/license/controller/DeviceTypeController.java
+6
-12
LicenseController.java
...ava/iot/sixiang/license/controller/LicenseController.java
+10
-9
ServerController.java
...java/iot/sixiang/license/controller/ServerController.java
+10
-9
UserController.java
...n/java/iot/sixiang/license/controller/UserController.java
+30
-19
Device.java
license/src/main/java/iot/sixiang/license/entity/Device.java
+7
-2
DeviceType.java
.../src/main/java/iot/sixiang/license/entity/DeviceType.java
+1
-1
License.java
...nse/src/main/java/iot/sixiang/license/entity/License.java
+1
-1
User.java
license/src/main/java/iot/sixiang/license/entity/User.java
+1
-1
DeviceMapper.java
...rc/main/java/iot/sixiang/license/mapper/DeviceMapper.java
+3
-1
DeviceTypeMapper.java
...ain/java/iot/sixiang/license/mapper/DeviceTypeMapper.java
+2
-5
UserMapper.java
.../src/main/java/iot/sixiang/license/mapper/UserMapper.java
+8
-3
BaseResult.java
...e/src/main/java/iot/sixiang/license/model/BaseResult.java
+55
-0
PageInfoModel.java
...rc/main/java/iot/sixiang/license/model/PageInfoModel.java
+12
-0
PageResult.java
...e/src/main/java/iot/sixiang/license/model/PageResult.java
+32
-0
UserVo.java
...se/src/main/java/iot/sixiang/license/model/vo/UserVo.java
+10
-0
DeviceService.java
.../main/java/iot/sixiang/license/service/DeviceService.java
+5
-4
DeviceTypeService.java
...n/java/iot/sixiang/license/service/DeviceTypeService.java
+2
-2
UserService.java
...rc/main/java/iot/sixiang/license/service/UserService.java
+7
-9
DeviceServiceImpl.java
...a/iot/sixiang/license/service/impl/DeviceServiceImpl.java
+31
-5
DeviceTypeServiceImpl.java
...t/sixiang/license/service/impl/DeviceTypeServiceImpl.java
+3
-10
UserServiceImpl.java
...ava/iot/sixiang/license/service/impl/UserServiceImpl.java
+25
-13
CommonUtil.java
...se/src/main/java/iot/sixiang/license/util/CommonUtil.java
+236
-0
DeviceMapper.xml
license/src/main/resources/mapper/DeviceMapper.xml
+10
-6
DeviceTypeMapper.xml
license/src/main/resources/mapper/DeviceTypeMapper.xml
+5
-20
UserMapper.xml
license/src/main/resources/mapper/UserMapper.xml
+14
-1
No files found.
license/src/main/java/iot/sixiang/license/controller/DeviceController.java
View file @
e7e1a2d4
...
...
@@ -2,14 +2,13 @@ package iot.sixiang.license.controller;
import
com.alibaba.fastjson.JSONObject
;
import
iot.sixiang.license.model.RespResult
;
import
iot.sixiang.license.model.BaseResult
;
import
iot.sixiang.license.model.PageInfoModel
;
import
iot.sixiang.license.model.PageResult
;
import
iot.sixiang.license.model.vo.DeviceTypeVo
;
import
iot.sixiang.license.service.DeviceService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
...
...
@@ -27,19 +26,47 @@ public class DeviceController {
@Autowired
private
DeviceService
deviceService
;
/**
*
可按条件分页查询所有的user
*
添加device
* @param jsonObject
* @return
*/
@PostMapping
(
"add"
)
public
BaseResult
addDevice
(
@RequestBody
JSONObject
jsonObject
)
{
int
userId
=
jsonObject
.
getInteger
(
"user_id"
);
int
typeId
=
jsonObject
.
getInteger
(
"type_id"
);
int
count
=
jsonObject
.
getInteger
(
"count"
);
boolean
res
=
deviceService
.
addDevice
(
userId
,
typeId
,
count
);
if
(
res
)
{
return
BaseResult
.
success
();
}
else
{
return
BaseResult
.
fail
();
}
}
/**
* 可按条件分页查询所有的user
* @param pageNo
* @param pageSize
* @param typeName
* @param userId
* @return
*/
@GetMapping
(
"list"
)
public
RespResult
getDeviceList
(
@RequestBody
JSONObject
jsonObject
)
{
int
pageNo
=
(
int
)
jsonObject
.
get
(
"page_no"
);
int
pageSize
=
(
int
)
jsonObject
.
get
(
"page_size"
);
String
typeName
=
jsonObject
.
getString
(
"type_name"
);
String
userId
=
jsonObject
.
getString
(
"user_id"
);
List
<
DeviceTypeVo
>
records
=
deviceService
.
getDeviceList
(
pageNo
,
pageSize
,
typeName
,
userId
);
return
RespResult
.
success
().
record
(
records
);
public
PageResult
getDeviceList
(
@RequestParam
(
"page_no"
)
int
pageNo
,
@RequestParam
(
"page_size"
)
int
pageSize
,
@RequestParam
(
value
=
"type_name"
,
required
=
false
)
String
typeName
,
@RequestParam
(
value
=
"user_id"
,
required
=
false
)
Integer
userId
)
{
PageInfoModel
<
DeviceTypeVo
>
records
=
deviceService
.
getDeviceList
(
pageNo
,
pageSize
,
typeName
,
userId
);
int
total
=
records
.
getTotal
();
int
pages
=
total
/
pageSize
;
//pages为总页数
int
mod
=
total
%
pageSize
;
if
(
mod
!=
0
){
pages
=
pages
+
1
;
}
List
<
DeviceTypeVo
>
pageResult
=
records
.
getResult
();
return
new
PageResult
(
200
,
"查找成功"
,
pageNo
,
pages
,
total
,
pageResult
);
}
}
license/src/main/java/iot/sixiang/license/controller/DeviceTypeController.java
View file @
e7e1a2d4
package
iot
.
sixiang
.
license
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
iot.sixiang.license.entity.DeviceType
;
import
iot.sixiang.license.model.RespResult
;
import
iot.sixiang.license.model.vo.DeviceTypeVo
;
import
iot.sixiang.license.service.DeviceTypeService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -29,17 +27,13 @@ public class DeviceTypeController {
private
DeviceTypeService
deviceTypeService
;
/**
*
可按条件分页查询所有的user
* @param
jsonObject
*
查询所有的device_type
* @param
* @return
*/
@GetMapping
(
"list"
)
public
RespResult
getDeviceTypeList
(
@RequestBody
JSONObject
jsonObject
)
{
int
pageNo
=
(
int
)
jsonObject
.
get
(
"page_no"
);
int
pageSize
=
(
int
)
jsonObject
.
get
(
"page_size"
);
String
typeName
=
jsonObject
.
getString
(
"type_name"
);
String
userId
=
jsonObject
.
getString
(
"user_id"
);
List
<
DeviceTypeVo
>
records
=
deviceTypeService
.
getDeviceTypeList
(
pageNo
,
pageSize
,
typeName
,
userId
);
@GetMapping
(
"type"
)
public
RespResult
getDeviceTypeList
()
{
List
<
DeviceType
>
records
=
deviceTypeService
.
getDeviceTypeList
();
return
RespResult
.
success
().
record
(
records
);
}
}
...
...
license/src/main/java/iot/sixiang/license/controller/LicenseController.java
View file @
e7e1a2d4
...
...
@@ -3,6 +3,7 @@ package iot.sixiang.license.controller;
import
com.alibaba.fastjson.JSONObject
;
import
iot.sixiang.license.entity.License
;
import
iot.sixiang.license.model.BaseResult
;
import
iot.sixiang.license.model.RespResult
;
import
iot.sixiang.license.service.LicenseService
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -31,15 +32,15 @@ public class LicenseController {
* @return
*/
@PostMapping
(
"add"
)
public
Resp
Result
addLicense
(
@RequestBody
JSONObject
jsonObject
){
public
Base
Result
addLicense
(
@RequestBody
JSONObject
jsonObject
){
String
appId
=
jsonObject
.
getString
(
"app_id"
);
String
appKey
=
jsonObject
.
getString
(
"app_key"
);
String
userId
=
jsonObject
.
getString
(
"user_id"
);
boolean
res
=
licenseService
.
addLicense
(
appId
,
appKey
,
userId
);
if
(
res
)
{
return
Resp
Result
.
success
();
return
Base
Result
.
success
();
}
else
{
return
Resp
Result
.
fail
();
return
Base
Result
.
fail
();
}
}
...
...
@@ -49,12 +50,12 @@ public class LicenseController {
* @return
*/
@PostMapping
(
"delete"
)
public
Resp
Result
deleteLicense
(
@RequestParam
(
"app_id"
)
String
appId
)
{
public
Base
Result
deleteLicense
(
@RequestParam
(
"app_id"
)
String
appId
)
{
boolean
res
=
licenseService
.
deleteLicense
(
appId
);
if
(
res
)
{
return
Resp
Result
.
success
();
return
Base
Result
.
success
();
}
else
{
return
Resp
Result
.
fail
();
return
Base
Result
.
fail
();
}
}
...
...
@@ -64,15 +65,15 @@ public class LicenseController {
* @return
*/
@PostMapping
(
"update"
)
public
Resp
Result
updateLicense
(
@RequestBody
JSONObject
jsonObject
){
public
Base
Result
updateLicense
(
@RequestBody
JSONObject
jsonObject
){
String
appId
=
jsonObject
.
getString
(
"app_id"
);
String
appKey
=
jsonObject
.
getString
(
"app_key"
);
String
userId
=
jsonObject
.
getString
(
"user_id"
);
boolean
res
=
licenseService
.
updateLicense
(
appId
,
appKey
,
userId
);
if
(
res
)
{
return
Resp
Result
.
success
();
return
Base
Result
.
success
();
}
else
{
return
Resp
Result
.
fail
();
return
Base
Result
.
fail
();
}
}
...
...
license/src/main/java/iot/sixiang/license/controller/ServerController.java
View file @
e7e1a2d4
...
...
@@ -3,6 +3,7 @@ package iot.sixiang.license.controller;
import
com.alibaba.fastjson.JSONObject
;
import
iot.sixiang.license.entity.Server
;
import
iot.sixiang.license.model.BaseResult
;
import
iot.sixiang.license.model.RespResult
;
import
iot.sixiang.license.service.ServerService
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -31,14 +32,14 @@ public class ServerController {
* @return
*/
@PostMapping
(
"add"
)
public
Resp
Result
addServer
(
@RequestBody
JSONObject
jsonObject
)
{
public
Base
Result
addServer
(
@RequestBody
JSONObject
jsonObject
)
{
String
serverIp
=
jsonObject
.
getString
(
"server_ip"
);
int
port
=
jsonObject
.
getInteger
(
"port"
);
boolean
res
=
serverService
.
addServer
(
serverIp
,
port
);
if
(
res
)
{
return
Resp
Result
.
success
();
return
Base
Result
.
success
();
}
else
{
return
Resp
Result
.
fail
();
return
Base
Result
.
fail
();
}
}
...
...
@@ -48,12 +49,12 @@ public class ServerController {
* @return
*/
@PostMapping
(
"delete"
)
public
Resp
Result
deleteServer
(
@RequestParam
(
"server_ip"
)
String
serverIp
)
{
public
Base
Result
deleteServer
(
@RequestParam
(
"server_ip"
)
String
serverIp
)
{
boolean
res
=
serverService
.
deleteServer
(
serverIp
);
if
(
res
)
{
return
Resp
Result
.
success
();
return
Base
Result
.
success
();
}
else
{
return
Resp
Result
.
fail
();
return
Base
Result
.
fail
();
}
}
...
...
@@ -63,14 +64,14 @@ public class ServerController {
* @return
*/
@PostMapping
(
"update"
)
public
Resp
Result
updateServer
(
@RequestBody
JSONObject
jsonObject
)
{
public
Base
Result
updateServer
(
@RequestBody
JSONObject
jsonObject
)
{
String
serverIp
=
jsonObject
.
getString
(
"server_ip"
);
int
port
=
jsonObject
.
getInteger
(
"port"
);
boolean
res
=
serverService
.
updateServer
(
serverIp
,
port
);
if
(
res
)
{
return
Resp
Result
.
success
();
return
Base
Result
.
success
();
}
else
{
return
Resp
Result
.
fail
();
return
Base
Result
.
fail
();
}
}
...
...
license/src/main/java/iot/sixiang/license/controller/UserController.java
View file @
e7e1a2d4
package
iot
.
sixiang
.
license
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
iot.sixiang.license.entity.User
;
import
iot.sixiang.license.model.RespResult
;
import
iot.sixiang.license.model.BaseResult
;
import
iot.sixiang.license.model.PageInfoModel
;
import
iot.sixiang.license.model.PageResult
;
import
iot.sixiang.license.model.vo.UserVo
;
import
iot.sixiang.license.service.UserService
;
import
iot.sixiang.license.util.CommonUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -32,14 +34,15 @@ public class UserController {
* @return
*/
@PostMapping
(
"add"
)
public
RespResult
addUser
(
@RequestBody
JSONObject
jsonObject
)
{
String
userId
=
(
String
)
jsonObject
.
get
(
"user_id"
);
String
password
=
(
String
)
jsonObject
.
get
(
"password"
);
boolean
res
=
userService
.
addUser
(
userId
,
password
);
public
BaseResult
addUser
(
@RequestBody
JSONObject
jsonObject
)
{
String
userName
=
(
String
)
jsonObject
.
get
(
"user_name"
);
String
company
=
(
String
)
jsonObject
.
get
(
"company"
);
String
password
=
CommonUtil
.
genRandomNum
(
18
);
boolean
res
=
userService
.
addUser
(
userName
,
company
,
password
);
if
(
res
)
{
return
Resp
Result
.
success
();
return
Base
Result
.
success
();
}
else
{
return
Resp
Result
.
fail
();
return
Base
Result
.
fail
();
}
}
...
...
@@ -49,12 +52,12 @@ public class UserController {
* @return
*/
@PostMapping
(
"delete"
)
public
RespResult
deleteUser
(
@RequestParam
(
"user_id"
)
String
userId
)
{
public
BaseResult
deleteUser
(
@RequestParam
(
"user_id"
)
int
userId
)
{
boolean
res
=
userService
.
deleteUser
(
userId
);
if
(
res
)
{
return
Resp
Result
.
success
();
return
Base
Result
.
success
();
}
else
{
return
Resp
Result
.
fail
();
return
Base
Result
.
fail
();
}
}
...
...
@@ -64,14 +67,14 @@ public class UserController {
* @return
*/
@PostMapping
(
"update"
)
public
Resp
Result
updateUser
(
@RequestBody
JSONObject
jsonObject
)
{
String
userId
=
jsonObject
.
getString
(
"user_id"
);
public
Base
Result
updateUser
(
@RequestBody
JSONObject
jsonObject
)
{
int
userId
=
jsonObject
.
getInteger
(
"user_id"
);
String
password
=
jsonObject
.
getString
(
"password"
);
boolean
res
=
userService
.
updateUser
(
userId
,
password
);
if
(
res
)
{
return
Resp
Result
.
success
();
return
Base
Result
.
success
();
}
else
{
return
Resp
Result
.
fail
();
return
Base
Result
.
fail
();
}
}
...
...
@@ -83,9 +86,17 @@ public class UserController {
* @return
*/
@GetMapping
(
"list"
)
public
RespResult
getUserList
(
@RequestParam
(
"page_no"
)
int
pageNo
,
@RequestParam
(
"page_size"
)
int
pageSize
)
{
List
<
User
>
records
=
userService
.
getUserList
(
pageNo
,
pageSize
);
return
RespResult
.
success
().
record
(
records
);
public
PageResult
getUserList
(
@RequestParam
(
"page_no"
)
int
pageNo
,
@RequestParam
(
"page_size"
)
int
pageSize
,
@RequestParam
(
value
=
"user_name"
,
required
=
false
)
String
userName
,
@RequestParam
(
value
=
"company"
,
required
=
false
)
String
company
)
{
PageInfoModel
<
UserVo
>
records
=
userService
.
getUserList
(
pageNo
,
pageSize
,
userName
,
company
);
int
total
=
records
.
getTotal
();
int
pages
=
total
/
pageSize
;
//pages为总页数
int
mod
=
total
%
pageSize
;
if
(
mod
!=
0
){
pages
=
pages
+
1
;
}
List
<
UserVo
>
result
=
records
.
getResult
();
return
new
PageResult
(
200
,
"查找成功"
,
pageNo
,
pages
,
total
,
result
);
}
}
license/src/main/java/iot/sixiang/license/entity/Device.java
View file @
e7e1a2d4
package
iot
.
sixiang
.
license
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
...
...
@@ -21,11 +23,14 @@ public class Device implements Serializable {
private
static
final
long
serialVersionUID
=
1L
;
@TableId
(
type
=
IdType
.
AUTO
)
private
Integer
deviceId
;
private
String
sn
;
private
String
typeId
;
private
Integer
typeId
;
private
Long
userId
;
private
Integer
userId
;
}
license/src/main/java/iot/sixiang/license/entity/DeviceType.java
View file @
e7e1a2d4
...
...
@@ -21,7 +21,7 @@ public class DeviceType implements Serializable {
private
static
final
long
serialVersionUID
=
1L
;
private
Long
typeId
;
private
Integer
typeId
;
private
String
typeName
;
...
...
license/src/main/java/iot/sixiang/license/entity/License.java
View file @
e7e1a2d4
...
...
@@ -25,7 +25,7 @@ public class License implements Serializable {
private
String
appKey
;
private
Long
userId
;
private
Integer
userId
;
}
license/src/main/java/iot/sixiang/license/entity/User.java
View file @
e7e1a2d4
...
...
@@ -24,7 +24,7 @@ public class User implements Serializable {
private
static
final
long
serialVersionUID
=
1L
;
@TableId
(
type
=
IdType
.
AUTO
)
private
Long
userId
;
private
Integer
userId
;
private
String
password
;
...
...
license/src/main/java/iot/sixiang/license/mapper/DeviceMapper.java
View file @
e7e1a2d4
...
...
@@ -16,5 +16,7 @@ import java.util.List;
*/
public
interface
DeviceMapper
extends
BaseMapper
<
Device
>
{
List
<
DeviceTypeVo
>
getDeviceList
(
int
pageNo
,
int
pageSize
,
String
typeName
,
String
userId
);
List
<
DeviceTypeVo
>
getDeviceList
(
String
typeName
,
Integer
userId
);
boolean
addDevice
(
String
sn
,
int
userId
,
int
typeId
);
}
license/src/main/java/iot/sixiang/license/mapper/DeviceTypeMapper.java
View file @
e7e1a2d4
package
iot
.
sixiang
.
license
.
mapper
;
import
iot.sixiang.license.entity.DeviceType
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
iot.sixiang.license.
model.vo.DeviceTypeVo
;
import
iot.sixiang.license.
entity.DeviceType
;
import
java.util.List
;
...
...
@@ -16,7 +15,5 @@ import java.util.List;
*/
public
interface
DeviceTypeMapper
extends
BaseMapper
<
DeviceType
>
{
List
<
DeviceTypeVo
>
getAllList
();
List
<
DeviceTypeVo
>
getDeviceTypeList
(
int
pageNo
,
int
pageSize
,
String
typeName
,
String
userId
);
List
<
DeviceType
>
getDeviceTypeList
();
}
license/src/main/java/iot/sixiang/license/mapper/UserMapper.java
View file @
e7e1a2d4
...
...
@@ -2,6 +2,9 @@ package iot.sixiang.license.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
iot.sixiang.license.entity.User
;
import
iot.sixiang.license.model.vo.UserVo
;
import
java.util.List
;
/**
* <p>
...
...
@@ -14,9 +17,11 @@ import iot.sixiang.license.entity.User;
public
interface
UserMapper
extends
BaseMapper
<
User
>
{
boolean
deleteUser
(
String
user
);
boolean
deleteUser
(
int
user
);
boolean
addUser
(
String
userName
,
String
company
,
String
password
);
boolean
addUser
(
String
userId
,
String
password
);
boolean
updateUser
(
int
userId
,
String
password
);
boolean
updateUser
(
String
userId
,
String
password
);
List
<
UserVo
>
getUserList
(
String
userName
,
String
company
);
}
license/src/main/java/iot/sixiang/license/model/BaseResult.java
0 → 100644
View file @
e7e1a2d4
package
iot
.
sixiang
.
license
.
model
;
//@Data
public
class
BaseResult
{
private
int
code
;
private
String
msg
;
public
BaseResult
(
int
code
,
String
reason
)
{
super
();
this
.
code
=
code
;
this
.
msg
=
reason
;
}
public
BaseResult
()
{
super
();
// TODO Auto-generated constructor stub
}
public
static
BaseResult
success
()
{
BaseResult
respResult
=
new
BaseResult
();
respResult
.
setCode
(
200
);
respResult
.
setMsg
(
"success"
);
return
respResult
;
}
public
static
BaseResult
fail
()
{
BaseResult
respResult
=
new
BaseResult
();
respResult
.
setCode
(
400
);
respResult
.
setMsg
(
"fail"
);
return
respResult
;
}
public
BaseResult
msg
(
String
message
)
{
this
.
msg
=
message
;
return
this
;
}
public
int
getCode
()
{
return
code
;
}
public
void
setCode
(
int
code
)
{
this
.
code
=
code
;
}
public
String
getMsg
()
{
return
msg
;
}
public
void
setMsg
(
String
msg
)
{
this
.
msg
=
msg
;
}
}
license/src/main/java/iot/sixiang/license/model/PageInfoModel.java
0 → 100644
View file @
e7e1a2d4
package
iot
.
sixiang
.
license
.
model
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.List
;
@Data
public
class
PageInfoModel
<
T
>
{
private
int
total
;
private
List
<
T
>
result
=
new
ArrayList
<
T
>();
}
license/src/main/java/iot/sixiang/license/model/PageResult.java
0 → 100644
View file @
e7e1a2d4
package
iot
.
sixiang
.
license
.
model
;
import
lombok.Data
;
@Data
public
class
PageResult
{
private
int
code
;
private
String
msg
;
private
int
page_no
;
private
int
pages
;
private
int
total
;
private
Object
record
;
public
PageResult
(
int
code
,
String
msg
,
int
page_no
,
int
pages
,
int
total
,
Object
record
)
{
super
();
this
.
code
=
code
;
this
.
msg
=
msg
;
this
.
page_no
=
page_no
;
this
.
pages
=
pages
;
this
.
total
=
total
;
this
.
record
=
record
;
}
public
PageResult
()
{
super
();
// TODO Auto-generated constructor stub
}
}
license/src/main/java/iot/sixiang/license/model/vo/UserVo.java
0 → 100644
View file @
e7e1a2d4
package
iot
.
sixiang
.
license
.
model
.
vo
;
import
iot.sixiang.license.entity.User
;
/**
* Created by m33 on 2022/6/8 17:26
*/
public
class
UserVo
extends
User
{
public
int
count
;
}
license/src/main/java/iot/sixiang/license/service/DeviceService.java
View file @
e7e1a2d4
package
iot
.
sixiang
.
license
.
service
;
import
iot.sixiang.license.entity.Device
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
iot.sixiang.license.entity.Device
;
import
iot.sixiang.license.model.PageInfoModel
;
import
iot.sixiang.license.model.vo.DeviceTypeVo
;
import
java.util.List
;
/**
* <p>
* 服务类
...
...
@@ -16,5 +15,7 @@ import java.util.List;
*/
public
interface
DeviceService
extends
IService
<
Device
>
{
List
<
DeviceTypeVo
>
getDeviceList
(
int
pageNo
,
int
pageSize
,
String
typeName
,
String
userId
);
PageInfoModel
<
DeviceTypeVo
>
getDeviceList
(
int
pageNo
,
int
pageSize
,
String
typeName
,
Integer
userId
);
boolean
addDevice
(
int
userId
,
int
typeId
,
int
count
);
}
license/src/main/java/iot/sixiang/license/service/DeviceTypeService.java
View file @
e7e1a2d4
package
iot
.
sixiang
.
license
.
service
;
import
iot.sixiang.license.
model.vo.DeviceTypeVo
;
import
iot.sixiang.license.
entity.DeviceType
;
import
java.util.List
;
...
...
@@ -14,6 +14,6 @@ import java.util.List;
*/
public
interface
DeviceTypeService
{
List
<
DeviceType
Vo
>
getDeviceTypeList
(
int
pageNo
,
int
pageSize
,
String
typeName
,
String
userId
);
List
<
DeviceType
>
getDeviceTypeList
(
);
}
license/src/main/java/iot/sixiang/license/service/UserService.java
View file @
e7e1a2d4
package
iot
.
sixiang
.
license
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
iot.sixiang.license.entity.User
;
import
java.util.List
;
import
iot.sixiang.license.model.PageInfoModel
;
import
iot.sixiang.license.model.vo.UserVo
;
/**
* <p>
...
...
@@ -13,13 +11,13 @@ import java.util.List;
* @author m33
* @since 2022-06-06
*/
public
interface
UserService
extends
IService
<
User
>
{
public
interface
UserService
{
List
<
User
>
getUserList
(
int
pageNo
,
int
pageSize
);
boolean
deleteUser
(
int
userIdVo
);
boolean
deleteUser
(
String
userI
d
);
boolean
addUser
(
String
userName
,
String
company
,
String
passwor
d
);
boolean
addUser
(
String
userId
,
String
password
);
boolean
updateUser
(
int
userId
,
String
password
);
boolean
updateUser
(
String
userId
,
String
password
);
PageInfoModel
<
UserVo
>
getUserList
(
int
pageNo
,
int
pageSize
,
String
userName
,
String
company
);
}
license/src/main/java/iot/sixiang/license/service/impl/DeviceServiceImpl.java
View file @
e7e1a2d4
...
...
@@ -3,12 +3,17 @@ package iot.sixiang.license.service.impl;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
iot.sixiang.license.entity.Device
;
import
iot.sixiang.license.mapper.DeviceMapper
;
import
iot.sixiang.license.model.PageInfoModel
;
import
iot.sixiang.license.model.vo.DeviceTypeVo
;
import
iot.sixiang.license.service.DeviceService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
iot.sixiang.license.util.CommonUtil
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* <p>
...
...
@@ -21,11 +26,32 @@ import java.util.List;
@Service
public
class
DeviceServiceImpl
extends
ServiceImpl
<
DeviceMapper
,
Device
>
implements
DeviceService
{
@
Autowired
@
Resource
private
DeviceMapper
deviceMapper
;
@Override
public
List
<
DeviceTypeVo
>
getDeviceList
(
int
pageNo
,
int
pageSize
,
String
typeName
,
String
userId
)
{
List
<
DeviceTypeVo
>
deviceTypes
=
deviceMapper
.
getDeviceList
(
pageNo
,
pageSize
,
typeName
,
userId
);
return
deviceTypes
;
public
PageInfoModel
<
DeviceTypeVo
>
getDeviceList
(
int
pageNo
,
int
pageSize
,
String
typeName
,
Integer
userId
)
{
List
<
DeviceTypeVo
>
deviceTypes
=
deviceMapper
.
getDeviceList
(
typeName
,
userId
);
deviceTypes
=
deviceTypes
.
stream
().
sorted
(
Comparator
.
comparing
(
DeviceTypeVo:
:
getDeviceId
)).
collect
(
Collectors
.
toList
());
List
<
DeviceTypeVo
>
result
=
new
ArrayList
<>();
int
begin
=
(
pageNo
-
1
)
*
pageSize
;
if
(
begin
>=
0
&&
deviceTypes
.
size
()
>
0
)
{
result
=
deviceTypes
.
stream
().
skip
(
begin
).
limit
(
pageSize
).
collect
(
Collectors
.
toList
());
}
PageInfoModel
<
DeviceTypeVo
>
objectPageInfoModel
=
new
PageInfoModel
<>();
objectPageInfoModel
.
setTotal
(
deviceTypes
.
size
());
objectPageInfoModel
.
setResult
(
result
);
return
objectPageInfoModel
;
}
@Override
public
boolean
addDevice
(
int
userId
,
int
typeId
,
int
count
)
{
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
String
sn
=
CommonUtil
.
genRandomNum
(
18
);
boolean
res
=
deviceMapper
.
addDevice
(
sn
,
userId
,
typeId
);
if
(!
res
)
{
return
false
;
}
}
return
true
;
}
}
license/src/main/java/iot/sixiang/license/service/impl/DeviceTypeServiceImpl.java
View file @
e7e1a2d4
...
...
@@ -3,9 +3,7 @@ package iot.sixiang.license.service.impl;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
iot.sixiang.license.entity.DeviceType
;
import
iot.sixiang.license.mapper.DeviceTypeMapper
;
import
iot.sixiang.license.model.vo.DeviceTypeVo
;
import
iot.sixiang.license.service.DeviceTypeService
;
import
iot.sixiang.license.util.JsonUtil
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
...
...
@@ -26,13 +24,8 @@ public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceT
private
DeviceTypeMapper
deviceTypeMapper
;
@Override
public
List
<
DeviceTypeVo
>
getDeviceTypeList
(
int
pageNo
,
int
pageSize
,
String
typeName
,
String
userId
)
{
if
(
JsonUtil
.
isNull
(
String
.
valueOf
(
pageNo
))
||
JsonUtil
.
isNull
(
String
.
valueOf
(
pageSize
)))
{
List
<
DeviceTypeVo
>
deviceTypes
=
deviceTypeMapper
.
getAllList
();
return
deviceTypes
;
}
else
{
List
<
DeviceTypeVo
>
deviceTypes
=
deviceTypeMapper
.
getDeviceTypeList
(
pageNo
,
pageSize
,
typeName
,
userId
);
return
deviceTypes
;
}
public
List
<
DeviceType
>
getDeviceTypeList
()
{
List
<
DeviceType
>
deviceTypes
=
deviceTypeMapper
.
getDeviceTypeList
();
return
deviceTypes
;
}
}
license/src/main/java/iot/sixiang/license/service/impl/UserServiceImpl.java
View file @
e7e1a2d4
package
iot
.
sixiang
.
license
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
iot.sixiang.license.entity.User
;
import
iot.sixiang.license.mapper.UserMapper
;
import
iot.sixiang.license.model.PageInfoModel
;
import
iot.sixiang.license.model.vo.DeviceTypeVo
;
import
iot.sixiang.license.model.vo.UserVo
;
import
iot.sixiang.license.service.UserService
;
import
iot.sixiang.license.util.JsonUtil
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* <p>
...
...
@@ -27,32 +32,39 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
UserMapper
userMapper
;
@Override
public
List
<
User
>
getUserList
(
int
pageNo
,
int
pageSize
)
{
Page
<
User
>
page
=
new
Page
<>(
pageNo
,
pageSize
);
baseMapper
.
selectPage
(
page
,
null
);
List
<
User
>
records
=
page
.
getRecords
();
return
records
;
public
PageInfoModel
<
UserVo
>
getUserList
(
int
pageNo
,
int
pageSize
,
String
userName
,
String
company
)
{
List
<
UserVo
>
records
=
userMapper
.
getUserList
(
userName
,
company
);
records
=
records
.
stream
().
sorted
(
Comparator
.
comparing
(
UserVo:
:
getUserId
)).
collect
(
Collectors
.
toList
());
List
<
UserVo
>
result
=
new
ArrayList
<>();
int
begin
=
(
pageNo
-
1
)
*
pageSize
;
if
(
begin
>=
0
&&
records
.
size
()
>
0
)
{
result
=
records
.
stream
().
skip
(
begin
).
limit
(
pageSize
).
collect
(
Collectors
.
toList
());
}
PageInfoModel
<
UserVo
>
objectPageInfoModel
=
new
PageInfoModel
<>();
objectPageInfoModel
.
setTotal
(
records
.
size
());
objectPageInfoModel
.
setResult
(
result
);
return
objectPageInfoModel
;
}
@Override
public
boolean
deleteUser
(
String
userId
)
{
if
(
JsonUtil
.
isNull
(
userId
))
{
public
boolean
deleteUser
(
int
userId
)
{
if
(
JsonUtil
.
isNull
(
String
.
valueOf
(
userId
)
))
{
return
false
;
}
return
userMapper
.
deleteUser
(
userId
);
}
@Override
public
boolean
addUser
(
String
user
Id
,
String
password
)
{
if
(
JsonUtil
.
isNull
(
user
Id
)
||
JsonUtil
.
isNull
(
password
))
{
public
boolean
addUser
(
String
user
Name
,
String
company
,
String
password
)
{
if
(
JsonUtil
.
isNull
(
user
Name
)
||
JsonUtil
.
isNull
(
company
))
{
return
false
;
}
return
userMapper
.
addUser
(
user
Id
,
password
);
return
userMapper
.
addUser
(
user
Name
,
company
,
password
);
}
@Override
public
boolean
updateUser
(
String
userId
,
String
password
)
{
if
(
JsonUtil
.
isNull
(
userId
)
||
JsonUtil
.
isNull
(
password
))
{
public
boolean
updateUser
(
int
userId
,
String
password
)
{
if
(
JsonUtil
.
isNull
(
String
.
valueOf
(
userId
)
)
||
JsonUtil
.
isNull
(
password
))
{
return
false
;
}
return
userMapper
.
updateUser
(
userId
,
password
);
...
...
license/src/main/java/iot/sixiang/license/util/CommonUtil.java
0 → 100644
View file @
e7e1a2d4
package
iot
.
sixiang
.
license
.
util
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.ObjectInputStream
;
import
java.io.ObjectOutputStream
;
import
java.io.Serializable
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Random
;
import
java.util.UUID
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
public
class
CommonUtil
{
/**
* 得到一个字符串形式的格式化UUID
*
* @return
*/
public
static
String
getStrUUID
()
{
return
UUID
.
randomUUID
().
toString
();
// return UUID.randomUUID().toString().replace("-", "");
}
/**
* 随机生成指定长度的字符串
*
* @param length
* @return
*/
public
static
String
genRandomNum
(
int
length
)
{
int
maxNum
=
36
;
int
i
;
int
count
=
0
;
char
[]
str
=
{
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
,
'G'
,
'H'
,
'I'
,
'J'
,
'K'
,
'L'
,
'M'
,
'N'
,
'O'
,
'P'
,
'Q'
,
'R'
,
'S'
,
'T'
,
'U'
,
'V'
,
'W'
,
'X'
,
'Y'
,
'Z'
,
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
};
StringBuffer
pwd
=
new
StringBuffer
(
""
);
Random
r
=
new
Random
();
while
(
count
<
length
)
{
i
=
Math
.
abs
(
r
.
nextInt
(
maxNum
));
if
(
i
>=
0
&&
i
<
str
.
length
)
{
pwd
.
append
(
str
[
i
]);
count
++;
}
}
return
pwd
.
toString
();
}
/*
* 获取某路径下所有文件名
*/
public
static
List
<
String
>
getAllFilesName
(
String
directoryPath
)
{
List
<
String
>
list
=
new
ArrayList
<
String
>();
File
baseFile
=
new
File
(
directoryPath
);
if
(
baseFile
.
isFile
()
||
!
baseFile
.
exists
())
{
return
list
;
}
File
[]
files
=
baseFile
.
listFiles
();
for
(
File
file
:
files
)
{
if
(!
file
.
isDirectory
())
{
list
.
add
(
file
.
getName
());
}
}
return
list
;
}
public
static
boolean
isNumeric
(
String
str
)
{
Pattern
pattern
=
Pattern
.
compile
(
"[0-9]*"
);
Matcher
isNum
=
pattern
.
matcher
(
str
);
if
(!
isNum
.
matches
())
{
return
false
;
}
else
{
return
true
;
}
}
public
static
String
getSystemTime
()
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
// 设置日期格式
String
time
=
df
.
format
(
new
Date
());
return
time
;
}
@SuppressWarnings
(
"unchecked"
)
public
static
<
T
extends
Serializable
>
T
clone
(
T
obj
)
{
T
cloneObj
=
null
;
try
{
// 写入字节流
ByteArrayOutputStream
out
=
new
ByteArrayOutputStream
();
ObjectOutputStream
obs
=
new
ObjectOutputStream
(
out
);
obs
.
writeObject
(
obj
);
obs
.
close
();
// 分配内存,写入原始对象,生成新对象
ByteArrayInputStream
ios
=
new
ByteArrayInputStream
(
out
.
toByteArray
());
ObjectInputStream
ois
=
new
ObjectInputStream
(
ios
);
// 返回生成的新对象
cloneObj
=
(
T
)
ois
.
readObject
();
ois
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
cloneObj
;
}
@SuppressWarnings
(
"unchecked"
)
public
static
<
T
>
List
<
T
>
listClone
(
List
<
T
>
obj
)
{
List
<
T
>
cloneObj
=
null
;
ByteArrayOutputStream
out
=
null
;
ObjectOutputStream
obs
=
null
;
ByteArrayInputStream
ios
=
null
;
ObjectInputStream
ois
=
null
;
try
{
out
=
new
ByteArrayOutputStream
();
obs
=
new
ObjectOutputStream
(
out
);
obs
.
writeObject
(
obj
);
ios
=
new
ByteArrayInputStream
(
out
.
toByteArray
());
ois
=
new
ObjectInputStream
(
ios
);
cloneObj
=
(
List
<
T
>)
ois
.
readObject
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
if
(
ois
!=
null
)
{
ois
.
close
();
}
if
(
ios
!=
null
)
{
ios
.
close
();
}
if
(
obs
!=
null
)
{
obs
.
close
();
}
if
(
out
!=
null
)
{
out
.
close
();
}
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
return
cloneObj
;
}
/**
* 冒泡排序,从小到大排序
*
* @param nums
* @return
*/
public
static
double
[]
bubbleSort
(
double
[]
nums
)
{
for
(
int
i
=
0
;
i
<
nums
.
length
;
i
++)
{
for
(
int
j
=
0
;
j
<
nums
.
length
-
1
-
i
;
j
++)
{
if
(
nums
[
j
]
>
nums
[
j
+
1
])
{
double
temp
=
nums
[
j
+
1
];
nums
[
j
+
1
]
=
nums
[
j
];
nums
[
j
]
=
temp
;
}
}
}
return
nums
;
}
public
static
int
[]
bubbleSort
(
int
[]
nums
)
{
for
(
int
i
=
0
;
i
<
nums
.
length
;
i
++)
{
for
(
int
j
=
0
;
j
<
nums
.
length
-
1
-
i
;
j
++)
{
if
(
nums
[
j
]
>
nums
[
j
+
1
])
{
int
temp
=
nums
[
j
+
1
];
nums
[
j
+
1
]
=
nums
[
j
];
nums
[
j
]
=
temp
;
}
}
}
return
nums
;
}
/**
* 二分查找算法,查找有序数组中与目标值的绝对值是最小的
*
* @param target
* 目标值
* @param order_numbers
* 有序数组
* @return
*/
public
static
double
findLeastABSofNumber
(
double
target
,
double
[]
order_numbers
)
{
int
left
;
int
right
;
int
mid
;
left
=
0
;
right
=
order_numbers
.
length
-
1
;
while
(
left
<
right
)
{
mid
=
left
+
(
right
-
left
)
/
2
;
if
(
order_numbers
[
mid
]
-
target
==
0
)
return
order_numbers
[
mid
];
else
if
(
order_numbers
[
mid
]
>
target
)
{
right
=
mid
;
}
else
{
left
=
mid
;
}
if
(
right
-
left
==
1
)
{
double
subtractAbsleft
=
Math
.
abs
(
order_numbers
[
left
]
-
target
);
double
subtractAbsright
=
Math
.
abs
(
order_numbers
[
right
]
-
target
);
return
subtractAbsleft
<
subtractAbsright
?
order_numbers
[
left
]
:
order_numbers
[
right
];
}
}
return
0
;
}
/**
* 判断一个int数值是否在List里面
*
* @param targetList
* @param source
* @return
*/
public
static
boolean
findsourceInList
(
List
<
Integer
>
targetList
,
int
source
)
{
boolean
result
=
false
;
for
(
Integer
target
:
targetList
)
{
if
(
target
==
source
)
{
result
=
true
;
break
;
}
}
return
result
;
}
}
license/src/main/resources/mapper/DeviceMapper.xml
View file @
e7e1a2d4
...
...
@@ -2,21 +2,25 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"iot.sixiang.license.mapper.DeviceMapper"
>
<sql
id=
"DeviceVoColumn"
>
dt.type_id,dt.type_name,de.device_id,de.sn,us.user_id,us.user_name,us.password,us.company
</sql>
<select
id=
"getDeviceList"
resultType=
"iot.sixiang.license.model.vo.DeviceTypeVo"
>
SELECT
<include
refid=
"DeviceVoColumn"
/>
FROM device_type AS dt
JOIN device AS de ON dt.type_id = de.type_id
JOIN USER AS us ON de.user_id = us.user_id
where 1=1
<if
test=
"null != typeName and '' != typeName"
>
and type_name
= #{typeName}
and type_name
like concat('%',#{typeName},'%')
</if>
<if
test=
"null != userId and '' != userId"
>
and us.user_id
= #{userId}
and us.user_id
like concat('%',#{userId},'%')
</if>
LIMIT #{pageNo}*#{pageSize} - 1,#{pageSize}
</select>
<sql
id=
"DeviceVoColumn"
>
dt.type_id,dt.type_name,de.sn,us.user_id,us.user_name,us.password,us.company
</sql>
<insert
id=
"addDevice"
parameterType=
"iot.sixiang.license.entity.Device"
>
insert into device(sn, type_id, user_id) values (#{sn},#{typeId}, #{userId})
</insert>
</mapper>
license/src/main/resources/mapper/DeviceTypeMapper.xml
View file @
e7e1a2d4
...
...
@@ -2,26 +2,11 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"iot.sixiang.license.mapper.DeviceTypeMapper"
>
<sql
id=
"DeviceTypeVoColumn"
>
dt.type_id,dt.type_name,de.sn,us.user_id,us.user_name,us.password,us.company
</sql>
<select
id=
"getAllList"
resultType=
"iot.sixiang.license.model.vo.DeviceTypeVo"
>
SELECT
<include
refid=
"DeviceTypeVoColumn"
/>
FROM device_type AS dt
JOIN device AS de ON dt.type_id = de.type_id
JOIN USER AS us ON de.user_id = us.user_id
</select>
<!-- <sql id="DeviceTypeVoColumn">-->
<!-- dt.type_id,dt.type_name,de.sn,us.user_id,us.user_name,us.password,us.company-->
<!-- </sql>-->
<select
id=
"getDeviceTypeList"
resultType=
"iot.sixiang.license.model.vo.DeviceTypeVo"
>
SELECT
<include
refid=
"DeviceTypeVoColumn"
/>
FROM device_type AS dt
JOIN device AS de ON dt.type_id = de.type_id
JOIN USER AS us ON de.user_id = us.user_id
where 1=1
<if
test=
"null != typeName and '' != typeName"
>
and type_name = #{typeName}
</if>
<if
test=
"null != userId and '' != userId"
>
and us.user_id = #{userId}
</if>
LIMIT #{pageNo},#{pageSize}
<select
id=
"getDeviceTypeList"
resultType=
"iot.sixiang.license.entity.DeviceType"
>
SELECT type_id, type_name FROM device_type
</select>
</mapper>
license/src/main/resources/mapper/UserMapper.xml
View file @
e7e1a2d4
...
...
@@ -3,7 +3,7 @@
<mapper
namespace=
"iot.sixiang.license.mapper.UserMapper"
>
<insert
id=
"addUser"
parameterType=
"iot.sixiang.license.entity.User"
>
insert into user(user_
id, password) values (#{userId},
#{password})
insert into user(user_
name, company, password) values (#{userName},#{company},
#{password})
</insert>
<delete
id=
"deleteUser"
parameterType=
"iot.sixiang.license.entity.User"
>
...
...
@@ -13,4 +13,17 @@
<update
id=
"updateUser"
parameterType=
"iot.sixiang.license.entity.User"
>
update user set password = #{password} where user_id = #{userId}
</update>
<select
id=
"getUserList"
resultType=
"iot.sixiang.license.model.vo.UserVo"
>
SELECT user.user_id, user_name, password, company, COUNT(sn) AS count
FROM USER LEFT JOIN device ON user.user_id = device.user_id
where 1=1
<if
test=
"null != userName and '' != userName"
>
and user_name like concat('%',#{userName},'%')
</if>
<if
test=
"null != company and '' != company"
>
and company like concat('%',#{company},'%')
</if>
GROUP BY user.user_id
</select>
</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