DriverSchedulingExpandMapper.xml 6.67 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.expand.mapper.DriverSchedulingExpandMapper">
    
    <resultMap type="DriverSchedulingExpand" id="DriverSchedulingExpandResult">
        <result property="id"    column="id"    />
        <result property="status"    column="status"    />
        <result property="masterJobCode"    column="master_job_code"    />
        <result property="slaveJobCode"    column="slave_job_code"    />
        <result property="startDate"    column="start_date"    />
        <result property="endDate"    column="end_date"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateBy"    column="update_by"    />
        <result property="remark"    column="remark"    />
        <result property="type"    column="type"    />
    </resultMap>

    <resultMap id="DriverSchedulingExpandDto" type="com.ruoyi.pojo.vo.ExpandResponseVo">
        <result property="status"    column="status"    />
        <result property="masterJobCode"    column="master_job_code"    />
        <result property="slaveJobCode"    column="slave_job_code"    />
        <result property="startDate"    column="start_date"    />
        <result property="endDate"    column="end_date"    />
        <result property="materName"    column="materName"    />
        <result property="slaveName"    column="slaveName"    />
        <result property="slaveFleetName"    column="slaveFleetName"    />
        <result property="slavePosts"    column="slavePosts"    />
        <result property="type"    column="type"    />
    </resultMap>

    <sql id="selectDriverSchedulingExpandVo">
        select id, status, master_job_code, slave_job_code, start_date, end_date, create_time, update_time, create_by, update_by, remark,type from driver_scheduling_expand
    </sql>

    <select id="selectDriverSchedulingExpandList" parameterType="DriverSchedulingExpand" resultMap="DriverSchedulingExpandResult">
        <include refid="selectDriverSchedulingExpandVo"/>
        <where>  
            <if test="status != null "> and status = #{status}</if>
            <if test="masterJobCode != null  and masterJobCode != ''"> and master_job_code = #{masterJobCode}</if>
            <if test="slaveJobCode != null  and slaveJobCode != ''"> and slave_job_code = #{slaveJobCode}</if>
            <if test="startDate != null "> and start_date = #{startDate}</if>
            <if test="endDate != null "> and end_date = #{endDate}</if>
        </where>
    </select>
    
    <select id="selectDriverSchedulingExpandById" parameterType="Long" resultMap="DriverSchedulingExpandResult">
        <include refid="selectDriverSchedulingExpandVo"/>
        where id = #{id}
    </select>
    <select id="queryExpandListByEntity" resultMap="DriverSchedulingExpandDto" resultType="com.ruoyi.pojo.vo.ExpandResponseVo">
        select driver.personnel_name slaveName,
               driver.fleet_name slaveFleetName,
               driver.posts slavePosts,expand.*
        from driver_scheduling_expand expand,driver
        where driver.job_code = expand.slave_job_code
            and start_date &lt;= NOW()
            <if test="status != null">
                and expand.`status` = #{status}
            </if>
            <if test="masterJobCode != null">
                and expand.master_job_code = #{masterJobCode}
            </if>
            <if test="slaveJobCode != null">
                and expand.slave_job_code = #{slaveJobCode}
            </if>
    </select>

    <insert id="insertDriverSchedulingExpand" parameterType="DriverSchedulingExpand" useGeneratedKeys="true" keyProperty="id">
        insert into driver_scheduling_expand
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="status != null">status,</if>
            <if test="masterJobCode != null">master_job_code,</if>
            <if test="slaveJobCode != null">slave_job_code,</if>
            <if test="startDate != null">start_date,</if>
            <if test="endDate != null">end_date,</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>
            <if test="remark != null">remark,</if>
            <if test="type != null">type,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="status != null">#{status},</if>
            <if test="masterJobCode != null">#{masterJobCode},</if>
            <if test="slaveJobCode != null">#{slaveJobCode},</if>
            <if test="startDate != null">#{startDate},</if>
            <if test="endDate != null">#{endDate},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="remark != null">#{remark},</if>
            <if test="type != null">#{type},</if>
         </trim>
    </insert>

    <update id="updateDriverSchedulingExpand" parameterType="DriverSchedulingExpand">
        update driver_scheduling_expand
        <trim prefix="SET" suffixOverrides=",">
            <if test="status != null">status = #{status},</if>
            <if test="masterJobCode != null">master_job_code = #{masterJobCode},</if>
            <if test="slaveJobCode != null">slave_job_code = #{slaveJobCode},</if>
            <if test="startDate != null">start_date = #{startDate},</if>
            <if test="endDate != null">end_date = #{endDate},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="type != null">`type` = #{type},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteDriverSchedulingExpandById" parameterType="Long">
        delete from driver_scheduling_expand where id = #{id}
    </delete>

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