综合办公系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CmcBudgetCarMapper.xml 4.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.oa.mapper.CmcBudgetCarMapper">
  6. <resultMap type="CmcBudgetCar" id="CmcBudgetCarResult">
  7. <result property="budgetCarId" column="budget_car_id" />
  8. <result property="budgetId" column="budget_id" />
  9. <result property="carId" column="car_id" />
  10. <result property="days" column="days" />
  11. <result property="depreciation" column="depreciation" />
  12. <result property="distance" column="distance" />
  13. <result property="mileage" column="mileage" />
  14. <result property="expense" column="expense" />
  15. <association property="car" javaType="CmcCar" resultMap="CmcCarResult" />
  16. </resultMap>
  17. <resultMap type="CmcCar" id="CmcCarResult">
  18. <result property="carId" column="car_id" />
  19. <result property="licensePlate" column="license_plate" />
  20. </resultMap>
  21. <sql id="selectCmcBudgetCarVo">
  22. 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
  23. left join cmc_car as c on c.car_id = bc.car_id
  24. </sql>
  25. <select id="selectCmcBudgetCarList" parameterType="CmcBudgetCar" resultMap="CmcBudgetCarResult">
  26. <include refid="selectCmcBudgetCarVo"/>
  27. <where>
  28. <if test="budgetId != null and budgetId != ''"> and bc.budget_id = #{budgetId}</if>
  29. <if test="carId != null "> and bc.car_id = #{carId}</if>
  30. <if test="days != null "> and bc.days = #{days}</if>
  31. <if test="depreciation != null "> and bc.depreciation = #{depreciation}</if>
  32. <if test="distance != null "> and bc.distance = #{distance}</if>
  33. <if test="mileage != null "> and bc.mileage = #{mileage}</if>
  34. <if test="expense != null "> and bc.expense = #{expense}</if>
  35. </where>
  36. </select>
  37. <select id="selectCmcBudgetCarByBudgetId" parameterType="String" resultMap="CmcBudgetCarResult">
  38. <include refid="selectCmcBudgetCarVo"/>
  39. where bc.budget_id = #{budgetId}
  40. </select>
  41. <insert id="insertCmcBudgetCar" parameterType="CmcBudgetCar">
  42. insert into cmc_budget_car
  43. <trim prefix="(" suffix=")" suffixOverrides=",">
  44. <if test="budgetCarId != null">budget_car_id,</if>
  45. <if test="budgetId != null">budget_id,</if>
  46. <if test="carId != null">car_id,</if>
  47. <if test="days != null">days,</if>
  48. <if test="depreciation != null">depreciation,</if>
  49. <if test="distance != null">distance,</if>
  50. <if test="mileage != null">mileage,</if>
  51. <if test="expense != null">expense,</if>
  52. </trim>
  53. <trim prefix="values (" suffix=")" suffixOverrides=",">
  54. <if test="budgetCarId != null">#{budgetCarId},</if>
  55. <if test="budgetId != null">#{budgetId},</if>
  56. <if test="carId != null">#{carId},</if>
  57. <if test="days != null">#{days},</if>
  58. <if test="depreciation != null">#{depreciation},</if>
  59. <if test="distance != null">#{distance},</if>
  60. <if test="mileage != null">#{mileage},</if>
  61. <if test="expense != null">#{expense},</if>
  62. </trim>
  63. </insert>
  64. <update id="updateCmcBudgetCar" parameterType="CmcBudgetCar">
  65. update cmc_budget_car
  66. <trim prefix="SET" suffixOverrides=",">
  67. <if test="budgetId != null">budget_id = #{budgetId},</if>
  68. <if test="carId != null">car_id = #{carId},</if>
  69. <if test="days != null">days = #{days},</if>
  70. <if test="depreciation != null">depreciation = #{depreciation},</if>
  71. <if test="distance != null">distance = #{distance},</if>
  72. <if test="mileage != null">mileage = #{mileage},</if>
  73. <if test="expense != null">expense = #{expense},</if>
  74. </trim>
  75. where budget_car_id = #{budgetCarId}
  76. </update>
  77. <delete id="deleteCmcBudgetCarByBudgetCarId" parameterType="String">
  78. delete from cmc_budget_car where budget_car_id = #{budgetCarId}
  79. </delete>
  80. <delete id="deleteCmcBudgetCarByBudgetCarIds" parameterType="String">
  81. delete from cmc_budget_car where budget_car_id in
  82. <foreach item="budgetCarId" collection="array" open="(" separator="," close=")">
  83. #{budgetCarId}
  84. </foreach>
  85. </delete>
  86. </mapper>