综合办公系统
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 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. <result property="remark" column="remark" />
  16. <association property="car" javaType="CmcCar" resultMap="CmcCarResult" />
  17. <association property="driverUser" javaType="SysUser" resultMap="SysUserResult" />
  18. </resultMap>
  19. <resultMap type="CmcCar" id="CmcCarResult">
  20. <result property="carId" column="car_id" />
  21. <result property="licensePlate" column="license_plate" />
  22. <result property="driver" column="driver" />
  23. <result property="dayCost" column="day_cost" />
  24. </resultMap>
  25. <resultMap type="SysUser" id="SysUserResult">
  26. <result property="userId" column="user_id" />
  27. <result property="nickName" column="nick_name" />
  28. </resultMap>
  29. <sql id="selectCmcBudgetCarVo">
  30. 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
  31. left join cmc_car as c on c.car_id = bc.car_id
  32. left join sys_user as u on c.driver = u.user_id
  33. </sql>
  34. <select id="selectCmcBudgetCarList" parameterType="CmcBudgetCar" resultMap="CmcBudgetCarResult">
  35. <include refid="selectCmcBudgetCarVo"/>
  36. <where>
  37. <if test="budgetId != null and budgetId != ''"> and bc.budget_id = #{budgetId}</if>
  38. <if test="carId != null "> and bc.car_id = #{carId}</if>
  39. <if test="days != null "> and bc.days = #{days}</if>
  40. <if test="depreciation != null "> and bc.depreciation = #{depreciation}</if>
  41. <if test="distance != null "> and bc.distance = #{distance}</if>
  42. <if test="mileage != null "> and bc.mileage = #{mileage}</if>
  43. <if test="expense != null "> and bc.expense = #{expense}</if>
  44. </where>
  45. </select>
  46. <select id="selectCmcBudgetCarByBudgetId" parameterType="String" resultMap="CmcBudgetCarResult">
  47. <include refid="selectCmcBudgetCarVo"/>
  48. where bc.budget_id = #{budgetId}
  49. </select>
  50. <insert id="insertCmcBudgetCar" parameterType="CmcBudgetCar">
  51. insert into cmc_budget_car
  52. <trim prefix="(" suffix=")" suffixOverrides=",">
  53. <if test="budgetCarId != null">budget_car_id,</if>
  54. <if test="budgetId != null">budget_id,</if>
  55. <if test="carId != null">car_id,</if>
  56. <if test="days != null">days,</if>
  57. <if test="depreciation != null">depreciation,</if>
  58. <if test="distance != null">distance,</if>
  59. <if test="mileage != null">mileage,</if>
  60. <if test="expense != null">expense,</if>
  61. <if test="remark != null">remark,</if>
  62. </trim>
  63. <trim prefix="values (" suffix=")" suffixOverrides=",">
  64. <if test="budgetCarId != null">#{budgetCarId},</if>
  65. <if test="budgetId != null">#{budgetId},</if>
  66. <if test="carId != null">#{carId},</if>
  67. <if test="days != null">#{days},</if>
  68. <if test="depreciation != null">#{depreciation},</if>
  69. <if test="distance != null">#{distance},</if>
  70. <if test="mileage != null">#{mileage},</if>
  71. <if test="expense != null">#{expense},</if>
  72. <if test="remark != null">#{remark},</if>
  73. </trim>
  74. </insert>
  75. <update id="updateCmcBudgetCar" parameterType="CmcBudgetCar">
  76. update cmc_budget_car
  77. <trim prefix="SET" suffixOverrides=",">
  78. <if test="budgetId != null">budget_id = #{budgetId},</if>
  79. <if test="carId != null">car_id = #{carId},</if>
  80. <if test="days != null">days = #{days},</if>
  81. <if test="depreciation != null">depreciation = #{depreciation},</if>
  82. <if test="distance != null">distance = #{distance},</if>
  83. <if test="mileage != null">mileage = #{mileage},</if>
  84. <if test="expense != null">expense = #{expense},</if>
  85. <if test="remark != null">remark = #{remark},</if>
  86. </trim>
  87. where budget_car_id = #{budgetCarId}
  88. </update>
  89. <delete id="deleteCmcBudgetCarByBudgetCarId" parameterType="String">
  90. delete from cmc_budget_car where budget_car_id = #{budgetCarId}
  91. </delete>
  92. <delete id="deleteCmcBudgetCarByBudgetCarIds" parameterType="String">
  93. delete from cmc_budget_car where budget_car_id in
  94. <foreach item="budgetCarId" collection="array" open="(" separator="," close=")">
  95. #{budgetCarId}
  96. </foreach>
  97. </delete>
  98. </mapper>