ImportMapper.java
2.97 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
package com.uccc.number.mapper;
import com.uccc.number.domain.ImportPoolProgress;
import com.uccc.number.domain.Number;
import com.uccc.number.domain.NumberImportTask;
import com.uccc.number.domain.PrefixNew;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
public interface ImportMapper {
static final String NUMBER_IMPORT_TASK = "number_import_task";
@Insert({
"<script>",
"insert into " + NUMBER_IMPORT_TASK + " (",
"import_key,cts,pushed_count,total_count,fail_count,filename,status,type",
")",
"values" + " (",
"#{import.importKey},now(),#{import.pushedCount},#{import.totalCount},#{import.failCount},#{import.filename},#{import.status}, #{import.type}",
")",
"</script>"
})
int insertImportTask(@Param("import") ImportPoolProgress importPoolProgress);
@Update({
"<script>",
"UPDATE " + NUMBER_IMPORT_TASK + " SET uts = now()",
"<when test='import.pushedCount!=null'>",
",pushed_count = #{import.pushedCount}" ,
"</when>",
"<when test='import.failCount!=null'>",
",fail_count = #{import.failCount}" ,
"</when>",
"<when test='import.status!=null'>",
",status = #{import.status}" ,
"</when>",
"<when test='import.failFile!=null'>",
",fail_file = #{import.failFile}" ,
"</when>",
"where import_key = #{import.importKey}",
"</script>"
})
void updateImportTask(@Param("import") ImportPoolProgress importPoolProgress);
@Select({
"<script>",
"select * from " + NUMBER_IMPORT_TASK,
"where import_key = #{importKey}",
"</script>",
})
ImportPoolProgress getNumTaskByKey(@Param("importKey") String importKey);
@Select({
"<script>",
"select count(*) from " + NUMBER_IMPORT_TASK,
"where status = #{status}",
"</script>",
})
int getTaskByStatus(@Param("status") Integer status);
@Select({
"<script>",
"select * from " + NUMBER_IMPORT_TASK,
"<when test='status!=null'>",
"where status = #{status}",
"</when>",
"order by cts desc",
"limit #{limit}",
"offset #{page}-1",
"</script>"
})
List<ImportPoolProgress> selectNumberImportTasks(@Param("limit") Integer limit, @Param("page") Integer page, @Param("status") Integer status);
@Select({
"<script>",
"select count(*) from " + NUMBER_IMPORT_TASK,
"<when test='status!=null'>",
"where status = #{status}",
"</when>",
"</script>"
})
int selectNumberImportTaskCount(@Param("status") Integer status);
}