Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
glinfo-api
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
林业通
glinfo-api
Commits
de7697ef
提交
de7697ef
authored
2月 25, 2022
作者:
林业通
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
锁修改
上级
bc7d4f24
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
241 行增加
和
4 行删除
+241
-4
ShDevicePasswordController.java
...bao/modules/sh/controller/ShDevicePasswordController.java
+2
-2
ShLockUserController.java
...nfo/enbao/modules/sh/controller/ShLockUserController.java
+100
-0
ShLockUserDao.java
.../java/tech/glinfo/enbao/modules/sh/dao/ShLockUserDao.java
+17
-0
ShLockUserEntity.java
...tech/glinfo/enbao/modules/sh/entity/ShLockUserEntity.java
+44
-0
ShLockUserService.java
...ch/glinfo/enbao/modules/sh/service/ShLockUserService.java
+20
-0
ShLockUserServiceImpl.java
.../enbao/modules/sh/service/impl/ShLockUserServiceImpl.java
+30
-0
ShLockUserDao.xml
common/src/main/resources/mapper/sh/ShLockUserDao.xml
+17
-0
12-24.sql
doc/sql/12-24.sql
+11
-2
没有找到文件。
appapi/src/main/java/tech/glinfo/enbao/modules/sh/controller/ShDevicePasswordController.java
浏览文件 @
de7697ef
...
...
@@ -56,7 +56,7 @@ public class ShDevicePasswordController {
@ApiLog
(
"待下发密码数量"
)
public
R
count
(
@RequestParam
Map
<
String
,
Object
>
params
)
{
Integer
deviceId
=
Integer
.
parseInt
((
String
)
params
.
get
(
"deviceId"
));
if
(
StringUtils
.
isBlank
(
params
.
get
(
"deviceId"
)
))
{
if
(
StringUtils
.
isBlank
(
deviceId
))
{
return
R
.
error
(
"缺少参数"
);
}
Integer
count
=
shDevicePasswordService
.
count
(
new
QueryWrapper
<
ShDevicePasswordEntity
>().
eq
(
"device_id"
,
deviceId
).
eq
(
"status"
,
1
));
...
...
@@ -91,7 +91,7 @@ public class ShDevicePasswordController {
}
passwordEntity
.
setExpiredTime
(
sdf
.
parse
(
expiredTime
));
}
return
shDevicePasswordService
.
save
(
passwordEntity
)
?
R
.
ok
()
:
R
.
error
(
"
记录
失败!"
);
return
shDevicePasswordService
.
save
(
passwordEntity
)
?
R
.
ok
()
:
R
.
error
(
"
保存
失败!"
);
}
}
appapi/src/main/java/tech/glinfo/enbao/modules/sh/controller/ShLockUserController.java
0 → 100644
浏览文件 @
de7697ef
package
tech
.
glinfo
.
enbao
.
modules
.
sh
.
controller
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
tech.glinfo.enbao.common.annotation.ApiLog
;
import
tech.glinfo.enbao.common.annotation.Login
;
import
tech.glinfo.enbao.common.utils.PageUtils
;
import
tech.glinfo.enbao.common.utils.Query
;
import
tech.glinfo.enbao.common.utils.R
;
import
tech.glinfo.enbao.common.utils.StringUtils
;
import
tech.glinfo.enbao.modules.sh.entity.ShLockUserEntity
;
import
tech.glinfo.enbao.modules.sh.service.ShLockUserService
;
import
java.util.HashMap
;
import
java.util.Map
;
@RestController
@RequestMapping
(
"/shLockUser"
)
@Api
(
value
=
"锁用户"
,
description
=
"锁用户"
)
public
class
ShLockUserController
{
@Autowired
private
ShLockUserService
shLockUserService
;
@Login
@PostMapping
(
"save"
)
@ApiOperation
(
"保存用户"
)
@ApiLog
(
"保存用户"
)
public
R
save
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
Integer
lockId
=
(
Integer
)
params
.
get
(
"lockId"
);
Integer
userId
=
(
Integer
)
params
.
get
(
"userId"
);
String
userName
=
(
String
)
params
.
get
(
"userName"
);
if
(
StringUtils
.
isBlank
(
lockId
,
userId
,
userName
))
{
return
R
.
error
(
"参数为空!"
);
}
ShLockUserEntity
lockUserEntity
=
shLockUserService
.
getOne
(
new
QueryWrapper
<
ShLockUserEntity
>().
eq
(
"lock_id"
,
lockId
).
eq
(
"user_id"
,
userId
));
if
(
lockUserEntity
!=
null
)
{
return
R
.
error
(
"用户ID不能重复!"
);
}
ShLockUserEntity
entity
=
new
ShLockUserEntity
();
entity
.
setLockId
(
lockId
);
entity
.
setUserId
(
userId
);
entity
.
setUserName
(
userName
);
boolean
flag
=
shLockUserService
.
save
(
entity
);
return
flag
?
R
.
ok
()
:
R
.
error
(
"新增失败!"
);
}
@Login
@PostMapping
(
"update"
)
@ApiOperation
(
"修改用户"
)
@ApiLog
(
"修改用户"
)
public
R
update
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
Integer
id
=
(
Integer
)
params
.
get
(
"id"
);
Integer
userId
=
(
Integer
)
params
.
get
(
"userId"
);
String
userName
=
(
String
)
params
.
get
(
"userName"
);
if
(
StringUtils
.
isBlank
(
id
,
userId
,
userName
))
{
return
R
.
error
(
"参数为空!"
);
}
ShLockUserEntity
entity
=
new
ShLockUserEntity
();
entity
.
setId
(
id
);
entity
.
setUserId
(
userId
);
entity
.
setUserName
(
userName
);
boolean
flag
=
shLockUserService
.
updateById
(
entity
);
return
flag
?
R
.
ok
()
:
R
.
error
(
"修改失败!"
);
}
@Login
@PostMapping
(
"delete"
)
@ApiOperation
(
"删除用户"
)
@ApiLog
(
"删除用户"
)
public
R
delete
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
Integer
id
=
(
Integer
)
params
.
get
(
"id"
);
if
(
StringUtils
.
isBlank
(
id
))
{
return
R
.
error
(
"参数为空!"
);
}
boolean
flag
=
shLockUserService
.
removeById
(
id
);
return
flag
?
R
.
ok
()
:
R
.
error
(
"删除失败!"
);
}
@Login
@GetMapping
(
"/list"
)
@ApiOperation
(
"锁用户列表"
)
@ApiLog
(
"锁用户列表"
)
public
R
list
(
@RequestParam
Map
<
String
,
Object
>
params
){
Integer
lockId
=
Integer
.
parseInt
((
String
)
params
.
get
(
"lockId"
));
IPage
<
ShLockUserEntity
>
page
=
shLockUserService
.
page
(
new
Query
<
ShLockUserEntity
>().
getPage
(
params
),
new
QueryWrapper
<
ShLockUserEntity
>().
eq
(
"lock_id"
,
lockId
)
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"page"
,
new
PageUtils
(
page
));
return
R
.
ok
(
map
);
}
}
common/src/main/java/tech/glinfo/enbao/modules/sh/dao/ShLockUserDao.java
0 → 100644
浏览文件 @
de7697ef
package
tech
.
glinfo
.
enbao
.
modules
.
sh
.
dao
;
import
tech.glinfo.enbao.modules.sh.entity.ShLockUserEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 锁用户
*
* @author linyetong
* @email linyetong@glinfo.com
* @date 2022-02-25 13:51:20
*/
@Mapper
public
interface
ShLockUserDao
extends
BaseMapper
<
ShLockUserEntity
>
{
}
common/src/main/java/tech/glinfo/enbao/modules/sh/entity/ShLockUserEntity.java
0 → 100644
浏览文件 @
de7697ef
package
tech
.
glinfo
.
enbao
.
modules
.
sh
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.io.Serializable
;
import
java.util.Date
;
import
lombok.Data
;
/**
* 锁用户
*
* @author linyetong
* @email linyetong@glinfo.com
* @date 2022-02-25 13:51:20
*/
@Data
@TableName
(
"sh_lock_user"
)
public
class
ShLockUserEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 主键id
*/
@TableId
private
Integer
id
;
/**
* 用户
*/
private
Integer
userId
;
/**
* 锁ID
*/
private
Integer
lockId
;
/**
* 用户名称
*/
private
String
userName
;
/**
* 创建时间
*/
private
Date
createDate
;
}
common/src/main/java/tech/glinfo/enbao/modules/sh/service/ShLockUserService.java
0 → 100644
浏览文件 @
de7697ef
package
tech
.
glinfo
.
enbao
.
modules
.
sh
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
tech.glinfo.enbao.common.utils.PageUtils
;
import
tech.glinfo.enbao.modules.sh.entity.ShLockUserEntity
;
import
java.util.Map
;
/**
* 锁用户
*
* @author linyetong
* @email linyetong@glinfo.com
* @date 2022-02-25 13:51:20
*/
public
interface
ShLockUserService
extends
IService
<
ShLockUserEntity
>
{
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
);
}
common/src/main/java/tech/glinfo/enbao/modules/sh/service/impl/ShLockUserServiceImpl.java
0 → 100644
浏览文件 @
de7697ef
package
tech
.
glinfo
.
enbao
.
modules
.
sh
.
service
.
impl
;
import
org.springframework.stereotype.Service
;
import
java.util.Map
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
tech.glinfo.enbao.common.utils.PageUtils
;
import
tech.glinfo.enbao.common.utils.Query
;
import
tech.glinfo.enbao.modules.sh.dao.ShLockUserDao
;
import
tech.glinfo.enbao.modules.sh.entity.ShLockUserEntity
;
import
tech.glinfo.enbao.modules.sh.service.ShLockUserService
;
@Service
(
"shLockUserService"
)
public
class
ShLockUserServiceImpl
extends
ServiceImpl
<
ShLockUserDao
,
ShLockUserEntity
>
implements
ShLockUserService
{
@Override
public
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
)
{
IPage
<
ShLockUserEntity
>
page
=
this
.
page
(
new
Query
<
ShLockUserEntity
>().
getPage
(
params
),
new
QueryWrapper
<
ShLockUserEntity
>()
);
return
new
PageUtils
(
page
);
}
}
\ No newline at end of file
common/src/main/resources/mapper/sh/ShLockUserDao.xml
0 → 100644
浏览文件 @
de7697ef
<?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=
"tech.glinfo.enbao.modules.sh.dao.ShLockUserDao"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"tech.glinfo.enbao.modules.sh.entity.ShLockUserEntity"
id=
"shLockUserMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"lockId"
column=
"lock_id"
/>
<result
property=
"userName"
column=
"user_name"
/>
<result
property=
"createDate"
column=
"create_date"
/>
</resultMap>
</mapper>
\ No newline at end of file
doc/sql/12-24.sql
浏览文件 @
de7697ef
...
...
@@ -311,4 +311,14 @@ CREATE TABLE `infrared_control` (
`remark`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'备注'
,
`create_time`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
PRIMARY
KEY
(
`id`
)
USING
BTREE
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'用户遥控器'
;
\ No newline at end of file
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'用户遥控器'
;
CREATE
TABLE
`sh_lock_user`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'主键id'
,
`user_id`
int
(
11
)
DEFAULT
NULL
COMMENT
'用户'
,
`lock_id`
int
(
11
)
DEFAULT
NULL
COMMENT
'锁ID'
,
`user_name`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'用户名称'
,
`create_date`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
COMMENT
'创建时间'
,
PRIMARY
KEY
(
`id`
)
USING
BTREE
,
KEY
`sh_lock_user_lock_id`
(
`lock_id`
)
USING
BTREE
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'锁用户'
;
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论