Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-standard-interfaces
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d71c4022
authored
Apr 25, 2022
by
向延琳
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改获取电量的逻辑
1 parent
033ea71d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
4 deletions
src/main/java/cn/com/glsx/stdinterface/modules/mapper/DevicePowerMapper.java
src/main/java/cn/com/glsx/stdinterface/modules/service/BatteryService.java
src/main/resources/mapper/DevicePowerMapper.xml
src/main/java/cn/com/glsx/stdinterface/modules/mapper/DevicePowerMapper.java
View file @
d71c402
...
@@ -3,6 +3,7 @@ package cn.com.glsx.stdinterface.modules.mapper;
...
@@ -3,6 +3,7 @@ package cn.com.glsx.stdinterface.modules.mapper;
import
cn.com.glsx.stdinterface.modules.entity.DevicePower
;
import
cn.com.glsx.stdinterface.modules.entity.DevicePower
;
import
com.glsx.plat.mybatis.mapper.CommonBaseMapper
;
import
com.glsx.plat.mybatis.mapper.CommonBaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.List
;
...
@@ -15,7 +16,7 @@ public interface DevicePowerMapper extends CommonBaseMapper<DevicePower> {
...
@@ -15,7 +16,7 @@ public interface DevicePowerMapper extends CommonBaseMapper<DevicePower> {
* @param sn 设备号
* @param sn 设备号
* @return 电量信息
* @return 电量信息
*/
*/
DevicePower
selectBySn
(
String
sn
);
DevicePower
selectBySn
(
@Param
(
"sn"
)
String
sn
,
@Param
(
"vdId"
)
Long
vdId
);
/**
/**
* 批量插入或修改
* 批量插入或修改
...
...
src/main/java/cn/com/glsx/stdinterface/modules/service/BatteryService.java
View file @
d71c402
...
@@ -64,10 +64,10 @@ public class BatteryService {
...
@@ -64,10 +64,10 @@ public class BatteryService {
log
.
warn
(
"该设备没有绑定车辆"
+
devicePowerDTO
.
getSn
());
log
.
warn
(
"该设备没有绑定车辆"
+
devicePowerDTO
.
getSn
());
}
}
//从关联表从获取关联id
//从关联表从获取关联id
Long
v
n
Id
=
vehicleService
.
getVdId
(
devicePowerDTO
.
getSn
());
Long
v
d
Id
=
vehicleService
.
getVdId
(
devicePowerDTO
.
getSn
());
DevicePower
devicePower
=
convert
(
devicePowerDTO
,
createdBy
,
updatedBy
,
vnId
);
DevicePower
devicePower
=
convert
(
devicePowerDTO
,
createdBy
,
updatedBy
,
vnId
);
DevicePower
devicePowerOld
=
devicePowerMapper
.
selectBySn
(
devicePowerDTO
.
getSn
());
DevicePower
devicePowerOld
=
devicePowerMapper
.
selectBySn
(
devicePowerDTO
.
getSn
()
,
vnId
);
if
(
Objects
.
isNull
(
devicePowerOld
))
{
if
(
Objects
.
isNull
(
devicePowerOld
))
{
devicePowerMapper
.
insert
(
devicePower
);
devicePowerMapper
.
insert
(
devicePower
);
return
;
return
;
...
@@ -177,7 +177,8 @@ public class BatteryService {
...
@@ -177,7 +177,8 @@ public class BatteryService {
if
(
StringUtils
.
isEmpty
(
sn
))
{
if
(
StringUtils
.
isEmpty
(
sn
))
{
return
null
;
return
null
;
}
}
DevicePower
devicePower
=
devicePowerMapper
.
selectBySn
(
sn
);
Long
vdId
=
vehicleService
.
getVdId
(
sn
);
DevicePower
devicePower
=
devicePowerMapper
.
selectBySn
(
sn
,
vdId
);
if
(
Objects
.
isNull
(
devicePower
))
{
if
(
Objects
.
isNull
(
devicePower
))
{
return
null
;
return
null
;
}
}
...
...
src/main/resources/mapper/DevicePowerMapper.xml
View file @
d71c402
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
from t_device_power
from t_device_power
<where>
<where>
and sn = #{sn}
and sn = #{sn}
and vd_id = #{vdId}
and del_flag = 0
and del_flag = 0
</where>
</where>
limit 1
limit 1
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment