OrderMapper.xml 4.89 KB
<?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.web.controller.business.mapper.OrderMapper">
    
    <resultMap type="Order" id="OrderResult">
        <result property="id"    column="id"    />
        <result property="enterpriseName"    column="enterprise_name"    />
        <result property="userId"    column="user_id"    />
        <result property="enterpriseCode"    column="enterprise_code"    />
        <result property="reportProgress"    column="report_progress"    />
        <result property="docUrl"    column="doc_url"    />
        <result property="pdfUrl"    column="pdf_url"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="finishTime"    column="finish_time"    />
    </resultMap>

    <sql id="selectOrderVo">
        select id, enterprise_name, user_id, enterprise_code, report_progress, doc_url, pdf_url, create_time, update_time, finish_time from credit_order
    </sql>

    <select id="selectOrderList" parameterType="Order" resultMap="OrderResult">
        <include refid="selectOrderVo"/>
        <where>  
            <if test="enterpriseName != null  and enterpriseName != ''"> and enterprise_name like concat('%', #{enterpriseName}, '%')</if>
            <if test="userId != null "> and user_id = #{userId}</if>
            <if test="enterpriseCode != null  and enterpriseCode != ''"> and enterprise_code = #{enterpriseCode}</if>
            <if test="reportProgress != null  and reportProgress != ''"> and report_progress = #{reportProgress}</if>
            <if test="docUrl != null  and docUrl != ''"> and doc_url = #{docUrl}</if>
            <if test="pdfUrl != null  and pdfUrl != ''"> and pdf_url = #{pdfUrl}</if>
            <if test="beginTime != null">and create_time&gt;= to_date(#{beginTime},'yyyy-MM-dd')</if>
            <if test="endTime != null">and create_time&lt;=to_date(#{endTime},'yyyy-MM-dd')</if>
            <if test="finishTime != null  and finishTime != ''"> and finish_time = #{finishTime}</if>
        </where>
    </select>
    
    <select id="selectOrderById" parameterType="Long" resultMap="OrderResult">
    </select>

    <insert id="insertOrder" parameterType="Order">
        insert into credit_order
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="enterpriseName != null">enterprise_name,</if>
            <if test="userId != null">user_id,</if>
            <if test="enterpriseCode != null">enterprise_code,</if>
            <if test="reportProgress != null">report_progress,</if>
            <if test="docUrl != null">doc_url,</if>
            <if test="pdfUrl != null">pdf_url,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="finishTime != null">finish_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="enterpriseName != null">#{enterpriseName},</if>
            <if test="userId != null">#{userId},</if>
            <if test="enterpriseCode != null">#{enterpriseCode},</if>
            <if test="reportProgress != null">#{reportProgress},</if>
            <if test="docUrl != null">#{docUrl},</if>
            <if test="pdfUrl != null">#{pdfUrl},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="finishTime != null">#{finishTime},</if>
         </trim>
    </insert>

    <update id="updateOrder" parameterType="Order">
        update credit_order
        <trim prefix="SET" suffixOverrides=",">
            <if test="enterpriseName != null">enterprise_name = #{enterpriseName},</if>
            <if test="userId != null">user_id = #{userId},</if>
            <if test="enterpriseCode != null">enterprise_code = #{enterpriseCode},</if>
            <if test="reportProgress != null">report_progress = #{reportProgress},</if>
            <if test="docUrl != null">doc_url = #{docUrl},</if>
            <if test="pdfUrl != null">pdf_url = #{pdfUrl},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="finishTime != null">finish_time = #{finishTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteOrderById" parameterType="Long">
        delete from credit_order where id = #{id}
    </delete>

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