package com.template.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.template.model.pojo.SmartDataTask;
import com.template.model.pojo.SmartDataTaskDebug;
import com.template.model.pojo.SmartDataTaskLog;
import com.template.model.pojo.SmartDataTaskSetDebugSql;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
*
* 数据源任务 Mapper 接口
*
*
* @author ceshi
* @since 2023-12-05
*/
@Repository
public interface SmartDataTaskMapper extends BaseMapper {
@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({
""
})
@Options(useGeneratedKeys = true, keyProperty = "tkId")
int insertOne(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_activation " +
"FROM " +
" smart_data_task " +
"WHERE " +
" tk_id = #{tkId} "
)
int selectColSwappedPrimaryKeys(int tkId);
@Select({
""
})
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({
""
})
int insertErrorMsg(SmartDataTaskDebug smartDataTaskDebug);
@Select({
""
})
SmartDataTaskDebug selectErrorMsg(SmartDataTaskDebug smartDataTaskDebug);
@Update("UPDATE smart_data_task_debug " +
"SET " +
" e_task_id = #{eTaskId} " +
" ,e_task_name = #{eTaskName} " +
" ,e_msg = #{eMsg} " +
" ,e_num = e_num + 1 " +
" ,e_date_time = #{eDateTime} " +
"WHERE " +
" e_id = #{eId} "
)
int updateErrorMsg(SmartDataTaskDebug smartDataTaskErr);
@Select({
""
})
String getColRelationship(SmartDataTask smartDataTask);
@Select({
""
})
List selectTaskDebugPageOrderByDatetimeDesc(Integer eTaskId, String startTime, String endTime);
@Delete({
""
})
int deleteSmartDataTaskDebugByIds(List ids);
@Insert({
""
})
@Options(useGeneratedKeys = true, keyProperty = "tkLogId")
int insertTaskLog(SmartDataTaskLog smartDataTaskLog);
@Update({
""
})
int updateTaskLog(SmartDataTaskLog smartDataTaskLog);
@Select({
""
})
List selectTaskLogPageOrderByDatetimeDesc(Integer eTaskId, String tkLogTaskName, Integer tkLogAutoManual,
Integer tkLogDsSourceId, Integer tkLogDsDestinationId,
Integer tkLogCostTime, Integer tkLogExeStatus,
String startTime, String endTime);
@Select({
""
})
List queryTaskExecuting(Integer tkLogTaskId, Integer tkLogExeStatus);
@Select({
""
})
List queryTaskDebugSql();
@Update("UPDATE smart_data_task " +
"SET tk_debug_sql = #{tkDebugSql} " +
"WHERE " +
" tk_id = #{tkId} "
)
int queryTaskSetDebugSql(int tkId, int tkDebugSql);
@Select({
""
})
List queryAllTask();
}