| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 |
- package com.template.mapper;
- import com.baomidou.mybatisplus.core.mapper.BaseMapper;
- import com.template.model.pojo.SmartDataTask;
- import com.template.model.pojo.SmartDataTaskErr;
- import org.apache.ibatis.annotations.*;
- import org.springframework.stereotype.Repository;
- /**
- * <p>
- * 数据源任务 Mapper 接口
- * </p>
- *
- * @author ceshi
- * @since 2023-12-05
- */
- @Repository
- public interface SmartDataTaskMapper extends BaseMapper<SmartDataTask> {
- @Select("SELECT " +
- " COUNT(tk_id) " +
- "FROM " +
- " smart_data_task " +
- "WHERE " +
- " tk_name = #{tkName} " +
- " AND tk_id != #{tkId} "
- )
- int isRepeatTaskName(SmartDataTask smartDataTask);
- @Update("UPDATE smart_data_task " +
- "SET tk_activation = #{tkActivation} " +
- " ,tk_next_exe_time = #{tkNextExeTime} " +
- "WHERE " +
- " tk_id = #{tkId} "
- )
- int markTaskById(SmartDataTask smartDataTask);
- @Insert({
- "<script>",
- "INSERT INTO smart_data_task ",
- " <trim prefix='(' suffix=')' suffixOverrides=','> ",
- " <if test='tkName != null'>tk_name,</if> ",
- " <if test='tkDtId != null'>tk_dt_id,</if> ",
- " <if test='tkDsIdSource != null'>tk_ds_id_source,</if> ",
- " <if test='tkSyncPolicy != null'>tk_sync_policy,</if> ",
- " <if test='tkExchangeType != null'>tk_exchange_type,</if> ",
- " <if test='tkSql != null'>tk_sql,</if> ",
- " <if test='tkDsIdDestination != null'>tk_ds_id_destination,</if> ",
- " <if test='tkDestTable != null'>tk_dest_table,</if> ",
- " <if test='tkExchangeServer != null'>tk_exchange_server,</if> ",
- " <if test='tkExchangeServerId != null'>tk_exchange_server_id,</if> ",
- " <if test='tkOptCfgAutoManual != null'>tk_opt_cfg_auto_manual,</if> ",
- " <if test='tkOptCfgRsNum != null'>tk_opt_cfg_rs_num,</if> ",
- " <if test='tkOptCfgThreadsNum != null'>tk_opt_cfg_threads_num,</if> ",
- " <if test='tkRsIncorrectData != null'>tk_rs_incorrect_data,</if> ",
- " <if test='tkDsSourceCharset != null'>tk_ds_source_charset,</if> ",
- " <if test='tkDsDestinationCharset != null'>tk_ds_destination_charset,</if> ",
- " <if test='tkCron != null'>tk_cron,</if> ",
- " <if test='tkManualOrAuto != null'>tk_manual_or_auto,</if> ",
- " <if test='tkExeType != null'>tk_exe_type,</if> ",
- " <if test='tkRepetTime != null'>tk_repet_time,</if> ",
- " <if test='tkActivation != null'>tk_activation,</if> ",
- " <if test='tkDescrition != null'>tk_descrition,</if> ",
- " <if test='tkDeleted != null'>tk_deleted,</if> ",
- " <if test='tkNextExeTime != null'>tk_next_exe_time,</if> ",
- " </trim> ",
- "VALUES ",
- " <trim prefix='(' suffix=')' suffixOverrides=','>",
- " <if test='tkName != null'>#{tkName},</if> ",
- " <if test='tkDtId != null'>#{tkDtId},</if> ",
- " <if test='tkDsIdSource != null'>#{tkDsIdSource},</if> ",
- " <if test='tkSyncPolicy != null'>#{tkSyncPolicy},</if> ",
- " <if test='tkExchangeType != null'>#{tkExchangeType},</if> ",
- " <if test='tkSql != null'>#{tkSql},</if> ",
- " <if test='tkDsIdDestination != null'>#{tkDsIdDestination},</if> ",
- " <if test='tkDestTable != null'>#{tkDestTable},</if> ",
- " <if test='tkExchangeServer != null'>#{tkExchangeServer},</if> ",
- " <if test='tkExchangeServerId != null'>#{tkExchangeServerId},</if> ",
- " <if test='tkOptCfgAutoManual != null'>#{tkOptCfgAutoManual},</if> ",
- " <if test='tkOptCfgRsNum != null'>#{tkOptCfgRsNum},</if> ",
- " <if test='tkOptCfgThreadsNum != null'>#{tkOptCfgThreadsNum},</if> ",
- " <if test='tkRsIncorrectData != null'>#{tkRsIncorrectData},</if> ",
- " <if test='tkDsSourceCharset != null'>#{tkDsSourceCharset},</if> ",
- " <if test='tkDsDestinationCharset != null'>#{tkDsDestinationCharset},</if> ",
- " <if test='tkColRelationship != null'>#{tkColRelationship},</if> ",
- " <if test='tkCron != null'>#{tkCron},</if> ",
- " <if test='tkManualOrAuto != null'>#{tkManualOrAuto},</if> ",
- " <if test='tkExeType != null'>#{tkExeType},</if> ",
- " <if test='tkRepetTime != null'>#{tkRepetTime},</if> ",
- " <if test='tkActivation != null'>#{tkActivation},</if> ",
- " <if test='tkDeleted != null'>#{tkDeleted},</if> ",
- " <if test='tkNextExeTime != null'>#{tkNextExeTime},</if> ",
- " </trim>",
- "</script>"
- })
- @Options(useGeneratedKeys = true, keyProperty = "tk_id")
- int insert(SmartDataTask smartDataTask);
- @Update("UPDATE smart_data_task " +
- " SET tk_col_relationship = #{colRelationship} " +
- "WHERE " +
- " tk_id = #{tkId}")
- int insertColRelationship(int tkId, String colRelationship);
- @Select("SELECT " +
- " COUNT(id) " +
- "FROM " +
- " smart_department " +
- "WHERE " +
- " id = #{tkDtId} ")
- int isHaveDepartmentById(Integer tkDtId);
- @Select("SELECT " +
- " tk_id " +
- " ,tk_col_relationship " +
- "FROM " +
- " smart_data_task " +
- "WHERE " +
- " tk_id = #{tkId} "
- )
- SmartDataTask selectColRelationship(int tkId);
- @Select("SELECT " +
- " tk_id " +
- " ,tk_swapped_primary_keys " +
- "FROM " +
- " smart_data_task " +
- "WHERE " +
- " tk_id = #{tkId} "
- )
- SmartDataTask selectColSwappedPrimaryKeys(int tkId);
- @Select({
- "<script>",
- " SELECT " +
- " COUNT(*) " +
- " FROM smart_data_task ",
- " <where>",
- " <if test='tkId != null'>AND tk_id = #{tkId}</if> ",
- " <if test='tkName != null'>AND tk_name = #{tkName}</if> ",
- " <if test='tkDtId != null'>AND tk_dt_id = #{tkDtId}</if> ",
- " <if test='tkDsIdSource != null'>AND tk_ds_id_source = #{tkDsIdSource}</if> ",
- " <if test='tkSyncPolicy != null'>AND tk_sync_policy = #{tkSyncPolicy}</if> ",
- " <if test='tkExchangeType != null'>AND tk_exchange_type = #{tkExchangeType}</if> ",
- " <if test='tkSql != null'>AND tk_sql = #{tkSql}</if> ",
- " <if test='tkDsIdDestination != null'>AND tk_ds_id_destination = #{tkDsIdDestination}</if> ",
- " <if test='tkDestTable != null'>AND tk_dest_table = #{tkDestTable}</if> ",
- " <if test='tkExchangeServer != null'>AND tk_exchange_server = #{tkExchangeServer}</if> ",
- " <if test='tkExchangeServerId != null'>AND tk_exchange_server_id = #{tkExchangeServerId}</if> ",
- " <if test='tkOptCfgAutoManual != null'>AND tk_opt_cfg_auto_manual = #{tkOptCfgAutoManual}</if> ",
- " <if test='tkOptCfgRsNum != null'>AND tk_opt_cfg_rs_num = #{tkOptCfgRsNum}</if> ",
- " <if test='tkOptCfgThreadsNum != null'>AND tk_opt_cfg_threads_num = #{tkOptCfgThreadsNum}</if> ",
- " <if test='tkRsIncorrectData != null'>AND tk_rs_incorrect_data = #{tkRsIncorrectData}</if> ",
- " <if test='tkDsSourceCharset != null'>AND tk_ds_source_charset = #{tkDsSourceCharset}</if> ",
- " <if test='tkDsDestinationCharset != null'>AND tk_ds_destination_charset = #{tkDsDestinationCharset}</if> ",
- " <if test='tkColRelationship != null'>AND tk_name = #{tkColRelationship}</if> ",
- " <if test='tkCron != null'>AND tk_cron = #{tkCron}</if> ",
- " <if test='tkManualOrAuto != null'>AND tk_manual_or_auto = #{tkManualOrAuto}</if> ",
- " <if test='tkExeType != null'>AND tk_exe_type = #{tkExeType}</if> ",
- " <if test='tkRepetTime != null'>AND tk_repet_time = #{tkRepetTime}</if> ",
- " <if test='tkActivation != null'>AND tk_activation = #{tkActivation}</if> ",
- " <if test='tkDeleted != null'>AND tk_deleted = #{tkDeleted}</if> ",
- " <if test='tkNextExeTime != null'>AND tk_next_exe_time = #{tkNextExeTime}</if> ",
- " </where>",
- "</script>"
- })
- int isRepeatTask(SmartDataTask smartDataTask);
- @Update("UPDATE smart_data_task " +
- "SET tk_deleted = 1 " +
- "WHERE " +
- " tk_id = #{id} "
- )
- int logicDeleteMarkTaskById(int id);
- @Delete("DELETE FROM smart_data_task "+
- "WHERE "+
- " tk_id = #{id} "
- )
- int physicsDeleteMarkTaskById(int id);
- @Update("UPDATE smart_data_task " +
- "SET tk_deleted = 0 " +
- "WHERE " +
- " tk_id = #{id} "
- )
- int restoreLogicDeleteMarkTaskById(int id);
- @Update("UPDATE smart_data_task " +
- "SET tk_swapped_primary_keys = #{tkSwappedPrimaryKeys} " +
- "WHERE " +
- " tk_id = #{tkId} "
- )
- int saveSwappedPrimaryKeys(SmartDataTask smartDataTask);
- @Insert({
- "<script>",
- "INSERT INTO smart_data_task_err ",
- " <trim prefix='(' suffix=')' suffixOverrides=','> ",
- " <if test='eTaskId != null'>e_task_id,</if> ",
- " <if test='eDateTime != null'>e_date_time,</if> ",
- " <if test='eMsg != null'>e_msg,</if> ",
- " </trim> ",
- "VALUES ",
- " <trim prefix='(' suffix=')' suffixOverrides=','>",
- " <if test='eTaskId != null'>#{eTaskId},</if> ",
- " <if test='eDateTime != null'>#{eDateTime},</if> ",
- " <if test='eMsg != null'>#{eMsg},</if> ",
- " </trim>",
- "</script>"
- })
- int insertErrorMsg(SmartDataTaskErr smartDataTaskErr);
- @Select({
- "<script>",
- " SELECT " +
- " * " +
- " FROM smart_data_task_err ",
- " <where>",
- " <if test='eTaskId != null'>AND e_task_id = #{eTaskId}</if> ",
- " <if test='eMsg != null'>AND e_msg = #{eMsg}</if> ",
- " </where>",
- "</script>"
- })
- SmartDataTaskErr selectErrorMsg(SmartDataTaskErr smartDataTaskErr);
- @Update("UPDATE smart_data_task_err " +
- "SET e_task_id = #{eTaskId} " +
- " ,e_msg = #{eMsg} " +
- " ,e_num = e_num + 1 " +
- " ,e_date_time = #{eDateTime} " +
- "WHERE " +
- " e_id = #{eId} "
- )
- int updateErrorMsg(SmartDataTaskErr smartDataTaskErr);
- @Select({
- "<script>",
- " SELECT " +
- " tk_col_relationship " +
- " FROM smart_data_task ",
- " <where>",
- " <if test='tkId != null'>AND tk_id = #{tkId}</if> ",
- " </where>",
- "</script>"
- })
- String getColRelationship(SmartDataTask smartDataTask);
- }
|