CustomerPointsRecordMapper.xml 4.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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.yijia.integral.mapper.CustomerPointsRecordMapper">
  6. <resultMap type="CustomerPointsRecord" id="CustomerPointsRecordResult">
  7. <result property="id" column="id" />
  8. <result property="unionId" column="union_id" />
  9. <result property="customerName" column="customer_name" />
  10. <result property="recordType" column="record_type" />
  11. <result property="integral" column="integral" />
  12. <result property="createTime" column="create_time" />
  13. <result property="stationId" column="station_id" />
  14. <result property="stationName" column="station_name" />
  15. </resultMap>
  16. <sql id="selectCustomerPointsRecordVo">
  17. select id, union_id, customer_name, record_type, integral, create_time, station_id, station_name from customer_points_record
  18. </sql>
  19. <select id="selectCustomerPointsRecordList" parameterType="CustomerPointsRecord" resultMap="CustomerPointsRecordResult">
  20. <include refid="selectCustomerPointsRecordVo"/>
  21. <where>
  22. <if test="unionId != null and unionId != ''"> and union_id = #{unionId}</if>
  23. <if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
  24. <if test="recordType != null and recordType != ''"> and record_type = #{recordType}</if>
  25. <if test="integral != null "> and integral = #{integral}</if>
  26. <if test="stationId != null "> and station_id = #{stationId}</if>
  27. <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
  28. <if test="stationIdList != null ">
  29. and station_id in
  30. <foreach item="item" index="index" collection="stationIdList"
  31. open="(" separator="," close=")">
  32. #{item}
  33. </foreach>
  34. </if>
  35. </where>
  36. order by id desc
  37. </select>
  38. <select id="selectCustomerPointsRecordById" parameterType="Long" resultMap="CustomerPointsRecordResult">
  39. <include refid="selectCustomerPointsRecordVo"/>
  40. where id = #{id}
  41. </select>
  42. <insert id="insertCustomerPointsRecord" parameterType="CustomerPointsRecord" useGeneratedKeys="true" keyProperty="id">
  43. insert into customer_points_record
  44. <trim prefix="(" suffix=")" suffixOverrides=",">
  45. <if test="unionId != null">union_id,</if>
  46. <if test="customerName != null">customer_name,</if>
  47. <if test="recordType != null">record_type,</if>
  48. <if test="integral != null">integral,</if>
  49. <if test="createTime != null">create_time,</if>
  50. <if test="stationId != null">station_id,</if>
  51. <if test="stationName != null">station_name,</if>
  52. </trim>
  53. <trim prefix="values (" suffix=")" suffixOverrides=",">
  54. <if test="unionId != null">#{unionId},</if>
  55. <if test="customerName != null">#{customerName},</if>
  56. <if test="recordType != null">#{recordType},</if>
  57. <if test="integral != null">#{integral},</if>
  58. <if test="createTime != null">#{createTime},</if>
  59. <if test="stationId != null">#{stationId},</if>
  60. <if test="stationName != null">#{stationName},</if>
  61. </trim>
  62. </insert>
  63. <update id="updateCustomerPointsRecord" parameterType="CustomerPointsRecord">
  64. update customer_points_record
  65. <trim prefix="SET" suffixOverrides=",">
  66. <if test="unionId != null">union_id = #{unionId},</if>
  67. <if test="customerName != null">customer_name = #{customerName},</if>
  68. <if test="recordType != null">record_type = #{recordType},</if>
  69. <if test="integral != null">integral = #{integral},</if>
  70. <if test="createTime != null">create_time = #{createTime},</if>
  71. <if test="stationId != null">station_id = #{stationId},</if>
  72. <if test="stationName != null">station_name = #{stationName},</if>
  73. </trim>
  74. where id = #{id}
  75. </update>
  76. <delete id="deleteCustomerPointsRecordById" parameterType="Long">
  77. delete from customer_points_record where id = #{id}
  78. </delete>
  79. <delete id="deleteCustomerPointsRecordByIds" parameterType="String">
  80. delete from customer_points_record where id in
  81. <foreach item="id" collection="array" open="(" separator="," close=")">
  82. #{id}
  83. </foreach>
  84. </delete>
  85. </mapper>