CarInformationMapper.xml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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="beilv.carinformation.mapper.CarInformationMapper">
  6. <resultMap type="CarInformation" id="CarInformationResult">
  7. <result property="id" column="id" />
  8. <result property="name" column="name" />
  9. <result property="type" column="type" />
  10. <result property="totalNumber" column="total_number" />
  11. <result property="price" column="price" />
  12. <result property="point" column="point" />
  13. <result property="expirationDate" column="expiration_date" />
  14. <result property="notes" column="notes" />
  15. <result property="state" column="state" />
  16. <result property="createBy" column="create_by" />
  17. <result property="createTime" column="create_time" />
  18. <result property="updateBy" column="update_by" />
  19. <result property="updateTime" column="update_time" />
  20. </resultMap>
  21. <sql id="selectCarInformationVo">
  22. select id, name, type, total_number, price, point, expiration_date, notes, state, create_by, create_time, update_by, update_time from card_information
  23. </sql>
  24. <select id="selectCarInformationList" parameterType="CarInformation" resultMap="CarInformationResult">
  25. <include refid="selectCarInformationVo"/>
  26. <where>
  27. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  28. <if test="type != null and type != ''"> and type = #{type}</if>
  29. <if test="totalNumber != null "> and total_number = #{totalNumber}</if>
  30. <if test="price != null "> and price = #{price}</if>
  31. <if test="point != null "> and point = #{point}</if>
  32. <if test="expirationDate != null "> and expiration_date = #{expirationDate}</if>
  33. <if test="notes != null and notes != ''"> and notes = #{notes}</if>
  34. <if test="state != null and state != ''"> and state = #{state}</if>
  35. </where>
  36. order by create_time desc
  37. </select>
  38. <select id="selectCarInformationById" parameterType="Long" resultMap="CarInformationResult">
  39. <include refid="selectCarInformationVo"/>
  40. where id = #{id}
  41. </select>
  42. <insert id="insertCarInformation" parameterType="CarInformation">
  43. insert into card_information
  44. <trim prefix="(" suffix=")" suffixOverrides=",">
  45. <if test="id != null">id,</if>
  46. <if test="name != null">name,</if>
  47. <if test="type != null">type,</if>
  48. <if test="totalNumber != null">total_number,</if>
  49. <if test="price != null">price,</if>
  50. <if test="point != null">point,</if>
  51. <if test="expirationDate != null">expiration_date,</if>
  52. <if test="notes != null">notes,</if>
  53. <if test="state != null">state,</if>
  54. <if test="createBy != null">create_by,</if>
  55. <if test="createTime != null">create_time,</if>
  56. <if test="updateBy != null">update_by,</if>
  57. <if test="updateTime != null">update_time,</if>
  58. </trim>
  59. <trim prefix="values (" suffix=")" suffixOverrides=",">
  60. <if test="id != null">#{id},</if>
  61. <if test="name != null">#{name},</if>
  62. <if test="type != null">#{type},</if>
  63. <if test="totalNumber != null">#{totalNumber},</if>
  64. <if test="price != null">#{price},</if>
  65. <if test="point != null">#{point},</if>
  66. <if test="expirationDate != null">#{expirationDate},</if>
  67. <if test="notes != null">#{notes},</if>
  68. <if test="state != null">#{state},</if>
  69. <if test="createBy != null">#{createBy},</if>
  70. <if test="createTime != null">#{createTime},</if>
  71. <if test="updateBy != null">#{updateBy},</if>
  72. <if test="updateTime != null">#{updateTime},</if>
  73. </trim>
  74. </insert>
  75. <update id="updateCarInformation" parameterType="CarInformation">
  76. update card_information
  77. <trim prefix="SET" suffixOverrides=",">
  78. <if test="name != null">name = #{name},</if>
  79. <if test="type != null">type = #{type},</if>
  80. <if test="totalNumber != null">total_number = #{totalNumber},</if>
  81. <if test="price != null">price = #{price},</if>
  82. <if test="point != null">point = #{point},</if>
  83. <if test="expirationDate != null">expiration_date = #{expirationDate},</if>
  84. <if test="notes != null">notes = #{notes},</if>
  85. <if test="state != null">state = #{state},</if>
  86. <if test="createBy != null">create_by = #{createBy},</if>
  87. <if test="createTime != null">create_time = #{createTime},</if>
  88. <if test="updateBy != null">update_by = #{updateBy},</if>
  89. <if test="updateTime != null">update_time = #{updateTime},</if>
  90. </trim>
  91. where id = #{id}
  92. </update>
  93. <delete id="deleteCarInformationById" parameterType="Long">
  94. delete from card_information where id = #{id}
  95. </delete>
  96. <delete id="deleteCarInformationByIds" parameterType="String">
  97. delete from card_information where id in
  98. <foreach item="id" collection="array" open="(" separator="," close=")">
  99. #{id}
  100. </foreach>
  101. </delete>
  102. </mapper>