<?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">
<mapper namespace="com.ruoyi.bid.mapper.BidMyZizhiMapper">
    
    <resultMap type="BidMyZizhi" id="BidMyZizhiResult">
        <result property="id"    column="id"    />
        <result property="documentId"    column="document_id"    />
        <result property="documentCode"    column="document_code"    />
        <result property="documentName"    column="document_name"    />
        <result property="documentRate"    column="document_rate"    />
        <result property="startTime"    column="start_time"    />
        <result property="endTime"    column="end_time"    />
        <result property="level"    column="level"    />
        <result property="longLalid"    column="long_lalid"    />
        <result property="relatePhoto"    column="relate_photo"    />
        <result property="status"    column="status"    />
        <result property="tempId"    column="temp_id"    />
        <result property="tenantCode"    column="tenant_code"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectBidMyZizhiVo">
        select id, document_id, document_code, document_name, document_rate, start_time, end_time, level, long_lalid, relate_photo, status, temp_id, tenant_code, create_by, create_time, update_by, update_time, remark from bid_my_zizhi
    </sql>

    <select id="selectBidMyZizhiList" parameterType="BidMyZizhi" resultMap="BidMyZizhiResult">
        <include refid="selectBidMyZizhiVo"/>
        <where>  
            <if test="documentId != null  and documentId != ''"> and document_id = #{documentId}</if>
            <if test="documentCode != null  and documentCode != ''"> and document_code = #{documentCode}</if>
            <if test="documentName != null  and documentName != ''"> and document_name like concat('%', #{documentName}, '%')</if>
            <if test="documentRate != null  and documentRate != ''"> and document_rate = #{documentRate}</if>
            <if test="startTime != null "> and start_time = #{startTime}</if>
            <if test="endTime != null "> and end_time = #{endTime}</if>
            <if test="level != null  and level != ''"> and level = #{level}</if>
            <if test="longLalid != null  and longLalid != ''"> and long_lalid = #{longLalid}</if>
            <if test="relatePhoto != null  and relatePhoto != ''"> and relate_photo = #{relatePhoto}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
            <if test="tempId != null  and tempId != ''"> and temp_id = #{tempId}</if>
            <if test="tenantCode != null  and tenantCode != ''"> and tenant_code = #{tenantCode}</if>
        </where>
    </select>
    
    <select id="selectBidMyZizhiById" parameterType="Long" resultMap="BidMyZizhiResult">
        <include refid="selectBidMyZizhiVo"/>
        where id = #{id}
    </select>

    <insert id="insertBidMyZizhi" parameterType="BidMyZizhi" useGeneratedKeys="true" keyProperty="id">
        insert into bid_my_zizhi
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="documentId != null">document_id,</if>
            <if test="documentCode != null">document_code,</if>
            <if test="documentName != null">document_name,</if>
            <if test="documentRate != null">document_rate,</if>
            <if test="startTime != null">start_time,</if>
            <if test="endTime != null">end_time,</if>
            <if test="level != null">level,</if>
            <if test="longLalid != null">long_lalid,</if>
            <if test="relatePhoto != null">relate_photo,</if>
            <if test="status != null">status,</if>
            <if test="tempId != null">temp_id,</if>
            <if test="tenantCode != null">tenant_code,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="documentId != null">#{documentId},</if>
            <if test="documentCode != null">#{documentCode},</if>
            <if test="documentName != null">#{documentName},</if>
            <if test="documentRate != null">#{documentRate},</if>
            <if test="startTime != null">#{startTime},</if>
            <if test="endTime != null">#{endTime},</if>
            <if test="level != null">#{level},</if>
            <if test="longLalid != null">#{longLalid},</if>
            <if test="relatePhoto != null">#{relatePhoto},</if>
            <if test="status != null">#{status},</if>
            <if test="tempId != null">#{tempId},</if>
            <if test="tenantCode != null">#{tenantCode},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateBidMyZizhi" parameterType="BidMyZizhi">
        update bid_my_zizhi
        <trim prefix="SET" suffixOverrides=",">
            <if test="documentId != null">document_id = #{documentId},</if>
            <if test="documentCode != null">document_code = #{documentCode},</if>
            <if test="documentName != null">document_name = #{documentName},</if>
            <if test="documentRate != null">document_rate = #{documentRate},</if>
            <if test="startTime != null">start_time = #{startTime},</if>
            <if test="endTime != null">end_time = #{endTime},</if>
            <if test="level != null">level = #{level},</if>
            <if test="longLalid != null">long_lalid = #{longLalid},</if>
            <if test="relatePhoto != null">relate_photo = #{relatePhoto},</if>
            <if test="status != null">status = #{status},</if>
            <if test="tempId != null">temp_id = #{tempId},</if>
            <if test="tenantCode != null">tenant_code = #{tenantCode},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteBidMyZizhiById" parameterType="Long">
        delete from bid_my_zizhi where id = #{id}
    </delete>

    <delete id="deleteBidMyZizhiByIds" parameterType="String">
        delete from bid_my_zizhi where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>