SysDeliveryFileMapper.xml 9.65 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.glsx.ordercenter.mapper.SysDeliveryFileMapper">
    <resultMap id="BaseResultMap" type="com.glsx.ordercenter.pojo.SysDeliveryFile">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="delivery_id" jdbcType="INTEGER" property="deliveryId"/>
        <result column="file_path" jdbcType="VARCHAR" property="filePath"/>
        <result column="remark" jdbcType="VARCHAR" property="remark"/>
    </resultMap>

    <sql id="Example_Where_Clause">
        <where>
            <foreach collection="oredCriteria" item="criteria" separator="or">
                <if test="criteria.valid">
                    <trim prefix="(" prefixOverrides="and" suffix=")">
                        <foreach collection="criteria.criteria" item="criterion">
                            <choose>
                                <when test="criterion.noValue">
                                    and ${criterion.condition}
                                </when>
                                <when test="criterion.singleValue">
                                    and ${criterion.condition} #{criterion.value}
                                </when>
                                <when test="criterion.betweenValue">
                                    and ${criterion.condition} #{criterion.value} and
                                    #{criterion.secondValue}
                                </when>
                                <when test="criterion.listValue">
                                    and ${criterion.condition}
                                    <foreach close=")" collection="criterion.value" item="listItem"
                                            open="(" separator=",">
                                        #{listItem}
                                    </foreach>
                                </when>
                            </choose>
                        </foreach>
                    </trim>
                </if>
            </foreach>
        </where>
    </sql>

    <sql id="Update_By_Example_Where_Clause">
        <where>
            <foreach collection="example.oredCriteria" item="criteria" separator="or">
                <if test="criteria.valid">
                    <trim prefix="(" prefixOverrides="and" suffix=")">
                        <foreach collection="criteria.criteria" item="criterion">
                            <choose>
                                <when test="criterion.noValue">
                                    and ${criterion.condition}
                                </when>
                                <when test="criterion.singleValue">
                                    and ${criterion.condition} #{criterion.value}
                                </when>
                                <when test="criterion.betweenValue">
                                    and ${criterion.condition} #{criterion.value} and
                                    #{criterion.secondValue}
                                </when>
                                <when test="criterion.listValue">
                                    and ${criterion.condition}
                                    <foreach close=")" collection="criterion.value" item="listItem"
                                            open="(" separator=",">
                                        #{listItem}
                                    </foreach>
                                </when>
                            </choose>
                        </foreach>
                    </trim>
                </if>
            </foreach>
        </where>
    </sql>

    <sql id="Base_Column_List">
        id, delivery_id, file_path, remark
    </sql>

    <select id="selectByDeliveryId" parameterType="integer" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from sys_delivery_file
        where delivery_id = #{deliveryId,jdbcType=INTEGER}
    </select>



    <select id="selectByExample" parameterType="com.glsx.ordercenter.pojo.SysDeliveryFileExample"
            resultMap="BaseResultMap">
        select
        <if test="distinct">
            distinct
        </if>
        <include refid="Base_Column_List"/>
        from sys_delivery_file
        <if test="_parameter != null">
            <include refid="Example_Where_Clause"/>
        </if>
        <if test="orderByClause != null">
            order by ${orderByClause}
        </if>
    </select>

    <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from sys_delivery_file
        where id = #{id,jdbcType=INTEGER}
    </select>

    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
        delete
        from sys_delivery_file
        where id = #{id,jdbcType=INTEGER}
    </delete>

    <delete id="deleteByExample" parameterType="com.glsx.ordercenter.pojo.SysDeliveryFileExample">
        delete
        from sys_delivery_file
        <if test="_parameter != null">
            <include refid="Example_Where_Clause"/>
        </if>
    </delete>

    <insert id="insert" parameterType="com.glsx.ordercenter.pojo.SysDeliveryFile">
        <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
            SELECT LAST_INSERT_ID()
        </selectKey>
        insert into sys_delivery_file (delivery_id, file_path, remark)
        values (#{deliveryId,jdbcType=INTEGER}, #{filePath,jdbcType=VARCHAR},
                #{remark,jdbcType=VARCHAR})
    </insert>

    <insert id="insertSelective" parameterType="com.glsx.ordercenter.pojo.SysDeliveryFile">
        <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
            SELECT LAST_INSERT_ID()
        </selectKey>
        insert into sys_delivery_file
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="deliveryId != null">
                delivery_id,
            </if>
            <if test="filePath != null">
                file_path,
            </if>
            <if test="remark != null">
                remark,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="deliveryId != null">
                #{deliveryId,jdbcType=INTEGER},
            </if>
            <if test="filePath != null">
                #{filePath,jdbcType=VARCHAR},
            </if>
            <if test="remark != null">
                #{remark,jdbcType=VARCHAR},
            </if>
        </trim>
    </insert>

    <insert id="insertBatch" parameterType="com.glsx.ordercenter.pojo.SysDeliveryFile">
        insert into sys_delivery_file (delivery_id, file_path, remark)
        values
        <foreach collection="deliveryFileList" item="file" separator=",">
            (#{file.deliveryId,jdbcType=INTEGER}, #{file.filePath,jdbcType=VARCHAR},
                #{file.remark,jdbcType=VARCHAR})
        </foreach>
    </insert>

    <select id="countByExample" parameterType="com.glsx.ordercenter.pojo.SysDeliveryFileExample"
            resultType="java.lang.Long">
        select count(*)
        from sys_delivery_file
        <if test="_parameter != null">
            <include refid="Example_Where_Clause"/>
        </if>
    </select>

    <update id="updateByExampleSelective" parameterType="map">
        update sys_delivery_file
        <set>
            <if test="record.id != null">
                id = #{record.id,jdbcType=INTEGER},
            </if>
            <if test="record.deliveryId != null">
                delivery_id = #{record.deliveryId,jdbcType=INTEGER},
            </if>
            <if test="record.filePath != null">
                file_path = #{record.filePath,jdbcType=VARCHAR},
            </if>
            <if test="record.remark != null">
                remark = #{record.remark,jdbcType=VARCHAR},
            </if>
        </set>
        <if test="_parameter != null">
            <include refid="Update_By_Example_Where_Clause"/>
        </if>
    </update>

    <update id="updateByExample" parameterType="map">
        update sys_delivery_file
        set id = #{record.id,jdbcType=INTEGER},
            delivery_id = #{record.deliveryId,jdbcType=INTEGER},
            file_path = #{record.filePath,jdbcType=VARCHAR},
            remark = #{record.remark,jdbcType=VARCHAR}
        <if test="_parameter != null">
            <include refid="Update_By_Example_Where_Clause"/>
        </if>
    </update>

    <update id="updateByPrimaryKeySelective"
            parameterType="com.glsx.ordercenter.pojo.SysDeliveryFile">
        update sys_delivery_file
        <set>
            <if test="deliveryId != null">
                delivery_id = #{deliveryId,jdbcType=INTEGER},
            </if>
            <if test="filePath != null">
                file_path = #{filePath,jdbcType=VARCHAR},
            </if>
            <if test="remark != null">
                remark = #{remark,jdbcType=VARCHAR},
            </if>
        </set>
        where id = #{id,jdbcType=INTEGER}
    </update>

    <update id="updateByPrimaryKey" parameterType="com.glsx.ordercenter.pojo.SysDeliveryFile">
        update sys_delivery_file
        set delivery_id = #{deliveryId,jdbcType=INTEGER},
            file_path = #{filePath,jdbcType=VARCHAR},
            remark = #{remark,jdbcType=VARCHAR}
        where id = #{id,jdbcType=INTEGER}
    </update>
</mapper>