1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <?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.oa.mapper.CmcBudgetCarMapper">
-
- <resultMap type="CmcBudgetCar" id="CmcBudgetCarResult">
- <result property="budgetCarId" column="budget_car_id" />
- <result property="budgetId" column="budget_id" />
- <result property="carId" column="car_id" />
- <result property="days" column="days" />
- <result property="depreciation" column="depreciation" />
- <result property="distance" column="distance" />
- <result property="mileage" column="mileage" />
- <result property="expense" column="expense" />
- <association property="car" javaType="CmcCar" resultMap="CmcCarResult" />
- </resultMap>
-
- <resultMap type="CmcCar" id="CmcCarResult">
- <result property="carId" column="car_id" />
- <result property="licensePlate" column="license_plate" />
- </resultMap>
-
- <sql id="selectCmcBudgetCarVo">
- select bc.budget_car_id, bc.budget_id, bc.car_id, c.license_plate, bc.days, bc.depreciation, bc.distance, bc.mileage, bc.expense from cmc_budget_car as bc
- left join cmc_car as c on c.car_id = bc.car_id
- </sql>
-
- <select id="selectCmcBudgetCarList" parameterType="CmcBudgetCar" resultMap="CmcBudgetCarResult">
- <include refid="selectCmcBudgetCarVo"/>
- <where>
- <if test="budgetId != null and budgetId != ''"> and bc.budget_id = #{budgetId}</if>
- <if test="carId != null "> and bc.car_id = #{carId}</if>
- <if test="days != null "> and bc.days = #{days}</if>
- <if test="depreciation != null "> and bc.depreciation = #{depreciation}</if>
- <if test="distance != null "> and bc.distance = #{distance}</if>
- <if test="mileage != null "> and bc.mileage = #{mileage}</if>
- <if test="expense != null "> and bc.expense = #{expense}</if>
- </where>
- </select>
-
- <select id="selectCmcBudgetCarByBudgetId" parameterType="String" resultMap="CmcBudgetCarResult">
- <include refid="selectCmcBudgetCarVo"/>
- where bc.budget_id = #{budgetId}
- </select>
-
- <insert id="insertCmcBudgetCar" parameterType="CmcBudgetCar">
- insert into cmc_budget_car
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="budgetCarId != null">budget_car_id,</if>
- <if test="budgetId != null">budget_id,</if>
- <if test="carId != null">car_id,</if>
- <if test="days != null">days,</if>
- <if test="depreciation != null">depreciation,</if>
- <if test="distance != null">distance,</if>
- <if test="mileage != null">mileage,</if>
- <if test="expense != null">expense,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="budgetCarId != null">#{budgetCarId},</if>
- <if test="budgetId != null">#{budgetId},</if>
- <if test="carId != null">#{carId},</if>
- <if test="days != null">#{days},</if>
- <if test="depreciation != null">#{depreciation},</if>
- <if test="distance != null">#{distance},</if>
- <if test="mileage != null">#{mileage},</if>
- <if test="expense != null">#{expense},</if>
- </trim>
- </insert>
-
- <update id="updateCmcBudgetCar" parameterType="CmcBudgetCar">
- update cmc_budget_car
- <trim prefix="SET" suffixOverrides=",">
- <if test="budgetId != null">budget_id = #{budgetId},</if>
- <if test="carId != null">car_id = #{carId},</if>
- <if test="days != null">days = #{days},</if>
- <if test="depreciation != null">depreciation = #{depreciation},</if>
- <if test="distance != null">distance = #{distance},</if>
- <if test="mileage != null">mileage = #{mileage},</if>
- <if test="expense != null">expense = #{expense},</if>
- </trim>
- where budget_car_id = #{budgetCarId}
- </update>
-
- <delete id="deleteCmcBudgetCarByBudgetCarId" parameterType="String">
- delete from cmc_budget_car where budget_car_id = #{budgetCarId}
- </delete>
-
- <delete id="deleteCmcBudgetCarByBudgetCarIds" parameterType="String">
- delete from cmc_budget_car where budget_car_id in
- <foreach item="budgetCarId" collection="array" open="(" separator="," close=")">
- #{budgetCarId}
- </foreach>
- </delete>
- </mapper>
|