ErrorCommandMapper.java 2.3 KB
Newer Older
B
baoliang 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package cn.escheduler.dao.mapper;

import cn.escheduler.common.enums.*;
import cn.escheduler.dao.model.Command;
import cn.escheduler.dao.model.ErrorCommand;
Q
qiaozhanwei 已提交
22
import cn.escheduler.dao.model.ExecuteStatusCount;
B
baoliang 已提交
23 24 25 26 27
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.EnumOrdinalTypeHandler;
import org.apache.ibatis.type.JdbcType;

import java.sql.Timestamp;
Q
qiaozhanwei 已提交
28
import java.util.Date;
B
baoliang 已提交
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
import java.util.List;

/**
 * command mapper
 */
public interface ErrorCommandMapper {

    /**
     * inert error command
     * @param errorCommand
     * @return
     */
    @InsertProvider(type = ErrorCommandMapperProvider.class, method = "insert")
    @Options(useGeneratedKeys = true,keyProperty = "errorCommand.id")
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "errorCommand.id", before = false, resultType = int.class)
    int insert(@Param("errorCommand") ErrorCommand errorCommand);

Q
qiaozhanwei 已提交
46 47 48 49 50 51 52 53 54 55 56 57
    @Results(value = {
            @Result(property = "state", column = "state", typeHandler = EnumOrdinalTypeHandler.class, javaType = ExecutionStatus.class, jdbcType = JdbcType.TINYINT),
            @Result(property = "count", column = "count", javaType = Integer.class, jdbcType = JdbcType.INTEGER),
    })
    @SelectProvider(type = ErrorCommandMapperProvider.class, method = "countCommandState")
    List<ExecuteStatusCount> countCommandState(
            @Param("userId") int userId,
            @Param("userType") UserType userType,
            @Param("startTime") Date startTime,
            @Param("endTime") Date endTime,
            @Param("projectId") int projectId);

B
baoliang 已提交
58 59

}