<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!--  Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved. -->
<!--  Mybatis数据库持久层（底层映射文件）： -->
<!--  version: 1.0  -->
<!--  author:  maven-cctp-plugin    -->
<!--  date:  2022-03-22 17:00:55  -->
<mapper namespace="net.northking.cctp.dw.db.dao.DwManualExecJobDao">
    <resultMap id="BaseResultMap" type="net.northking.cctp.dw.db.entity.DwManualExecJob">
        <!--  -->
        <id column="id" jdbcType="VARCHAR" property="id"/>
        <!--  -->
        <result column="dir_id" jdbcType="VARCHAR" property="dirId"/>
        <!-- 系统ID -->
        <result column="project_id" jdbcType="VARCHAR" property="projectId"/>
        <!--  -->
        <result column="case_id" jdbcType="VARCHAR" property="caseId"/>
        <!--  -->
        <result column="exec_status" jdbcType="INTEGER" property="execStatus"/>
        <!--  -->
        <result column="resp_owner" jdbcType="VARCHAR" property="respOwner"/>
        <!--  -->
        <result column="resp_owner_type" jdbcType="CHAR" property="respOwnerType"/>
        <!-- 创建人 -->
        <result column="created_by" jdbcType="VARCHAR" property="createdBy"/>
        <!-- 创建时间 -->
        <result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
        <!-- 更新人 -->
        <result column="updated_by" jdbcType="VARCHAR" property="updatedBy"/>
        <!-- 更新时间 -->
        <result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime"/>
        <!-- 租户id -->
        <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
        <!-- 逻辑删除(0-未删除,1-已删除) -->
        <result column="is_deleted" jdbcType="BIT" property="deleted"/>
    </resultMap>

    <sql id="Base_Column_List">
        id
        ,dir_id
        ,project_id
        ,case_id
        ,exec_status
        ,resp_owner
        ,resp_owner_type
        ,created_by
        ,created_time
        ,updated_by
        ,updated_time
        ,tenant_id
        ,is_deleted
    </sql>

    <sql id="Table_Name">
        dw_manual_exec_job
    </sql>

    <select id="findByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from
        <include refid="Table_Name"/>
        where id = #{id,jdbcType=VARCHAR}
    </select>

    <select id="findByPrimaryKeys" parameterType="java.util.List">
        select
        <include refid="Base_Column_List"/>
        from
        <include refid="Table_Name"/>
        where id in
        <foreach collection="list" item="idItem" open="(" separator="," close=")">
            #{idItem, jdbcType=VARCHAR}
        </foreach>
    </select>

    <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
        delete from
        <include refid="Table_Name"/>
        where id = #{id,jdbcType=VARCHAR}
    </delete>

    <delete id="deleteByPrimaryKeys" parameterType="java.lang.String">
        delete from
        <include refid="Table_Name"/>
        where id in
        <foreach collection="list" item="idItem" open="(" separator="," close=")">
            #{idItem, jdbcType=VARCHAR}
        </foreach>
    </delete>

    <delete id="deleteByExample" parameterType="net.northking.cctp.dw.db.entity.DwManualExecJob">
        delete from
        <include refid="Table_Name"/>
        <trim prefix="WHERE" prefixOverrides="AND">
            <if test="id != null">
                AND id=#{id,jdbcType=VARCHAR}
            </if>
            <if test="dirId != null">
                AND dir_id=#{dirId,jdbcType=VARCHAR}
            </if>
            <if test="projectId != null">
                AND project_id=#{projectId,jdbcType=VARCHAR}
            </if>
            <if test="caseId != null">
                AND case_id=#{caseId,jdbcType=VARCHAR}
            </if>
            <if test="execStatus != null">
                AND exec_status=#{execStatus,jdbcType=INTEGER}
            </if>
            <if test="respOwner != null">
                AND resp_owner=#{respOwner,jdbcType=VARCHAR}
            </if>
            <if test="respOwnerType != null">
                AND resp_owner_type=#{respOwnerType,jdbcType=CHAR}
            </if>
            <if test="createdBy != null">
                AND created_by=#{createdBy,jdbcType=VARCHAR}
            </if>
            <if test="createdTime != null">
                AND created_time=#{createdTime,jdbcType=TIMESTAMP}
            </if>
            <if test="updatedBy != null">
                AND updated_by=#{updatedBy,jdbcType=VARCHAR}
            </if>
            <if test="updatedTime != null">
                AND updated_time=#{updatedTime,jdbcType=TIMESTAMP}
            </if>
            <if test="tenantId != null">
                AND tenant_id=#{tenantId,jdbcType=VARCHAR}
            </if>
            <if test="deleted != null">
                AND is_deleted=#{deleted,jdbcType=BIT}
            </if>
        </trim>
    </delete>

    <insert id="insert" parameterType="net.northking.cctp.dw.db.entity.DwManualExecJob">
        insert into
        <include refid="Table_Name"/>
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="dirId != null">
                dir_id,
            </if>
            <if test="projectId != null">
                project_id,
            </if>
            <if test="caseId != null">
                case_id,
            </if>
            <if test="execStatus != null">
                exec_status,
            </if>
            <if test="respOwner != null">
                resp_owner,
            </if>
            <if test="respOwnerType != null">
                resp_owner_type,
            </if>
            <if test="createdBy != null">
                created_by,
            </if>
            <if test="createdTime != null">
                created_time,
            </if>
            <if test="updatedBy != null">
                updated_by,
            </if>
            <if test="updatedTime != null">
                updated_time,
            </if>
            <if test="tenantId != null">
                tenant_id,
            </if>
            <if test="deleted != null">
                is_deleted,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id, jdbcType=VARCHAR},
            </if>
            <if test="dirId != null">
                #{dirId, jdbcType=VARCHAR},
            </if>
            <if test="projectId != null">
                #{projectId, jdbcType=VARCHAR},
            </if>
            <if test="caseId != null">
                #{caseId, jdbcType=VARCHAR},
            </if>
            <if test="execStatus != null">
                #{execStatus, jdbcType=INTEGER},
            </if>
            <if test="respOwner != null">
                #{respOwner, jdbcType=VARCHAR},
            </if>
            <if test="respOwnerType != null">
                #{respOwnerType, jdbcType=CHAR},
            </if>
            <if test="createdBy != null">
                #{createdBy, jdbcType=VARCHAR},
            </if>
            <if test="createdTime != null">
                #{createdTime, jdbcType=TIMESTAMP},
            </if>
            <if test="updatedBy != null">
                #{updatedBy, jdbcType=VARCHAR},
            </if>
            <if test="updatedTime != null">
                #{updatedTime, jdbcType=TIMESTAMP},
            </if>
            <if test="tenantId != null">
                #{tenantId, jdbcType=VARCHAR},
            </if>
            <if test="deleted != null">
                #{deleted, jdbcType=BIT},
            </if>
        </trim>
    </insert>

    <insert id="insertByBatch" parameterType="java.util.List">
        insert into
        <include refid="Table_Name"/>
        <trim prefix="(" suffix=")" suffixOverrides=",">
            id,
            dir_id,
            project_id,
            case_id,
            exec_status,
            resp_owner,
            resp_owner_type,
            created_by,
            created_time,
            updated_by,
            updated_time,
            tenant_id,
            is_deleted,
        </trim>
        values
        <foreach collection="list" item="item" index="index" separator=",">
            <trim prefix="(" suffix=")" suffixOverrides=",">
                #{item.id, jdbcType=VARCHAR},
                #{item.dirId, jdbcType=VARCHAR},
                #{item.projectId, jdbcType=VARCHAR},
                #{item.caseId, jdbcType=VARCHAR},
                #{item.execStatus, jdbcType=INTEGER},
                #{item.respOwner, jdbcType=VARCHAR},
                #{item.respOwnerType, jdbcType=CHAR},
                #{item.createdBy, jdbcType=VARCHAR},
                #{item.createdTime, jdbcType=TIMESTAMP},
                #{item.updatedBy, jdbcType=VARCHAR},
                #{item.updatedTime, jdbcType=TIMESTAMP},
                #{item.tenantId, jdbcType=VARCHAR},
                #{item.deleted, jdbcType=BIT},
            </trim>
        </foreach>
    </insert>

    <update id="updateByPrimaryKey" parameterType="net.northking.cctp.dw.db.entity.DwManualExecJob">
        update
        <include refid="Table_Name"/>
        <set>
            <if test="dirId != null">
                dir_id = #{dirId, jdbcType=VARCHAR},
            </if>
            <if test="projectId != null">
                project_id = #{projectId, jdbcType=VARCHAR},
            </if>
            <if test="caseId != null">
                case_id = #{caseId, jdbcType=VARCHAR},
            </if>
            <if test="execStatus != null">
                exec_status = #{execStatus, jdbcType=INTEGER},
            </if>
            <if test="respOwner != null">
                resp_owner = #{respOwner, jdbcType=VARCHAR},
            </if>
            <if test="respOwnerType != null">
                resp_owner_type = #{respOwnerType, jdbcType=CHAR},
            </if>
            <if test="createdBy != null">
                created_by = #{createdBy, jdbcType=VARCHAR},
            </if>
            <if test="createdTime != null">
                created_time = #{createdTime, jdbcType=TIMESTAMP},
            </if>
            <if test="updatedBy != null">
                updated_by = #{updatedBy, jdbcType=VARCHAR},
            </if>
            <if test="updatedTime != null">
                updated_time = #{updatedTime, jdbcType=TIMESTAMP},
            </if>
            <if test="deleted != null">
                is_deleted = #{deleted, jdbcType=BIT},
            </if>
        </set>
        where id = #{id,jdbcType=VARCHAR}
        AND tenant_id = #{tenantId,jdbcType=VARCHAR}
    </update>

    <select id="query" resultMap="BaseResultMap" parameterType="net.northking.cctp.dw.db.entity.DwManualExecJob">
        select
        <include refid="Base_Column_List"/>
        from
        <include refid="Table_Name"/>
        <trim prefix="WHERE" prefixOverrides="AND">
            <if test="id != null">
                AND id = #{id,jdbcType=VARCHAR}
            </if>
            <if test="dirId != null">
                AND dir_id = #{dirId,jdbcType=VARCHAR}
            </if>
            <if test="projectId != null">
                AND project_id = #{projectId,jdbcType=VARCHAR}
            </if>
            <if test="caseId != null">
                AND case_id = #{caseId,jdbcType=VARCHAR}
            </if>
            <if test="execStatus != null">
                AND exec_status = #{execStatus,jdbcType=INTEGER}
            </if>
            <if test="respOwner != null">
                AND resp_owner = #{respOwner,jdbcType=VARCHAR}
            </if>
            <if test="respOwnerType != null">
                AND resp_owner_type = #{respOwnerType,jdbcType=CHAR}
            </if>
            <if test="createdBy != null">
                AND created_by = #{createdBy,jdbcType=VARCHAR}
            </if>
            <if test="createdTime != null">
                AND created_time = #{createdTime,jdbcType=TIMESTAMP}
            </if>
            <if test="updatedBy != null">
                AND updated_by = #{updatedBy,jdbcType=VARCHAR}
            </if>
            <if test="updatedTime != null">
                AND updated_time = #{updatedTime,jdbcType=TIMESTAMP}
            </if>
            <if test="tenantId != null">
                AND tenant_id = #{tenantId,jdbcType=VARCHAR}
            </if>
            <if test="deleted != null">
                AND is_deleted = #{deleted,jdbcType=BIT}
            </if>
        </trim>
    </select>

    <select id="queryCount" resultType="java.lang.Long" parameterType="net.northking.cctp.dw.db.entity.DwManualExecJob">
        select count(*) from
        <include refid="Table_Name"/>
        <trim prefix="WHERE" prefixOverrides="AND">
            <if test="id != null">
                AND id=#{id,jdbcType=VARCHAR}
            </if>
            <if test="dirId != null">
                AND dir_id=#{dirId,jdbcType=VARCHAR}
            </if>
            <if test="projectId != null">
                AND project_id=#{projectId,jdbcType=VARCHAR}
            </if>
            <if test="caseId != null">
                AND case_id=#{caseId,jdbcType=VARCHAR}
            </if>
            <if test="execStatus != null">
                AND exec_status=#{execStatus,jdbcType=INTEGER}
            </if>
            <if test="respOwner != null">
                AND resp_owner=#{respOwner,jdbcType=VARCHAR}
            </if>
            <if test="respOwnerType != null">
                AND resp_owner_type=#{respOwnerType,jdbcType=CHAR}
            </if>
            <if test="createdBy != null">
                AND created_by=#{createdBy,jdbcType=VARCHAR}
            </if>
            <if test="createdTime != null">
                AND created_time=#{createdTime,jdbcType=TIMESTAMP}
            </if>
            <if test="updatedBy != null">
                AND updated_by=#{updatedBy,jdbcType=VARCHAR}
            </if>
            <if test="updatedTime != null">
                AND updated_time=#{updatedTime,jdbcType=TIMESTAMP}
            </if>
            <if test="tenantId != null">
                AND tenant_id=#{tenantId,jdbcType=VARCHAR}
            </if>
            <if test="deleted != null">
                AND is_deleted=#{deleted,jdbcType=BIT}
            </if>
        </trim>
    </select>

</mapper>