Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
traffic-signal-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
signal
traffic-signal-platform
Commits
b50c0c2d
Commit
b50c0c2d
authored
May 10, 2023
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 优化持久层
parent
778fdec2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
219 additions
and
158 deletions
+219
-158
BaseCrossInfoMapper.java
...ava/net/wanji/databus/dao/mapper/BaseCrossInfoMapper.java
+1
-1
BaseCrossLightsMapper.java
...a/net/wanji/databus/dao/mapper/BaseCrossLightsMapper.java
+45
-0
CrossLightsMapper.java
.../java/net/wanji/databus/dao/mapper/CrossLightsMapper.java
+7
-31
BaseCrossLightsPO.java
...src/main/java/net/wanji/databus/po/BaseCrossLightsPO.java
+1
-1
BaseCrossInfoMapper.xml
wj-databus/src/main/resources/mapper/BaseCrossInfoMapper.xml
+1
-1
BaseCrossLightsMapper.xml
...tabus/src/main/resources/mapper/BaseCrossLightsMapper.xml
+152
-0
CrossLightsMapper.xml
wj-databus/src/main/resources/mapper/CrossLightsMapper.xml
+12
-124
No files found.
wj-databus/src/main/java/net/wanji/databus/dao/mapper/CrossInfoMapper.java
→
wj-databus/src/main/java/net/wanji/databus/dao/mapper/
Base
CrossInfoMapper.java
View file @
b50c0c2d
...
@@ -15,7 +15,7 @@ import java.util.List;
...
@@ -15,7 +15,7 @@ import java.util.List;
* @desc CrossInfoMapper
* @desc CrossInfoMapper
*/
*/
@Repository
@Repository
public
interface
CrossInfoMapper
extends
BaseMapper
<
TBaseCrossInfo
>
{
public
interface
Base
CrossInfoMapper
extends
BaseMapper
<
TBaseCrossInfo
>
{
/**
/**
* 查询路口列表信息
* 查询路口列表信息
...
...
wj-databus/src/main/java/net/wanji/databus/dao/mapper/BaseCrossLightsMapper.java
0 → 100644
View file @
b50c0c2d
package
net
.
wanji
.
databus
.
dao
.
mapper
;
import
net.wanji.databus.po.BaseCrossLightsPO
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.stereotype.Repository
;
import
java.util.Collection
;
import
java.util.List
;
/**
* 灯组基础信息;(t_base_cross_lights)表数据库访问层
* @author : hanbing
* @date : 2023-1-3
*/
@Repository
@Primary
public
interface
BaseCrossLightsMapper
{
void
deleteByCrossId
(
@Param
(
"crossId"
)
String
crossId
);
void
insertBatch
(
@Param
(
"entities"
)
Collection
<
BaseCrossLightsPO
>
entities
);
BaseCrossLightsPO
selectByCrossIdAndLedNum
(
@Param
(
"crossId"
)
String
crossId
,
@Param
(
"ledNum"
)
String
ledNum
);
List
<
BaseCrossLightsPO
>
selectByCrossId
(
@Param
(
"crossId"
)
String
crossId
);
List
<
BaseCrossLightsPO
>
selectByCrossIdAndDir
(
@Param
(
"crossId"
)
String
crossId
,
@Param
(
"dir"
)
Integer
dir
);
BaseCrossLightsPO
selectById
(
@Param
(
"id"
)
Integer
id
);
List
<
BaseCrossLightsPO
>
selectByLightsIdsAndDir
(
@Param
(
"lightsIds"
)
List
<
Integer
>
lightsIds
,
@Param
(
"dir"
)
Integer
dir
);
void
update
(
BaseCrossLightsPO
baseCrossLightsPO
);
void
insertOne
(
BaseCrossLightsPO
baseCrossLightsPO
);
List
<
BaseCrossLightsPO
>
listCrossLightsPO
(
@Param
(
"entity"
)
BaseCrossLightsPO
entity
);
List
<
BaseCrossLightsPO
>
listCrossLights
();
void
deleteOne
(
@Param
(
"crossId"
)
String
crossId
,
@Param
(
"elementId"
)
String
elementId
);
}
wj-databus/src/main/java/net/wanji/databus/dao/mapper/CrossLightsMapper.java
View file @
b50c0c2d
package
net
.
wanji
.
databus
.
dao
.
mapper
;
package
net
.
wanji
.
databus
.
dao
.
mapper
;
import
net.wanji.databus.
po
.CrossLightsPO
;
import
net.wanji.databus.
dao.entity
.CrossLightsPO
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.stereotype.Repository
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.List
;
/**
/**
* 灯组基础信息;(t_base_cross_lights)表数据库访问层
* @author Kent HAN
* @author : hanbing
* @date 2022/11/18 14:10
* @date : 2023-1-3
*/
*/
@Repository
@Primary
public
interface
CrossLightsMapper
{
public
interface
CrossLightsMapper
{
void
deleteOne
(
@Param
(
"crossId"
)
String
crossId
,
void
deleteByCrossId
(
@Param
(
"crossId"
)
String
crossId
);
@Param
(
"elementId"
)
String
elementId
);
void
insertBatch
(
@Param
(
"entities"
)
Collection
<
CrossLightsPO
>
entities
);
CrossLightsPO
selectByCrossIdAndLedNum
(
@Param
(
"crossId"
)
String
crossId
,
@Param
(
"ledNum"
)
String
ledNum
);
List
<
CrossLightsPO
>
selectByCrossId
(
@Param
(
"crossId"
)
String
crossId
);
List
<
CrossLightsPO
>
selectByCrossIdAndDir
(
@Param
(
"crossId"
)
String
crossId
,
@Param
(
"dir"
)
Integer
dir
);
CrossLightsPO
selectById
(
@Param
(
"id"
)
Integer
id
);
List
<
CrossLightsPO
>
selectByLightsIdsAndDir
(
@Param
(
"lightsIds"
)
List
<
Integer
>
lightsIds
,
@Param
(
"dir"
)
Integer
dir
);
void
update
(
CrossLightsPO
crossLightsPO
);
void
insertOne
(
CrossLightsPO
crossLightsPO
);
void
insertOne
(
CrossLightsPO
crossLightsPO
);
List
<
CrossLightsPO
>
listCrossLightsPO
(
@Param
(
"entity"
)
CrossLightsPO
entity
);
List
<
CrossLightsPO
>
selectByCrossId
(
@Param
(
"crossId"
)
String
crossId
);
List
<
CrossLightsPO
>
listCrossLights
();
void
deleteOne
(
@Param
(
"crossId"
)
String
crossId
,
void
deleteByCrossId
(
String
crossId
);
@Param
(
"elementId"
)
String
elementId
);
}
}
wj-databus/src/main/java/net/wanji/databus/po/CrossLightsPO.java
→
wj-databus/src/main/java/net/wanji/databus/po/
Base
CrossLightsPO.java
View file @
b50c0c2d
...
@@ -10,7 +10,7 @@ import java.util.Date;
...
@@ -10,7 +10,7 @@ import java.util.Date;
* @date 2023/1/3 9:40
* @date 2023/1/3 9:40
*/
*/
@Data
@Data
public
class
CrossLightsPO
{
public
class
Base
CrossLightsPO
{
/** 灯组ID */
/** 灯组ID */
@ApiModelProperty
(
name
=
"灯组ID"
,
notes
=
""
)
@ApiModelProperty
(
name
=
"灯组ID"
,
notes
=
""
)
private
Integer
id
;
private
Integer
id
;
...
...
wj-databus/src/main/resources/mapper/CrossInfoMapper.xml
→
wj-databus/src/main/resources/mapper/
Base
CrossInfoMapper.xml
View file @
b50c0c2d
<?xml version="1.0" encoding="UTF-8" ?>
<?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" >
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"net.wanji.databus.dao.mapper.CrossInfoMapper"
>
<mapper
namespace=
"net.wanji.databus.dao.mapper.
Base
CrossInfoMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"net.wanji.databus.po.TBaseCrossInfo"
>
<resultMap
id=
"BaseResultMap"
type=
"net.wanji.databus.po.TBaseCrossInfo"
>
<id
column=
"id"
property=
"id"
jdbcType=
"CHAR"
/>
<id
column=
"id"
property=
"id"
jdbcType=
"CHAR"
/>
<result
column=
"name"
property=
"name"
jdbcType=
"VARCHAR"
/>
<result
column=
"name"
property=
"name"
jdbcType=
"VARCHAR"
/>
...
...
wj-databus/src/main/resources/mapper/BaseCrossLightsMapper.xml
0 → 100644
View file @
b50c0c2d
<?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=
"net.wanji.databus.dao.mapper.BaseCrossLightsMapper"
>
<!-- 通用查询映射结果 -->
<resultMap
type=
"net.wanji.databus.po.BaseCrossLightsPO"
id=
"BaseResultMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"lightsNo"
column=
"lights_no"
/>
<result
property=
"type"
column=
"type"
/>
<result
property=
"dir"
column=
"dir"
/>
<result
property=
"sort"
column=
"sort"
/>
<result
property=
"crossId"
column=
"cross_id"
/>
<result
property=
"gmtCreate"
column=
"gmt_create"
/>
<result
property=
"gmtModified"
column=
"gmt_modified"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, lights_no,type, dir, sort, cross_id, gmt_create, gmt_modified
</sql>
<select
id=
"listCrossLightsPO"
parameterType=
"net.wanji.databus.po.BaseCrossLightsPO"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
></include>
from t_base_cross_lights
<where>
<if
test=
"entity.crossId != null and entity.crossId != ''"
>
cross_id = #{entity.crossId}
</if>
</where>
</select>
<insert
id=
"insertBatch"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into t_base_cross_lights(lights_no,type,dir,sort,cross_id)
values
<foreach
collection=
"entities"
item=
"entity"
separator=
","
>
(#{entity.lightsNo},#{entity.type},#{entity.dir},#{entity.sort},#{entity.crossId})
</foreach>
</insert>
<insert
id=
"insertOne"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into t_base_cross_lights(lights_no, type, dir, sort, cross_id)
values (#{lightsNo}, #{type}, #{dir}, #{sort}, #{crossId})
</insert>
<update
id=
"update"
>
update t_base_cross_lights
<set>
<if
test=
"type != null and type != ''"
>
type = #{type},
</if>
<if
test=
"dir != null and dir != ''"
>
dir = #{dir},
</if>
<if
test=
"sort != null and sort != ''"
>
sort = #{sort},
</if>
</set>
where cross_id = #{crossId} and lights_no=#{lightsNo}
</update>
<delete
id=
"deleteByCrossId"
>
delete
from t_base_cross_lights
where cross_id = #{crossId}
</delete>
<delete
id=
"deleteOne"
>
delete from t_cross_lights
where cross_id = #{crossId} and name = #{elementId}
</delete>
<select
id=
"selectByCrossIdAndLedNum"
resultMap=
"BaseResultMap"
>
select id,
lights_no,
type,
dir,
sort,
cross_id,
gmt_create,
gmt_modified
from t_base_cross_lights
where cross_id = #{crossId}
and lights_no = #{ledNum}
</select>
<select
id=
"selectByCrossId"
resultMap=
"BaseResultMap"
>
select id,
lights_no,
type,
dir,
sort,
cross_id,
gmt_create,
gmt_modified
from t_base_cross_lights
where cross_id = #{crossId}
</select>
<select
id=
"selectByCrossIdAndDir"
resultMap=
"BaseResultMap"
>
select id,
lights_no,
type,
dir,
sort,
cross_id,
gmt_create,
gmt_modified
from t_base_cross_lights
where cross_id = #{crossId}
and dir = #{dir}
</select>
<select
id=
"selectById"
resultMap=
"BaseResultMap"
>
select id,
lights_no,
type,
dir,
sort,
cross_id,
gmt_create,
gmt_modified
from t_base_cross_lights
where id = #{id}
</select>
<select
id=
"selectByLightsIdsAndDir"
resultMap=
"BaseResultMap"
>
select
id,lights_no,type,dir,sort,cross_id,gmt_create,gmt_modified
from t_base_cross_lights
where dir = #{dir} and id in
<foreach
collection=
"lightsIds"
item=
"lightsId"
separator=
","
open=
"("
close=
")"
>
#{lightsId}
</foreach>
</select>
<select
id=
"listCrossLights"
resultType=
"net.wanji.databus.po.BaseCrossLightsPO"
>
select
id
,lights_no
,type
,dir
,sort
,cross_id
from
t_base_cross_lights
where 1=1
<if
test=
"crossId != null and crossId != ''"
>
and cross_id = #{crossId}
</if>
</select>
</mapper>
wj-databus/src/main/resources/mapper/CrossLightsMapper.xml
View file @
b50c0c2d
<?xml version="1.0" encoding="UTF-8"?>
<?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">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"net.wanji.databus.dao.mapper.CrossLightsMapper"
>
<mapper
namespace=
"net.wanji.databus.dao.mapper.CrossLightsMapper"
>
<resultMap
type=
"net.wanji.databus.dao.entity.CrossLightsPO"
id=
"BaseResultMap"
>
<!-- 通用查询映射结果 -->
<resultMap
type=
"net.wanji.databus.po.CrossLightsPO"
id=
"BaseResultMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"id"
column=
"id"
/>
<result
property=
"lightsNo"
column=
"lights_no"
/>
<result
property=
"lightsNo"
column=
"lights_no"
/>
<result
property=
"name"
column=
"name"
/>
<result
property=
"type"
column=
"type"
/>
<result
property=
"type"
column=
"type"
/>
<result
property=
"dir"
column=
"dir"
/>
<result
property=
"dir"
column=
"dir"
/>
<result
property=
"
sort"
column=
"sort
"
/>
<result
property=
"
turn"
column=
"turn
"
/>
<result
property=
"crossId"
column=
"cross_id"
/>
<result
property=
"crossId"
column=
"cross_id"
/>
<result
property=
"inOutType"
column=
"in_out_type"
/>
<result
property=
"gmtCreate"
column=
"gmt_create"
/>
<result
property=
"gmtCreate"
column=
"gmt_create"
/>
<result
property=
"gmtModified"
column=
"gmt_modified"
/>
<result
property=
"gmtModified"
column=
"gmt_modified"
/>
</resultMap>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, lights_no,type, dir, sort, cross_id, gmt_create, gmt_modified
</sql>
<select
id=
"listCrossLightsPO"
parameterType=
"net.wanji.databus.po.CrossLightsPO"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
></include>
from t_base_cross_lights
<where>
<if
test=
"entity.crossId != null and entity.crossId != ''"
>
cross_id = #{entity.crossId}
</if>
</where>
</select>
<insert
id=
"insertBatch"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into t_base_cross_lights(lights_no,type,dir,sort,cross_id)
values
<foreach
collection=
"entities"
item=
"entity"
separator=
","
>
(#{entity.lightsNo},#{entity.type},#{entity.dir},#{entity.sort},#{entity.crossId})
</foreach>
</insert>
<insert
id=
"insertOne"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
<insert
id=
"insertOne"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into t_
base_cross_lights(lights_no, type, dir, sort, cross_id
)
insert into t_
cross_lights(lights_no,name,type,dir,turn,cross_id,in_out_type
)
values (#{lightsNo},
#{type}, #{dir}, #{sort}, #{crossId
})
values (#{lightsNo},
#{name},#{type},#{dir},#{turn},#{crossId},#{inOutType
})
</insert>
</insert>
<update
id=
"update"
>
update t_base_cross_lights
<set>
<if
test=
"type != null and type != ''"
>
type = #{type},
</if>
<if
test=
"dir != null and dir != ''"
>
dir = #{dir},
</if>
<if
test=
"sort != null and sort != ''"
>
sort = #{sort},
</if>
</set>
where cross_id = #{crossId} and lights_no=#{lightsNo}
</update>
<delete
id=
"deleteByCrossId"
>
delete
from t_base_cross_lights
where cross_id = #{crossId}
</delete>
<delete
id=
"deleteOne"
>
<delete
id=
"deleteOne"
>
delete from t_cross_lights
delete from t_cross_lights
where cross_id = #{crossId} and name = #{elementId}
where cross_id = #{crossId} and name = #{elementId}
</delete>
</delete>
<select
id=
"selectByCrossIdAndLedNum"
resultMap=
"BaseResultMap"
>
<delete
id=
"deleteByCrossId"
>
select id,
delete from t_cross_lights
lights_no,
type,
dir,
sort,
cross_id,
gmt_create,
gmt_modified
from t_base_cross_lights
where cross_id = #{crossId}
where cross_id = #{crossId}
and lights_no = #{ledNum}
</delete>
</select>
<select
id=
"selectByCrossId"
resultMap=
"BaseResultMap"
>
<select
id=
"selectByCrossId"
resultMap=
"BaseResultMap"
>
select id,
lights_no,
type,
dir,
sort,
cross_id,
gmt_create,
gmt_modified
from t_base_cross_lights
where cross_id = #{crossId}
</select>
<select
id=
"selectByCrossIdAndDir"
resultMap=
"BaseResultMap"
>
select id,
lights_no,
type,
dir,
sort,
cross_id,
gmt_create,
gmt_modified
from t_base_cross_lights
where cross_id = #{crossId}
and dir = #{dir}
</select>
<select
id=
"selectById"
resultMap=
"BaseResultMap"
>
select id,
lights_no,
type,
dir,
sort,
cross_id,
gmt_create,
gmt_modified
from t_base_cross_lights
where id = #{id}
</select>
<select
id=
"selectByLightsIdsAndDir"
resultMap=
"BaseResultMap"
>
select
select
id,lights_no,type,dir,sort,cross_id,gmt_create,gmt_modified
id,lights_no,name,type,dir,turn,cross_id,in_out_type,gmt_create,gmt_modified
from t_base_cross_lights
from t_cross_lights
where dir = #{dir} and id in
where cross_id = #{crossId}
<foreach
collection=
"lightsIds"
item=
"lightsId"
separator=
","
open=
"("
close=
")"
>
#{lightsId}
</foreach>
</select>
</select>
<select
id=
"listCrossLights"
resultType=
"net.wanji.databus.po.CrossLightsPO"
>
select
id
,lights_no
,type
,dir
,sort
,cross_id
from
t_base_cross_lights
where 1=1
<if
test=
"crossId != null and crossId != ''"
>
and cross_id = #{crossId}
</if>
</select>
</mapper>
</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