SmartDataTaskMapper.java 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. package com.template.mapper;
  2. import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  3. import com.template.model.pojo.SmartDataTask;
  4. import com.template.model.pojo.SmartDataTaskDebug;
  5. import com.template.model.pojo.SmartDataTaskLog;
  6. import com.template.model.pojo.SmartDataTaskSetDebugSql;
  7. import org.apache.ibatis.annotations.*;
  8. import org.springframework.stereotype.Repository;
  9. import java.util.List;
  10. /**
  11. * <p>
  12. * 数据源任务 Mapper 接口
  13. * </p>
  14. *
  15. * @author ceshi
  16. * @since 2023-12-05
  17. */
  18. @Repository
  19. public interface SmartDataTaskMapper extends BaseMapper<SmartDataTask> {
  20. @Select("SELECT " +
  21. " COUNT(tk_id) " +
  22. "FROM " +
  23. " smart_data_task " +
  24. "WHERE " +
  25. " tk_name = #{tkName} " +
  26. " AND tk_id != #{tkId} "
  27. )
  28. int isRepeatTaskName(SmartDataTask smartDataTask);
  29. @Update("UPDATE smart_data_task " +
  30. "SET tk_activation = #{tkActivation} " +
  31. " ,tk_next_exe_time = #{tkNextExeTime} " +
  32. "WHERE " +
  33. " tk_id = #{tkId} "
  34. )
  35. int markTaskById(SmartDataTask smartDataTask);
  36. @Insert({
  37. "<script>",
  38. "INSERT INTO smart_data_task ",
  39. " <trim prefix='(' suffix=')' suffixOverrides=','> ",
  40. " <if test='tkName != null'>tk_name,</if> ",
  41. " <if test='tkDtId != null'>tk_dt_id,</if> ",
  42. " <if test='tkDsIdSource != null'>tk_ds_id_source,</if> ",
  43. " <if test='tkSyncPolicy != null'>tk_sync_policy,</if> ",
  44. " <if test='tkExchangeType != null'>tk_exchange_type,</if> ",
  45. " <if test='tkSql != null'>tk_sql,</if> ",
  46. " <if test='tkDsIdDestination != null'>tk_ds_id_destination,</if> ",
  47. " <if test='tkDestTable != null'>tk_dest_table,</if> ",
  48. " <if test='tkExchangeServer != null'>tk_exchange_server,</if> ",
  49. " <if test='tkExchangeServerId != null'>tk_exchange_server_id,</if> ",
  50. " <if test='tkOptCfgAutoManual != null'>tk_opt_cfg_auto_manual,</if> ",
  51. " <if test='tkOptCfgRsNum != null'>tk_opt_cfg_rs_num,</if> ",
  52. " <if test='tkOptCfgThreadsNum != null'>tk_opt_cfg_threads_num,</if> ",
  53. " <if test='tkRsIncorrectData != null'>tk_rs_incorrect_data,</if> ",
  54. " <if test='tkDsSourceCharset != null'>tk_ds_source_charset,</if> ",
  55. " <if test='tkDsDestinationCharset != null'>tk_ds_destination_charset,</if> ",
  56. " <if test='tkCron != null'>tk_cron,</if> ",
  57. " <if test='tkManualOrAuto != null'>tk_manual_or_auto,</if> ",
  58. " <if test='tkExeType != null'>tk_exe_type,</if> ",
  59. " <if test='tkRepeatTime != null'>tk_repeat_time,</if> ",
  60. " <if test='tkActivation != null'>tk_activation,</if> ",
  61. " <if test='tkDeleted != null'>tk_deleted,</if> ",
  62. " <if test='tkNextExeTime != null'>tk_next_exe_time,</if> ",
  63. " </trim> ",
  64. "VALUES ",
  65. " <trim prefix='(' suffix=')' suffixOverrides=','>",
  66. " <if test='tkName != null'>#{tkName},</if> ",
  67. " <if test='tkDtId != null'>#{tkDtId},</if> ",
  68. " <if test='tkDsIdSource != null'>#{tkDsIdSource},</if> ",
  69. " <if test='tkSyncPolicy != null'>#{tkSyncPolicy},</if> ",
  70. " <if test='tkExchangeType != null'>#{tkExchangeType},</if> ",
  71. " <if test='tkSql != null'>#{tkSql},</if> ",
  72. " <if test='tkDsIdDestination != null'>#{tkDsIdDestination},</if> ",
  73. " <if test='tkDestTable != null'>#{tkDestTable},</if> ",
  74. " <if test='tkExchangeServer != null'>#{tkExchangeServer},</if> ",
  75. " <if test='tkExchangeServerId != null'>#{tkExchangeServerId},</if> ",
  76. " <if test='tkOptCfgAutoManual != null'>#{tkOptCfgAutoManual},</if> ",
  77. " <if test='tkOptCfgRsNum != null'>#{tkOptCfgRsNum},</if> ",
  78. " <if test='tkOptCfgThreadsNum != null'>#{tkOptCfgThreadsNum},</if> ",
  79. " <if test='tkRsIncorrectData != null'>#{tkRsIncorrectData},</if> ",
  80. " <if test='tkDsSourceCharset != null'>#{tkDsSourceCharset},</if> ",
  81. " <if test='tkDsDestinationCharset != null'>#{tkDsDestinationCharset},</if> ",
  82. " <if test='tkColRelationship != null'>#{tkColRelationship},</if> ",
  83. " <if test='tkCron != null'>#{tkCron},</if> ",
  84. " <if test='tkManualOrAuto != null'>#{tkManualOrAuto},</if> ",
  85. " <if test='tkExeType != null'>#{tkExeType},</if> ",
  86. " <if test='tkRepeatTime != null'>#{tkRepeatTime},</if> ",
  87. " <if test='tkActivation != null'>#{tkActivation},</if> ",
  88. " <if test='tkDeleted != null'>#{tkDeleted},</if> ",
  89. " <if test='tkNextExeTime != null'>#{tkNextExeTime},</if> ",
  90. " </trim>",
  91. "</script>"
  92. })
  93. @Options(useGeneratedKeys = true, keyProperty = "tkId")
  94. int insertOne(SmartDataTask smartDataTask);
  95. @Update("UPDATE smart_data_task " +
  96. " SET tk_col_relationship = #{colRelationship} " +
  97. "WHERE " +
  98. " tk_id = #{tkId}")
  99. int insertColRelationship(int tkId, String colRelationship);
  100. @Select("SELECT " +
  101. " COUNT(id) " +
  102. "FROM " +
  103. " smart_department " +
  104. "WHERE " +
  105. " id = #{tkDtId} ")
  106. int isHaveDepartmentById(Integer tkDtId);
  107. @Select("SELECT " +
  108. " tk_id " +
  109. " ,tk_col_relationship " +
  110. "FROM " +
  111. " smart_data_task " +
  112. "WHERE " +
  113. " tk_id = #{tkId} "
  114. )
  115. SmartDataTask selectColRelationship(int tkId);
  116. @Select("SELECT " +
  117. " tk_activation " +
  118. "FROM " +
  119. " smart_data_task " +
  120. "WHERE " +
  121. " tk_id = #{tkId} "
  122. )
  123. int selectColSwappedPrimaryKeys(int tkId);
  124. @Select({
  125. "<script>",
  126. " SELECT ",
  127. " COUNT(*) ",
  128. " FROM smart_data_task ",
  129. " <where>",
  130. " <if test='tkId != null'>AND tk_id = #{tkId}</if> ",
  131. " <if test='tkName != null'>AND tk_name = #{tkName}</if> ",
  132. " <if test='tkDtId != null'>AND tk_dt_id = #{tkDtId}</if> ",
  133. " <if test='tkDsIdSource != null'>AND tk_ds_id_source = #{tkDsIdSource}</if> ",
  134. " <if test='tkSyncPolicy != null'>AND tk_sync_policy = #{tkSyncPolicy}</if> ",
  135. " <if test='tkExchangeType != null'>AND tk_exchange_type = #{tkExchangeType}</if> ",
  136. " <if test='tkSql != null'>AND tk_sql = #{tkSql}</if> ",
  137. " <if test='tkDsIdDestination != null'>AND tk_ds_id_destination = #{tkDsIdDestination}</if> ",
  138. " <if test='tkDestTable != null'>AND tk_dest_table = #{tkDestTable}</if> ",
  139. " <if test='tkExchangeServer != null'>AND tk_exchange_server = #{tkExchangeServer}</if> ",
  140. " <if test='tkExchangeServerId != null'>AND tk_exchange_server_id = #{tkExchangeServerId}</if> ",
  141. " <if test='tkOptCfgAutoManual != null'>AND tk_opt_cfg_auto_manual = #{tkOptCfgAutoManual}</if> ",
  142. " <if test='tkOptCfgRsNum != null'>AND tk_opt_cfg_rs_num = #{tkOptCfgRsNum}</if> ",
  143. " <if test='tkOptCfgThreadsNum != null'>AND tk_opt_cfg_threads_num = #{tkOptCfgThreadsNum}</if> ",
  144. " <if test='tkRsIncorrectData != null'>AND tk_rs_incorrect_data = #{tkRsIncorrectData}</if> ",
  145. " <if test='tkDsSourceCharset != null'>AND tk_ds_source_charset = #{tkDsSourceCharset}</if> ",
  146. " <if test='tkDsDestinationCharset != null'>AND tk_ds_destination_charset = #{tkDsDestinationCharset}</if> ",
  147. " <if test='tkColRelationship != null'>AND tk_name = #{tkColRelationship}</if> ",
  148. " <if test='tkCron != null'>AND tk_cron = #{tkCron}</if> ",
  149. " <if test='tkManualOrAuto != null'>AND tk_manual_or_auto = #{tkManualOrAuto}</if> ",
  150. " <if test='tkExeType != null'>AND tk_exe_type = #{tkExeType}</if> ",
  151. " <if test='tkRepeatTime != null'>AND tk_repeat_time = #{tkRepeatTime}</if> ",
  152. " <if test='tkActivation != null'>AND tk_activation = #{tkActivation}</if> ",
  153. " <if test='tkDeleted != null'>AND tk_deleted = #{tkDeleted}</if> ",
  154. " <if test='tkNextExeTime != null'>AND tk_next_exe_time = #{tkNextExeTime}</if> ",
  155. " </where>",
  156. "</script>"
  157. })
  158. int isRepeatTask(SmartDataTask smartDataTask);
  159. @Update("UPDATE smart_data_task " +
  160. "SET tk_deleted = 1 " +
  161. "WHERE " +
  162. " tk_id = #{id} "
  163. )
  164. int logicDeleteMarkTaskById(int id);
  165. @Delete("DELETE FROM smart_data_task " +
  166. "WHERE " +
  167. " tk_id = #{id} "
  168. )
  169. int physicsDeleteMarkTaskById(int id);
  170. @Update("UPDATE smart_data_task " +
  171. "SET tk_deleted = 0 " +
  172. "WHERE " +
  173. " tk_id = #{id} "
  174. )
  175. int restoreLogicDeleteMarkTaskById(int id);
  176. @Update("UPDATE smart_data_task " +
  177. "SET tk_swapped_primary_keys = #{tkSwappedPrimaryKeys} " +
  178. "WHERE " +
  179. " tk_id = #{tkId} "
  180. )
  181. int saveSwappedPrimaryKeys(SmartDataTask smartDataTask);
  182. @Insert({
  183. "<script>",
  184. "INSERT INTO smart_data_task_debug ",
  185. " <trim prefix='(' suffix=')' suffixOverrides=','> ",
  186. " <if test='eTaskId != null'>e_task_id,</if> ",
  187. " <if test='eTaskName != null'>e_task_name,</if> ",
  188. " <if test='eDateTime != null'>e_date_time,</if> ",
  189. " <if test='eMsg != null'>e_msg,</if> ",
  190. " </trim> ",
  191. "VALUES ",
  192. " <trim prefix='(' suffix=')' suffixOverrides=','>",
  193. " <if test='eTaskId != null'>#{eTaskId},</if> ",
  194. " <if test='eTaskName != null'>#{eTaskName},</if> ",
  195. " <if test='eDateTime != null'>#{eDateTime},</if> ",
  196. " <if test='eMsg != null'>#{eMsg},</if> ",
  197. " </trim>",
  198. "</script>"
  199. })
  200. int insertErrorMsg(SmartDataTaskDebug smartDataTaskDebug);
  201. @Select({
  202. "<script>",
  203. " SELECT ",
  204. " * ",
  205. " FROM smart_data_task_debug ",
  206. " <where>",
  207. " <if test='eTaskId != null'>AND e_task_id = #{eTaskId}</if> ",
  208. " <if test='eMsg != null'>AND e_msg = #{eMsg}</if> ",
  209. " </where>",
  210. "</script>"
  211. })
  212. SmartDataTaskDebug selectErrorMsg(SmartDataTaskDebug smartDataTaskDebug);
  213. @Update("UPDATE smart_data_task_debug " +
  214. "SET " +
  215. " e_task_id = #{eTaskId} " +
  216. " ,e_task_name = #{eTaskName} " +
  217. " ,e_msg = #{eMsg} " +
  218. " ,e_num = e_num + 1 " +
  219. " ,e_date_time = #{eDateTime} " +
  220. "WHERE " +
  221. " e_id = #{eId} "
  222. )
  223. int updateErrorMsg(SmartDataTaskDebug smartDataTaskErr);
  224. @Select({
  225. "<script>",
  226. " SELECT ",
  227. " tk_col_relationship ",
  228. " FROM smart_data_task ",
  229. " <where>",
  230. " <if test='tkId != null'>AND tk_id = #{tkId}</if> ",
  231. " </where>",
  232. "</script>"
  233. })
  234. String getColRelationship(SmartDataTask smartDataTask);
  235. @Select({
  236. "<script>",
  237. " SELECT ",
  238. " e_id, e_task_id, e_task_name, e_msg, e_num, e_date_time, e_create_time ",
  239. " FROM smart_data_task_debug ",
  240. " <where>",
  241. " <if test='eTaskId != null'>AND e_task_id = #{eTaskId}</if> ",
  242. " <if test='startTime != null'>AND e_date_time &gt;= #{startTime}</if> ",
  243. " <if test='endTime != null'>AND e_date_time &lt;= #{endTime}</if> ",
  244. " </where>",
  245. " ORDER BY e_date_time DESC, e_id DESC ",
  246. "</script>"
  247. })
  248. List<SmartDataTaskDebug> selectTaskDebugPageOrderByDatetimeDesc(Integer eTaskId, String startTime, String endTime);
  249. @Delete({
  250. "<script>",
  251. " DELETE ",
  252. " FROM ",
  253. " smart_data_task_debug ",
  254. " WHERE ",
  255. " e_id IN ",
  256. "<foreach collection='ids' item='id' open='(' separator=',' close=')'>#{id}</foreach>",
  257. "</script>"
  258. })
  259. int deleteSmartDataTaskDebugByIds(List<Long> ids);
  260. @Insert({
  261. "<script>",
  262. " INSERT INTO smart_data_task_log ",
  263. " <trim prefix='(' suffix=')' suffixOverrides=','>",
  264. " <if test='tkLogTaskId != null'>tk_log_task_id,</if>",
  265. " <if test='tkLogTaskName != null'>tk_log_task_name,</if>",
  266. " <if test='tkLogDtName != null'>tk_log_dt_name,</if>",
  267. " <if test='tkLogDsSourceId != null'>tk_log_ds_source_id,</if>",
  268. " <if test='tkLogDsSourceName != null'>tk_log_ds_source_name,</if>",
  269. " <if test='tkLogDsDestinationId != null'>tk_log_ds_destination_id,</if>",
  270. " <if test='tkLogDsDestinationName != null'>tk_log_ds_destination_name,</if>",
  271. " <if test='tkLogDestTable != null'>tk_log_dest_table,</if>",
  272. " <if test='tkLogExchangeServer != null'>tk_log_exchange_server,</if>",
  273. " <if test='tkLogExchangeType != null'>tk_log_exchange_type,</if>",
  274. " <if test='tkLogAutoManual != null'>tk_log_auto_manual,</if>",
  275. " <if test='tkLogExeType != null'>tk_log_exe_type,</if>",
  276. " <if test='tkLogExeStatus != null'>tk_log_exe_status,</if>",
  277. " <if test='tkLogStartTime != null'>tk_log_start_time,</if>",
  278. " <if test='tkLogEndTime != null'>tk_log_end_time,</if>",
  279. " <if test='tkLogCostTime != null'>tk_log_cost_time,</if>",
  280. " <if test='tkLogReadRows != null'>tk_log_read_rows,</if>",
  281. " <if test='tkLogInsertRows != null'>tk_log_insert_rows,</if>",
  282. " <if test='tkLogUpdateRows != null'>tk_log_update_rows,</if>",
  283. " <if test='tkLogErrRows != null'>tk_log_err_rows,</if>",
  284. " <if test='tkLogErrException != null'>tk_log_err_exception,</if>",
  285. " </trim>",
  286. "VALUES",
  287. " <trim prefix='(' suffix=')' suffixOverrides=','>",
  288. " <if test='tkLogTaskId != null'>#{tkLogTaskId},</if>",
  289. " <if test='tkLogTaskName != null'>#{tkLogTaskName},</if>",
  290. " <if test='tkLogDtName != null'>#{tkLogDtName},</if>",
  291. " <if test='tkLogDsSourceId != null'>#{tkLogDsSourceId},</if>",
  292. " <if test='tkLogDsSourceName != null'>#{tkLogDsSourceName},</if>",
  293. " <if test='tkLogDsDestinationId != null'>#{tkLogDsDestinationId},</if>",
  294. " <if test='tkLogDsDestinationName != null'>#{tkLogDsDestinationName},</if>",
  295. " <if test='tkLogDestTable != null'>#{tkLogDestTable},</if>",
  296. " <if test='tkLogExchangeServer != null'>#{tkLogExchangeServer},</if>",
  297. " <if test='tkLogExchangeType != null'>#{tkLogExchangeType},</if>",
  298. " <if test='tkLogAutoManual != null'>#{tkLogAutoManual},</if>",
  299. " <if test='tkLogExeType != null'>#{tkLogExeType},</if>",
  300. " <if test='tkLogExeStatus != null'>#{tkLogExeStatus},</if>",
  301. " <if test='tkLogStartTime != null'>#{tkLogStartTime},</if>",
  302. " <if test='tkLogEndTime != null'>#{tkLogEndTime},</if>",
  303. " <if test='tkLogCostTime != null'>#{tkLogCostTime},</if>",
  304. " <if test='tkLogReadRows != null'>#{tkLogReadRows},</if>",
  305. " <if test='tkLogInsertRows != null'>#{tkLogInsertRows},</if>",
  306. " <if test='tkLogUpdateRows != null'>#{tkLogUpdateRows},</if>",
  307. " <if test='tkLogErrRows != null'>#{tkLogErrRows},</if>",
  308. " <if test='tkLogErrException != null'>#{tkLogErrException},</if>",
  309. " </trim>",
  310. "</script>"
  311. })
  312. @Options(useGeneratedKeys = true, keyProperty = "tkLogId")
  313. int insertTaskLog(SmartDataTaskLog smartDataTaskLog);
  314. @Update({
  315. "<script>",
  316. " UPDATE smart_data_task_log ",
  317. " SET",
  318. " <trim suffixOverrides=','>",
  319. " <if test='tkLogTaskId != null'>tk_log_task_id = #{tkLogTaskId},</if>",
  320. " <if test='tkLogTaskName != null'>tk_log_task_name = #{tkLogTaskName},</if>",
  321. " <if test='tkLogDtName != null'>tk_log_dt_name = #{tkLogDtName},</if>",
  322. " <if test='tkLogDsSourceName != null'>tk_log_ds_source_name = #{tkLogDsSourceName},</if>",
  323. " <if test='tkLogDsSourceId != null'>tk_log_ds_source_id = #{tkLogDsSourceId},</if>",
  324. " <if test='tkLogDsDestinationName != null'>tk_log_ds_destination_name = #{tkLogDsDestinationName},</if>",
  325. " <if test='tkLogDsDestinationId != null'>tk_log_ds_destination_id = #{tkLogDsDestinationId},</if>",
  326. " <if test='tkLogDestTable != null'>tk_log_dest_table = #{tkLogDestTable},</if>",
  327. " <if test='tkLogExchangeServer != null'>tk_log_exchange_server = #{tkLogExchangeServer},</if>",
  328. " <if test='tkLogExchangeType != null'>tk_log_exchange_type = #{tkLogExchangeType},</if>",
  329. " <if test='tkLogAutoManual != null'>tk_log_auto_manual = #{tkLogAutoManual},</if>",
  330. " <if test='tkLogExeType != null'>tk_log_exe_type = #{tkLogExeType},</if>",
  331. " <if test='tkLogExeStatus != null'>tk_log_exe_status = #{tkLogExeStatus},</if>",
  332. " <if test='tkLogStartTime != null'>tk_log_start_time = #{tkLogStartTime},</if>",
  333. " <if test='tkLogEndTime != null'>tk_log_end_time = #{tkLogEndTime},</if>",
  334. " <if test='tkLogCostTime != null'>tk_log_cost_time = #{tkLogCostTime},</if>",
  335. " <if test='tkLogReadRows != null'>tk_log_read_rows = #{tkLogReadRows},</if>",
  336. " <if test='tkLogInsertRows != null'>tk_log_insert_rows = #{tkLogInsertRows},</if>",
  337. " <if test='tkLogUpdateRows != null'>tk_log_update_rows = #{tkLogUpdateRows},</if>",
  338. " <if test='tkLogErrRows != null'>tk_log_err_rows = #{tkLogErrRows},</if>",
  339. " <if test='tkLogErrException != null'>tk_log_err_exception = #{tkLogErrException},</if>",
  340. " </trim>",
  341. " WHERE ",
  342. " tk_log_id = #{tkLogId} ",
  343. "</script>"
  344. })
  345. int updateTaskLog(SmartDataTaskLog smartDataTaskLog);
  346. @Select({
  347. "<script>",
  348. " SELECT ",
  349. " * ",
  350. " FROM smart_data_task_log ",
  351. " <where>",
  352. " <if test='eTaskId != null'>AND tk_log_task_id = #{eTaskId}</if> ",
  353. " <if test='tkLogAutoManual != null'>AND tk_log_auto_manual = #{tkLogAutoManual}</if> ",
  354. " <if test='tkLogDsSourceId != null'>AND tk_log_ds_source_id = #{tkLogDsSourceId}</if> ",
  355. " <if test='tkLogDsDestinationId != null'>AND tk_log_ds_destination_id = #{tkLogDsDestinationId}</if> ",
  356. " <if test='tkLogCostTime != null'> ",
  357. " <if test='tkLogCostTime == 1'>AND tk_log_cost_time &lt; 60000</if> ",
  358. " <if test='tkLogCostTime == 2'>AND tk_log_cost_time BETWEEN 60000 AND 300000</if> ",
  359. " <if test='tkLogCostTime == 3'>AND tk_log_cost_time BETWEEN 300000 AND 600000</if> ",
  360. " <if test='tkLogCostTime == 4'>AND tk_log_cost_time BETWEEN 300000 AND 600000</if> ",
  361. " <if test='tkLogCostTime == 5'>AND tk_log_cost_time BETWEEN 600000 AND 1800000</if> ",
  362. " <if test='tkLogCostTime == 6'>AND tk_log_cost_time &gt; 1800000</if> ",
  363. " </if> ",
  364. " <if test='tkLogExeStatus != null'> ",
  365. " <if test='tkLogExeStatus == 1'>AND tk_log_exe_status = '执行中'</if> ",
  366. " <if test='tkLogExeStatus == 2'>AND tk_log_exe_status = '执行成功'</if> ",
  367. " <if test='tkLogExeStatus == 3'>AND tk_log_exe_status = '部分数据异常'</if> ",
  368. " <if test='tkLogExeStatus == 4'>AND tk_log_exe_status = '执行中断'</if> ",
  369. " <if test='tkLogExeStatus == 5'>AND tk_log_exe_status = '执行跳过'</if> ",
  370. " <if test='tkLogExeStatus == 6'>AND tk_log_exe_status = '执行失败'</if> ",
  371. " </if> ",
  372. " <if test='startTime != null'>AND tk_log_start_time &gt;= #{startTime}</if> ",
  373. " <if test='endTime != null'>AND tk_log_end_time &lt;= #{endTime}</if> ",
  374. " </where>",
  375. " ORDER BY tk_log_update_time DESC, tk_log_task_id DESC ",
  376. "</script>"
  377. })
  378. List<SmartDataTaskLog> selectTaskLogPageOrderByDatetimeDesc(Integer eTaskId, String tkLogTaskName, Integer tkLogAutoManual,
  379. Integer tkLogDsSourceId, Integer tkLogDsDestinationId,
  380. Integer tkLogCostTime, Integer tkLogExeStatus,
  381. String startTime, String endTime);
  382. @Select({
  383. "<script>",
  384. " SELECT ",
  385. " * ",
  386. " FROM smart_data_task_log ",
  387. " <where>",
  388. " <if test='tkLogTaskId != null'>AND tk_log_task_id = #{tkLogTaskId}</if> ",
  389. " <if test='tkLogExeStatus != null'> ",
  390. " <if test='tkLogExeStatus == 1'>AND tk_log_exe_status = '执行中'</if> ",
  391. " </if> ",
  392. " </where>",
  393. "</script>"
  394. })
  395. List<SmartDataTaskLog> queryTaskExecuting(Integer tkLogTaskId, Integer tkLogExeStatus);
  396. @Select({
  397. "<script>",
  398. " SELECT ",
  399. " tk_id, tk_name, tk_debug_sql ",
  400. " FROM ",
  401. " smart_data_task ",
  402. " ORDER BY ",
  403. " tk_name ",
  404. "</script>"
  405. })
  406. List<SmartDataTaskSetDebugSql> queryTaskDebugSql();
  407. @Update("UPDATE smart_data_task " +
  408. "SET tk_debug_sql = #{tkDebugSql} " +
  409. "WHERE " +
  410. " tk_id = #{tkId} "
  411. )
  412. int queryTaskSetDebugSql(int tkId, int tkDebugSql);
  413. @Select({
  414. "<script>",
  415. " SELECT ",
  416. " * ",
  417. " FROM ",
  418. " smart_data_task ",
  419. " ORDER BY ",
  420. " tk_name ",
  421. "</script>"
  422. })
  423. List<SmartDataTask> queryAllTask();
  424. }