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
67feb30f
Commit
67feb30f
authored
Feb 07, 2023
by
ma
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'remotes/origin/master' into for-yx
parents
85d566a0
6d71c671
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
8 deletions
+40
-8
README.md
license/doc/README.md
+2
-1
AlarmReadMapper.java
...main/java/iot/sixiang/license/mapper/AlarmReadMapper.java
+5
-2
AlarmReadServiceImpl.java
...ot/sixiang/license/service/impl/AlarmReadServiceImpl.java
+28
-3
AlarmReadMapper.xml
license/src/main/resources/mapper/AlarmReadMapper.xml
+5
-2
No files found.
license/doc/README.md
View file @
67feb30f
# 注意事项
##### 2023.1版本
> 1. 执行update.2023.1.sql
> 2. 原来的root账号要换成邮箱,包括user_name和notify字段,两个都填超管账号邮箱。
\ No newline at end of file
> 2. 原来的root账号要换成邮箱,包括user_name和notify字段,两个都填超管账号邮箱。
> 3. 证书文件ca.crt/server.crt/server.pkcs8.key拷贝到正确的目录下。
\ No newline at end of file
license/src/main/java/iot/sixiang/license/mapper/AlarmReadMapper.java
View file @
67feb30f
...
...
@@ -2,10 +2,13 @@ package iot.sixiang.license.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
iot.sixiang.license.entity.AlarmRead
;
import
iot.sixiang.license.model.vo.AlarmVo
;
import
java.util.List
;
/**
* <p>
*
Mapper 接口
* Mapper 接口
* </p>
*
* @author m33
...
...
@@ -13,5 +16,5 @@ import iot.sixiang.license.entity.AlarmRead;
*/
public
interface
AlarmReadMapper
extends
BaseMapper
<
AlarmRead
>
{
boolean
readAlarm
(
int
alarmId
,
int
typeId
,
String
title
,
String
content
,
int
userId
);
boolean
readAlarm
(
List
<
AlarmVo
>
alarmVos
,
int
userId
);
}
license/src/main/java/iot/sixiang/license/service/impl/AlarmReadServiceImpl.java
View file @
67feb30f
...
...
@@ -33,6 +33,7 @@ public class AlarmReadServiceImpl extends ServiceImpl<AlarmReadMapper, AlarmRead
AlarmMapper
alarmMapper
;
@Resource
AlarmReadMapper
alarmReadMapper
;
private
static
final
int
INSERT_BATCH_SIZE
=
1000
;
@Override
...
...
@@ -42,6 +43,7 @@ public class AlarmReadServiceImpl extends ServiceImpl<AlarmReadMapper, AlarmRead
}
userId
=
Integer
.
valueOf
(
XssUtil
.
checkXSS
(
String
.
valueOf
(
userId
)));
List
<
AlarmVo
>
alarmList
=
alarmMapper
.
getAlarmList
(
userId
);
List
<
AlarmVo
>
newAlarmList
=
new
ArrayList
<>();
for
(
AlarmVo
alarm:
alarmList
)
{
if
(
alarm
.
getReadFlag
()
==
0
)
{
int
alarmId
=
alarm
.
getId
();
...
...
@@ -54,9 +56,32 @@ public class AlarmReadServiceImpl extends ServiceImpl<AlarmReadMapper, AlarmRead
title
=
XssUtil
.
checkXSS
(
title
);
content
=
XssUtil
.
checkXSS
(
content
);
boolean
res
=
alarmReadMapper
.
readAlarm
(
alarmId
,
typeId
,
title
,
content
,
userId
);
if
(!
res
)
{
return
false
;
alarm
.
setTitle
(
title
);
alarm
.
setContent
(
content
);
alarm
.
setId
(
alarmId
);
alarm
.
setTypeId
(
typeId
);
newAlarmList
.
add
(
alarm
);
}
}
int
size
=
newAlarmList
.
size
();
if
(
size
<
INSERT_BATCH_SIZE
)
{
boolean
res
=
alarmReadMapper
.
readAlarm
(
newAlarmList
,
userId
);
if
(!
res
)
{
return
false
;
}
}
else
{
for
(
int
i
=
0
;
i
<=
size
/
INSERT_BATCH_SIZE
;
i
++)
{
List
<
AlarmVo
>
list
;
if
(
i
!=
size
/
INSERT_BATCH_SIZE
)
{
list
=
newAlarmList
.
subList
(
i
*
INSERT_BATCH_SIZE
,
i
*
INSERT_BATCH_SIZE
+
INSERT_BATCH_SIZE
);
}
else
{
list
=
newAlarmList
.
subList
(
i
*
INSERT_BATCH_SIZE
,
size
);
}
if
(
list
.
size
()
!=
0
)
{
boolean
res
=
alarmReadMapper
.
readAlarm
(
list
,
userId
);
if
(!
res
)
{
return
false
;
}
}
}
}
...
...
license/src/main/resources/mapper/AlarmReadMapper.xml
View file @
67feb30f
...
...
@@ -2,7 +2,10 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"iot.sixiang.license.mapper.AlarmReadMapper"
>
<insert
id=
"readAlarm"
parameterType=
"iot.sixiang.license.entity.AlarmRead"
>
insert into alarm_read (alarm_id, type_id, title, content, create_time, user_id) values (#{alarmId},#{typeId},#{title},#{content},now(),#{userId});
<insert
id=
"readAlarm"
>
insert into alarm_read (alarm_id, type_id, title, content, create_time, user_id) values
<foreach
collection=
"alarmVos"
separator=
","
item=
"item"
>
(#{item.id},#{item.typeId},#{item.title},#{item.content},now(),#{userId})
</foreach>
</insert>
</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