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 d75e3b3f
authored
Apr 08, 2022
by
向延琳
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
增加唯一性校验
1 parent
d6bf9868
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
0 deletions
src/main/java/cn/com/glsx/stdinterface/modules/mapper/DeviceJourneyMapper.java
src/main/java/cn/com/glsx/stdinterface/modules/service/JourneyService.java
src/main/resources/mapper/DeviceJourneyMapper.xml
src/main/java/cn/com/glsx/stdinterface/modules/mapper/DeviceJourneyMapper.java
View file @
d75e3b3
...
@@ -3,6 +3,9 @@ package cn.com.glsx.stdinterface.modules.mapper;
...
@@ -3,6 +3,9 @@ package cn.com.glsx.stdinterface.modules.mapper;
import
cn.com.glsx.stdinterface.modules.entity.DeviceJourney
;
import
cn.com.glsx.stdinterface.modules.entity.DeviceJourney
;
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.Date
;
/**
/**
* 新e盾|里程表
* 新e盾|里程表
...
@@ -12,4 +15,12 @@ import org.apache.ibatis.annotations.Mapper;
...
@@ -12,4 +15,12 @@ import org.apache.ibatis.annotations.Mapper;
*/
*/
@Mapper
@Mapper
public
interface
DeviceJourneyMapper
extends
CommonBaseMapper
<
DeviceJourney
>
{
public
interface
DeviceJourneyMapper
extends
CommonBaseMapper
<
DeviceJourney
>
{
/**
* 根据开始时间和sn查找
* @param sn 设备号
* @param beginTime 开始时间
* @return 设备行程信息
*/
DeviceJourney
selectBySnAndBeginTime
(
@Param
(
"sn"
)
String
sn
,
@Param
(
"beginTime"
)
Date
beginTime
);
}
}
\ No newline at end of file
\ No newline at end of file
src/main/java/cn/com/glsx/stdinterface/modules/service/JourneyService.java
View file @
d75e3b3
...
@@ -48,6 +48,12 @@ public class JourneyService {
...
@@ -48,6 +48,12 @@ public class JourneyService {
if
(
Objects
.
isNull
(
deviceJourneyDTO
))
{
if
(
Objects
.
isNull
(
deviceJourneyDTO
))
{
return
;
return
;
}
}
DeviceJourney
journey
=
deviceJourneyMapper
.
selectBySnAndBeginTime
(
deviceJourneyDTO
.
getSn
(),
deviceJourneyDTO
.
getBeginTime
());
if
(
Objects
.
nonNull
(
journey
))
{
log
.
warn
(
"该设备同样的开始时间行程数据已经存在"
+
"sn: "
+
deviceJourneyDTO
.
getSn
()
+
"beginTime:"
+
deviceJourneyDTO
.
getBeginTime
());
return
;
}
//从车辆信息中获取创建人信息
//从车辆信息中获取创建人信息
Vehicle
vehicle
=
getVehicleBySn
(
deviceJourneyDTO
.
getSn
());
Vehicle
vehicle
=
getVehicleBySn
(
deviceJourneyDTO
.
getSn
());
if
(
Objects
.
isNull
(
vehicle
))
{
if
(
Objects
.
isNull
(
vehicle
))
{
...
...
src/main/resources/mapper/DeviceJourneyMapper.xml
View file @
d75e3b3
...
@@ -26,4 +26,15 @@
...
@@ -26,4 +26,15 @@
id, sn, vd_id, begin_time, end_time, begin_address, end_address, mileage, del_flag,
id, sn, vd_id, begin_time, end_time, begin_address, end_address, mileage, del_flag,
created_date, created_by, updated_date, updated_by
created_date, created_by, updated_date, updated_by
</sql>
</sql>
<select
id=
"selectBySnAndBeginTime"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from t_device_journey
<where>
and sn = #{sn}
and begin_time = #{beginTime}
</where>
limit 1
</select>
</mapper>
</mapper>
\ No newline at end of file
\ No newline at end of file
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