CustomerPointsRecordMapper.xml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.platform.yijia.dao.CustomerPointsRecordMapper">
  4. <!--返回结果-->
  5. <resultMap id="BaseResultMap" type="com.platform.yijia.pojo.CustomerPointsRecord">
  6. <id column="id" jdbcType="INTEGER" property="id" />
  7. <result column="union_id" jdbcType="VARCHAR" property="unionId" />
  8. <result column="customer_name" jdbcType="VARCHAR" property="customerName" />
  9. <result column="record_type" jdbcType="VARCHAR" property="recordType" />
  10. <result column="integral" jdbcType="INTEGER" property="integral" />
  11. <result column="station_id" jdbcType="INTEGER" property="stationId" />
  12. <result column="station_name" jdbcType="VARCHAR" property="stationName" />
  13. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  14. <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
  15. </resultMap>
  16. <!--查询列-->
  17. <sql id="Base_Column_List">
  18. id, union_id, customer_name, record_type, integral, station_id, station_name,
  19. create_time,order_no
  20. </sql>
  21. <!--查询客户积分记录信息-->
  22. <select id="getCustomerPointsRecordList" resultMap="BaseResultMap" parameterType="com.platform.yijia.pojo.CustomerPointsRecord">
  23. SELECT
  24. <include refid="Base_Column_List" />
  25. FROM customer_points_record
  26. <where>
  27. <if test="unionId !=null and unionId !=''">
  28. union_id = #{unionId}
  29. </if>
  30. <if test="stationId !=null and stationId !=''">
  31. AND station_id = #{stationId}
  32. </if>
  33. <if test="createTime !=null">
  34. <![CDATA[ AND create_time >= #{createTime} ]]>
  35. </if>
  36. </where>
  37. ORDER BY create_time DESC
  38. </select>
  39. <!--插入客户积分记录表-->
  40. <insert id="insertCustomerPointsRecordInfo" parameterType="com.platform.yijia.pojo.CustomerPoints">
  41. INSERT INTO customer_points_record
  42. <trim prefix="(" suffix=")" suffixOverrides=",">
  43. <if test="unionId !=null">
  44. union_id,
  45. </if>
  46. <if test="customerName !=null">
  47. customer_name,
  48. </if>
  49. <if test="recordType !=null">
  50. record_type,
  51. </if>
  52. <if test="integral !=null">
  53. integral,
  54. </if>
  55. <if test="stationId !=null">
  56. station_id,
  57. </if>
  58. <if test="stationName !=null">
  59. station_name,
  60. </if>
  61. <if test="createTime !=null">
  62. create_time,
  63. </if>
  64. <if test="orderNo !=null">
  65. order_no,
  66. </if>
  67. </trim>
  68. <trim prefix="values (" suffix=")" suffixOverrides=",">
  69. <if test="unionId !=null">
  70. #{unionId},
  71. </if>
  72. <if test="customerName !=null">
  73. #{customerName},
  74. </if>
  75. <if test="recordType !=null">
  76. #{recordType},
  77. </if>
  78. <if test="integral !=null">
  79. #{integral},
  80. </if>
  81. <if test="stationId !=null">
  82. #{stationId},
  83. </if>
  84. <if test="stationName !=null">
  85. #{stationName},
  86. </if>
  87. <if test="createTime !=null">
  88. #{createTime},
  89. </if>
  90. <if test="orderNo !=null">
  91. #{orderNo},
  92. </if>
  93. </trim>
  94. </insert>
  95. </mapper>