|
1 | | -<?xml version="1.0" encoding="UTF-8"?> |
2 | | -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
3 | | - "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
4 | | -<mapper namespace="com.datamate.datamanagement.infrastructure.persistence.mapper.DatasetFileMapper"> |
5 | | - <sql id="Base_Column_List"> |
6 | | - id, dataset_id, file_name, file_path, file_type, file_size, check_sum, tags, metadata, status, |
7 | | - upload_time, last_access_time, created_at, updated_at |
8 | | - </sql> |
9 | | - |
10 | | - <select id="findById" parameterType="string" |
11 | | - resultType="com.datamate.datamanagement.domain.model.dataset.DatasetFile"> |
12 | | - SELECT <include refid="Base_Column_List"/> |
13 | | - FROM t_dm_dataset_files |
14 | | - WHERE id = #{id} |
15 | | - </select> |
16 | | - |
17 | | - <select id="findByDatasetId" parameterType="string" |
18 | | - resultType="com.datamate.datamanagement.domain.model.dataset.DatasetFile"> |
19 | | - SELECT <include refid="Base_Column_List"/> |
20 | | - FROM t_dm_dataset_files |
21 | | - WHERE dataset_id = #{datasetId} |
22 | | - ORDER BY upload_time DESC |
23 | | - </select> |
24 | | - |
25 | | - <select id="findByDatasetIdAndStatus" resultType="com.datamate.datamanagement.domain.model.dataset.DatasetFile"> |
26 | | - SELECT <include refid="Base_Column_List"/> |
27 | | - FROM t_dm_dataset_files |
28 | | - WHERE dataset_id = #{datasetId} |
29 | | - AND status = #{status} |
30 | | - ORDER BY upload_time DESC |
31 | | - </select> |
32 | | - |
33 | | - <select id="findByDatasetIdAndFileType" resultType="com.datamate.datamanagement.domain.model.dataset.DatasetFile"> |
34 | | - SELECT <include refid="Base_Column_List"/> |
35 | | - FROM t_dm_dataset_files |
36 | | - WHERE dataset_id = #{datasetId} |
37 | | - AND file_type = #{fileType} |
38 | | - ORDER BY upload_time DESC |
39 | | - </select> |
40 | | - |
41 | | - <select id="countByDatasetId" parameterType="string" resultType="long"> |
42 | | - SELECT COUNT(*) FROM t_dm_dataset_files WHERE dataset_id = #{datasetId} |
43 | | - </select> |
44 | | - |
45 | | - <select id="countCompletedByDatasetId" parameterType="string" resultType="long"> |
46 | | - SELECT COUNT(*) FROM t_dm_dataset_files WHERE dataset_id = #{datasetId} AND status = 'COMPLETED' |
47 | | - </select> |
48 | | - |
49 | | - <select id="sumSizeByDatasetId" parameterType="string" resultType="long"> |
50 | | - SELECT COALESCE(SUM(file_size), 0) FROM t_dm_dataset_files WHERE dataset_id = #{datasetId} |
51 | | - </select> |
52 | | - |
53 | | - <select id="findByDatasetIdAndFileName" resultType="com.datamate.datamanagement.domain.model.dataset.DatasetFile"> |
54 | | - SELECT <include refid="Base_Column_List"/> |
55 | | - FROM t_dm_dataset_files |
56 | | - WHERE dataset_id = #{datasetId} AND file_name = #{fileName} |
57 | | - LIMIT 1 |
58 | | - </select> |
59 | | - |
60 | | - <select id="findAllByDatasetId" parameterType="string" |
61 | | - resultType="com.datamate.datamanagement.domain.model.dataset.DatasetFile"> |
62 | | - SELECT <include refid="Base_Column_List"/> |
63 | | - FROM t_dm_dataset_files |
64 | | - WHERE dataset_id = #{datasetId} |
65 | | - ORDER BY upload_time DESC |
66 | | - </select> |
67 | | - |
68 | | - <select id="findByCriteria" resultType="com.datamate.datamanagement.domain.model.dataset.DatasetFile"> |
69 | | - SELECT <include refid="Base_Column_List"/> |
70 | | - FROM t_dm_dataset_files |
71 | | - WHERE dataset_id = #{datasetId} |
72 | | - <!-- Replace invalid XML '&&' with 'and' for MyBatis OGNL --> |
73 | | - <if test="fileType != null and fileType != ''"> |
74 | | - AND file_type = #{fileType} |
75 | | - </if> |
76 | | - <if test="status != null and status != ''"> |
77 | | - AND status = #{status} |
78 | | - </if> |
79 | | - ORDER BY upload_time DESC |
80 | | - </select> |
81 | | - |
82 | | - |
83 | | - <update id="update" parameterType="com.datamate.datamanagement.domain.model.dataset.DatasetFile"> |
84 | | - UPDATE t_dm_dataset_files |
85 | | - SET file_name = #{fileName}, |
86 | | - file_path = #{filePath}, |
87 | | - file_type = #{fileType}, |
88 | | - file_size = #{fileSize}, |
89 | | - upload_time = #{uploadTime}, |
90 | | - last_access_time = #{lastAccessTime}, |
91 | | - status = #{status} |
92 | | - WHERE id = #{id} |
93 | | - </update> |
94 | | - |
95 | | - <delete id="deleteById" parameterType="string"> |
96 | | - DELETE FROM t_dm_dataset_files WHERE id = #{id} |
97 | | - </delete> |
98 | | -</mapper> |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 3 | + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| 4 | +<mapper namespace="com.datamate.datamanagement.infrastructure.persistence.mapper.DatasetFileMapper"> |
| 5 | + <sql id="Base_Column_List"> |
| 6 | + id, dataset_id, file_name, file_path, file_type, file_size, check_sum, tags, tags_updated_at, metadata, status, |
| 7 | + upload_time, last_access_time, created_at, updated_at |
| 8 | + </sql> |
| 9 | + |
| 10 | + <select id="findById" parameterType="string" |
| 11 | + resultType="com.datamate.datamanagement.domain.model.dataset.DatasetFile"> |
| 12 | + SELECT <include refid="Base_Column_List"/> |
| 13 | + FROM t_dm_dataset_files |
| 14 | + WHERE id = #{id} |
| 15 | + </select> |
| 16 | + |
| 17 | + <select id="findByDatasetId" parameterType="string" |
| 18 | + resultType="com.datamate.datamanagement.domain.model.dataset.DatasetFile"> |
| 19 | + SELECT <include refid="Base_Column_List"/> |
| 20 | + FROM t_dm_dataset_files |
| 21 | + WHERE dataset_id = #{datasetId} |
| 22 | + ORDER BY upload_time DESC |
| 23 | + </select> |
| 24 | + |
| 25 | + <select id="findByDatasetIdAndStatus" resultType="com.datamate.datamanagement.domain.model.dataset.DatasetFile"> |
| 26 | + SELECT <include refid="Base_Column_List"/> |
| 27 | + FROM t_dm_dataset_files |
| 28 | + WHERE dataset_id = #{datasetId} |
| 29 | + AND status = #{status} |
| 30 | + ORDER BY upload_time DESC |
| 31 | + </select> |
| 32 | + |
| 33 | + <select id="findByDatasetIdAndFileType" resultType="com.datamate.datamanagement.domain.model.dataset.DatasetFile"> |
| 34 | + SELECT <include refid="Base_Column_List"/> |
| 35 | + FROM t_dm_dataset_files |
| 36 | + WHERE dataset_id = #{datasetId} |
| 37 | + AND file_type = #{fileType} |
| 38 | + ORDER BY upload_time DESC |
| 39 | + </select> |
| 40 | + |
| 41 | + <select id="countByDatasetId" parameterType="string" resultType="long"> |
| 42 | + SELECT COUNT(*) FROM t_dm_dataset_files WHERE dataset_id = #{datasetId} |
| 43 | + </select> |
| 44 | + |
| 45 | + <select id="countCompletedByDatasetId" parameterType="string" resultType="long"> |
| 46 | + SELECT COUNT(*) FROM t_dm_dataset_files WHERE dataset_id = #{datasetId} AND status = 'COMPLETED' |
| 47 | + </select> |
| 48 | + |
| 49 | + <select id="sumSizeByDatasetId" parameterType="string" resultType="long"> |
| 50 | + SELECT COALESCE(SUM(file_size), 0) FROM t_dm_dataset_files WHERE dataset_id = #{datasetId} |
| 51 | + </select> |
| 52 | + |
| 53 | + <select id="findByDatasetIdAndFileName" resultType="com.datamate.datamanagement.domain.model.dataset.DatasetFile"> |
| 54 | + SELECT <include refid="Base_Column_List"/> |
| 55 | + FROM t_dm_dataset_files |
| 56 | + WHERE dataset_id = #{datasetId} AND file_name = #{fileName} |
| 57 | + LIMIT 1 |
| 58 | + </select> |
| 59 | + |
| 60 | + <select id="findAllByDatasetId" parameterType="string" |
| 61 | + resultType="com.datamate.datamanagement.domain.model.dataset.DatasetFile"> |
| 62 | + SELECT <include refid="Base_Column_List"/> |
| 63 | + FROM t_dm_dataset_files |
| 64 | + WHERE dataset_id = #{datasetId} |
| 65 | + ORDER BY upload_time DESC |
| 66 | + </select> |
| 67 | + |
| 68 | + <select id="findByCriteria" resultType="com.datamate.datamanagement.domain.model.dataset.DatasetFile"> |
| 69 | + SELECT <include refid="Base_Column_List"/> |
| 70 | + FROM t_dm_dataset_files |
| 71 | + WHERE dataset_id = #{datasetId} |
| 72 | + <!-- Replace invalid XML '&&' with 'and' for MyBatis OGNL --> |
| 73 | + <if test="fileType != null and fileType != ''"> |
| 74 | + AND file_type = #{fileType} |
| 75 | + </if> |
| 76 | + <if test="status != null and status != ''"> |
| 77 | + AND status = #{status} |
| 78 | + </if> |
| 79 | + ORDER BY upload_time DESC |
| 80 | + </select> |
| 81 | + |
| 82 | + |
| 83 | + <update id="update" parameterType="com.datamate.datamanagement.domain.model.dataset.DatasetFile"> |
| 84 | + UPDATE t_dm_dataset_files |
| 85 | + SET file_name = #{fileName}, |
| 86 | + file_path = #{filePath}, |
| 87 | + file_type = #{fileType}, |
| 88 | + file_size = #{fileSize}, |
| 89 | + upload_time = #{uploadTime}, |
| 90 | + last_access_time = #{lastAccessTime}, |
| 91 | + status = #{status} |
| 92 | + WHERE id = #{id} |
| 93 | + </update> |
| 94 | + |
| 95 | + <delete id="deleteById" parameterType="string"> |
| 96 | + DELETE FROM t_dm_dataset_files WHERE id = #{id} |
| 97 | + </delete> |
| 98 | +</mapper> |
0 commit comments