CourseOneMapper.xml
4.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?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="org.yrhl.syncdata.mapper.local.CourseOneMapper">
<select id="getList" resultType="org.yrhl.syncdata.domain.BusinessDataResultsEntity">
select * from business_data_results where create_date BETWEEN DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND DATE_SUB(CURDATE(), INTERVAL 1 SECOND);
</select>
<select id="getBlockSourceDataEntityList" resultType="org.yrhl.syncdata.domain.BlockSourceDataEntity">
select * from block_source_data where create_date BETWEEN DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND DATE_SUB(CURDATE(), INTERVAL 1 SECOND);
</select>
<select id="getBlockNewSourceDataEntityList" resultType="org.yrhl.syncdata.domain.BlockNewSourceDataEntity">
select * from block_new_source_data ;
</select>
<select id="getAllinonepushresultsEntityList" resultType="org.yrhl.syncdata.domain.AllinonepushresultsEntity">
select * from allinonepushresults where CreateTime BETWEEN DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND DATE_SUB(CURDATE(), INTERVAL 1 SECOND);
</select>
<select id="getSyncTableList" resultType="org.yrhl.syncdata.domain.SyncTable">
select TableName from sync_table where isDelete=0 ;
</select>
<select id="getSyncResultListForWaitForAllinonepushresults" resultType="org.yrhl.syncdata.domain.SyncResult" parameterType="string">
SELECT
#{tableName} as TableName ,a.Id as InfoId ,a.CreateTime AS DateCreateTime,0 AS STATUS,now() AS CreateDateTime,now() AS UpdateTime
FROM ${tableName} a
WHERE
a.CreateTime >( SELECT IF ( max( datecreatetime ) IS NULL, '2024-09-01 00:00:00', max( datecreatetime )) FROM sync_result sr WHERE sr.TableName = #{tableName} )
ORDER BY
a.CreateTime
LIMIT #{page},
#{size}
</select>
<select id="isExist" resultType="int" parameterType="long">
SELECT count(1) from sync_result where InfoId=#{infoId}
</select>
<select id="getSyncResultListForWait" resultType="org.yrhl.syncdata.domain.SyncResult" parameterType="string">
SELECT
#{tableName} as TableName ,a.Id as InfoId ,a.create_date AS DateCreateTime,0 AS STATUS,now() AS CreateDateTime,now() AS UpdateTime
FROM ${tableName} a
WHERE
a.create_date >( SELECT IF ( max( datecreatetime ) IS NULL, '2024-01-01 00:00:00', max( datecreatetime )) FROM sync_result sr WHERE sr.TableName = #{tableName} )
ORDER BY
a.create_date
LIMIT #{page},
#{size}
</select>
<insert id="insertSyncResult">
INSERT INTO sync_result (
Id,
TableName,
InfoId,
DateCreateTime,
Status,
CreateDateTime,
UpdateTime
)
VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.id},
#{item.TableName},
#{item.InfoId},
#{item.DateCreateTime},
0,
#{item.CreateDateTime},
#{item.UpdateTime}
)
</foreach>
</insert>
<update id="updateSyncResult" parameterType="long" >
UPDATE sync_result
SET Status =1
WHERE InfoId = #{infoId}
</update>
<update id="updateSyncResultFail" parameterType="long" >
UPDATE sync_result
SET Status =-1
WHERE InfoId = #{infoId}
</update>
<select id="getSyncTableList" resultType="org.yrhl.syncdata.domain.SyncTable">
select * from sync_table where isDelete=0 ;
</select>
<select id="getSyncResultListForWaitForConsumer" resultType="org.yrhl.syncdata.domain.AllinonepushresultsEntity" parameterType="string">
select * from ${tableName} a where a.Id in(select InfoId from sync_result where TableName =#{tableName} and Status !=1) order by a.CreateTime asc limit #{page},#{size}
</select>
<select id="getSyncResultListForWaitForOtherConsumer" resultType="map" parameterType="string">
select * from ${tableName} a where a.Id in(select InfoId from sync_result where TableName =#{tableName} and Status !=1) order by a.create_date asc limit #{page},#{size}
</select>
<select id="isExesit" resultType="int" parameterType="long">
select count(1) from sync_result where InfoId=#{infoId}
</select>
</mapper>