SysSubOrderMapper.xml 16.3 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.SysSubOrderMapper">
    <resultMap id="BaseResultMap" type="com.glsx.ordercenter.pojo.SysSubOrder">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="order_id" jdbcType="INTEGER" property="orderId"/>
        <result column="vehicle_no" jdbcType="VARCHAR" property="vehicleNo"/>
        <result column="vin_no" jdbcType="VARCHAR" property="vinNo"/>
        <result column="car_owner" jdbcType="VARCHAR" property="carOwner"/>
        <result column="car_owner_phone" jdbcType="VARCHAR" property="carOwnerPhone"/>
        <result column="status" jdbcType="TINYINT" property="status"/>
        <result column="remark" jdbcType="VARCHAR" property="remark"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
        <result column="create_by" jdbcType="INTEGER" property="createBy"/>
        <result column="update_by" jdbcType="INTEGER" property="updateBy"/>
    </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, order_id, vehicle_no, vin_no, car_owner, car_owner_phone, `status`, remark,
        create_time, update_time, create_by, update_by
    </sql>

    <select id="selectList" parameterType="com.glsx.ordercenter.dto.req.SubOrderQueryReq"
        resultMap="BaseResultMap">
        select <include refid="Base_Column_List"/>
        from sys_sub_order
        <where>
            <if test="orderId != null">
                and order_id = #{orderId,jdbcType=INTEGER}
            </if>
            <if test="status != null">
                and status = #{status,jdbcType=TINYINT}
            </if>
        </where>
        order by create_time desc
    </select>

    <select id="selectOne" parameterType="com.glsx.ordercenter.dto.req.SubOrderQueryReq"
        resultMap="BaseResultMap">
        select <include refid="Base_Column_List"/>
        from sys_sub_order
        <where>
            id = #{id,jdbcType=INTEGER}
            <if test="orderId != null">
                and order_id = #{orderId,jdbcType=INTEGER}
            </if>
            <if test="status != null">
                and status = #{status,jdbcType=TINYINT}
            </if>
        </where>
    </select>

    <select id="selectByOrderId" parameterType="integer" resultMap="BaseResultMap">
        select <include refid="Base_Column_List"/>
        from sys_sub_order
        where order_id = #{orderId,jdbcType=INTEGER}
        order by create_time desc
    </select>



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

    <select id="getCountByParams" parameterType="com.glsx.ordercenter.pojo.SysSubOrderExample" resultType="java.lang.Integer">
        select count(id) from sys_sub_order
        <if test="_parameter != null">
            <include refid="Example_Where_Clause"/>
        </if>
    </select>

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

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

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

    <insert id="insert" keyColumn="id" keyProperty="id"
            parameterType="com.glsx.ordercenter.pojo.SysSubOrder" useGeneratedKeys="true">
        <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
            SELECT LAST_INSERT_ID()
        </selectKey>
        insert into sys_sub_order (order_id, vehicle_no, vin_no, car_owner, car_owner_phone,
                                   `status`, remark, create_time, update_time, create_by,
                                   update_by)
        values (#{orderId,jdbcType=INTEGER}, #{vehicleNo,jdbcType=VARCHAR},
                #{vinNo,jdbcType=VARCHAR}, #{carOwner,jdbcType=VARCHAR},
                #{carOwnerPhone,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT},
                #{remark,jdbcType=VARCHAR},
                #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
                #{createBy,jdbcType=INTEGER},
                #{updateBy,jdbcType=INTEGER})
    </insert>

    <insert id="insertSelective" keyColumn="id" keyProperty="id"
            parameterType="com.glsx.ordercenter.pojo.SysSubOrder" useGeneratedKeys="true">
        <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
            SELECT LAST_INSERT_ID()
        </selectKey>
        insert into sys_sub_order
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="orderId != null">
                order_id,
            </if>
            <if test="vehicleNo != null">
                vehicle_no,
            </if>
            <if test="vinNo != null">
                vin_no,
            </if>
            <if test="carOwner != null">
                car_owner,
            </if>
            <if test="carOwnerPhone != null">
                car_owner_phone,
            </if>
            <if test="status != null">
                `status`,
            </if>
            <if test="remark != null">
                remark,
            </if>
            <if test="createTime != null">
                create_time,
            </if>
            <if test="updateTime != null">
                update_time,
            </if>
            <if test="createBy != null">
                create_by,
            </if>
            <if test="updateBy != null">
                update_by,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="orderId != null">
                #{orderId,jdbcType=INTEGER},
            </if>
            <if test="vehicleNo != null">
                #{vehicleNo,jdbcType=VARCHAR},
            </if>
            <if test="vinNo != null">
                #{vinNo,jdbcType=VARCHAR},
            </if>
            <if test="carOwner != null">
                #{carOwner,jdbcType=VARCHAR},
            </if>
            <if test="carOwnerPhone != null">
                #{carOwnerPhone,jdbcType=VARCHAR},
            </if>
            <if test="status != null">
                #{status,jdbcType=TINYINT},
            </if>
            <if test="remark != null">
                #{remark,jdbcType=TINYINT},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateTime != null">
                #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="createBy != null">
                #{createBy,jdbcType=INTEGER},
            </if>
            <if test="updateBy != null">
                #{updateBy,jdbcType=INTEGER},
            </if>
        </trim>
    </insert>

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

    <update id="updateByExampleSelective" parameterType="map">
        update sys_sub_order
        <set>
            <if test="record.id != null">
                id = #{record.id,jdbcType=INTEGER},
            </if>
            <if test="record.orderId != null">
                order_id = #{record.orderId,jdbcType=INTEGER},
            </if>
            <if test="record.vehicleNo != null">
                vehicle_no = #{record.vehicleNo,jdbcType=VARCHAR},
            </if>
            <if test="record.vinNo != null">
                vin_no = #{record.vinNo,jdbcType=VARCHAR},
            </if>
            <if test="record.carOwner != null">
                car_owner = #{record.carOwner,jdbcType=VARCHAR},
            </if>
            <if test="record.carOwnerPhone != null">
                car_owner_phone = #{record.carOwnerPhone,jdbcType=VARCHAR},
            </if>
            <if test="record.status != null">
                `status` = #{record.status,jdbcType=TINYINT},
            </if>
            <if test="record.remark != null">
                remark = #{record.remark,jdbcType=TINYINT},
            </if>
            <if test="record.createTime != null">
                create_time = #{record.createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="record.updateTime != null">
                update_time = #{record.updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="record.createBy != null">
                create_by = #{record.createBy,jdbcType=INTEGER},
            </if>
            <if test="record.updateBy != null">
                update_by = #{record.updateBy,jdbcType=INTEGER},
            </if>
        </set>
        <if test="_parameter != null">
            <include refid="Update_By_Example_Where_Clause"/>
        </if>
    </update>

    <update id="updateByExample" parameterType="map">
        update sys_sub_order
        set id = #{record.id,jdbcType=INTEGER},
        order_id = #{record.orderId,jdbcType=INTEGER},
        vehicle_no = #{record.vehicleNo,jdbcType=VARCHAR},
        vin_no = #{record.vinNo,jdbcType=VARCHAR},
        car_owner = #{record.carOwner,jdbcType=VARCHAR},
        car_owner_phone = #{record.carOwnerPhone,jdbcType=VARCHAR},
        `status` = #{record.status,jdbcType=TINYINT},
        remark = #{record.remark,jdbcType=VARCHAR},
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
        create_by = #{record.createBy,jdbcType=INTEGER},
        update_by = #{record.updateBy,jdbcType=INTEGER}
        <if test="_parameter != null">
            <include refid="Update_By_Example_Where_Clause"/>
        </if>
    </update>

    <update id="updateByPrimaryKeySelective" parameterType="com.glsx.ordercenter.pojo.SysSubOrder">
        update sys_sub_order
        <set>
            <if test="orderId != null">
                order_id = #{orderId,jdbcType=INTEGER},
            </if>
            <if test="vehicleNo != null">
                vehicle_no = #{vehicleNo,jdbcType=VARCHAR},
            </if>
            <if test="vinNo != null">
                vin_no = #{vinNo,jdbcType=VARCHAR},
            </if>
            <if test="carOwner != null">
                car_owner = #{carOwner,jdbcType=VARCHAR},
            </if>
            <if test="carOwnerPhone != null">
                car_owner_phone = #{carOwnerPhone,jdbcType=VARCHAR},
            </if>
            <if test="status != null">
                `status` = #{status,jdbcType=TINYINT},
            </if>
            <if test="remark != null">
                remark = #{remark,jdbcType=TINYINT},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateTime != null">
                update_time = #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="createBy != null">
                create_by = #{createBy,jdbcType=INTEGER},
            </if>
            <if test="updateBy != null">
                update_by = #{updateBy,jdbcType=INTEGER},
            </if>
        </set>
        where id = #{id,jdbcType=INTEGER}
    </update>

    <update id="updateByPrimaryKey" parameterType="com.glsx.ordercenter.pojo.SysSubOrder">
        update sys_sub_order
        set order_id = #{orderId,jdbcType=INTEGER},
            vehicle_no = #{vehicleNo,jdbcType=VARCHAR},
            vin_no = #{vinNo,jdbcType=VARCHAR},
            car_owner = #{carOwner,jdbcType=VARCHAR},
            car_owner_phone = #{carOwnerPhone,jdbcType=VARCHAR},
            `status` = #{status,jdbcType=TINYINT},
            remark = #{remark,jdbcType=VARCHAR},
            create_time = #{createTime,jdbcType=TIMESTAMP},
            update_time = #{updateTime,jdbcType=TIMESTAMP},
            create_by = #{createBy,jdbcType=INTEGER},
            update_by = #{updateBy,jdbcType=INTEGER}
        where id = #{id,jdbcType=INTEGER}
    </update>
</mapper>