123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <?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" />
- <result property="remark" column="remark" />
- <association property="car" javaType="CmcCar" resultMap="CmcCarResult" />
- <association property="driverUser" javaType="SysUser" resultMap="SysUserResult" />
- </resultMap>
-
- <resultMap type="CmcCar" id="CmcCarResult">
- <result property="carId" column="car_id" />
- <result property="licensePlate" column="license_plate" />
- <result property="driver" column="driver" />
- <result property="dayCost" column="day_cost" />
- </resultMap>
-
- <resultMap type="SysUser" id="SysUserResult">
- <result property="userId" column="user_id" />
- <result property="nickName" column="nick_name" />
- </resultMap>
-
- <sql id="selectCmcBudgetCarVo">
- select bc.budget_car_id, bc.budget_id, bc.car_id, c.license_plate, c.driver, u.nick_name, c.day_cost, bc.days, bc.depreciation, bc.distance, bc.mileage, bc.expense, bc.remark from cmc_budget_car as bc
- left join cmc_car as c on c.car_id = bc.car_id
- left join sys_user as u on c.driver = u.user_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>
- <if test="remark != null">remark,</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>
- <if test="remark != null">#{remark},</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>
- <if test="remark != null">remark = #{remark},</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>
|