CustomerPointsRecordMapper.xml 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. </resultMap>
  15. <!--查询列-->
  16. <sql id="Base_Column_List">
  17. id, union_id, customer_name, record_type, integral, station_id, station_name,
  18. create_time
  19. </sql>
  20. <!--查询客户积分记录信息-->
  21. <select id="getCustomerPointsRecordList" resultMap="BaseResultMap" parameterType="com.platform.yijia.pojo.CustomerPointsRecord">
  22. SELECT
  23. <include refid="Base_Column_List" />
  24. FROM customer_points_record
  25. <where>
  26. <if test="unionId !=null and unionId !=''">
  27. union_id = #{unionId}
  28. </if>
  29. <if test="stationId !=null and stationId !=''">
  30. AND station_id = #{stationId}
  31. </if>
  32. <if test="createTime !=null">
  33. <![CDATA[ AND create_time >= #{createTime} ]]>
  34. </if>
  35. </where>
  36. ORDER BY create_time DESC
  37. </select>
  38. <!--插入客户积分记录表-->
  39. <insert id="insertCustomerPointsRecordInfo" parameterType="com.platform.yijia.pojo.CustomerPoints">
  40. INSERT INTO customer_points_record
  41. <trim prefix="(" suffix=")" suffixOverrides=",">
  42. <if test="unionId !=null">
  43. union_id,
  44. </if>
  45. <if test="customerName !=null">
  46. customer_name,
  47. </if>
  48. <if test="recordType !=null">
  49. record_type,
  50. </if>
  51. <if test="integral !=null">
  52. integral,
  53. </if>
  54. <if test="stationId !=null">
  55. station_id,
  56. </if>
  57. <if test="stationName !=null">
  58. station_name,
  59. </if>
  60. <if test="createTime !=null">
  61. create_time,
  62. </if>
  63. </trim>
  64. <trim prefix="values (" suffix=")" suffixOverrides=",">
  65. <if test="unionId !=null">
  66. #{unionId},
  67. </if>
  68. <if test="customerName !=null">
  69. #{customerName},
  70. </if>
  71. <if test="recordType !=null">
  72. #{recordType},
  73. </if>
  74. <if test="integral !=null">
  75. #{integral},
  76. </if>
  77. <if test="stationId !=null">
  78. #{stationId},
  79. </if>
  80. <if test="stationName !=null">
  81. #{stationName},
  82. </if>
  83. <if test="createTime !=null">
  84. #{createTime},
  85. </if>
  86. </trim>
  87. </insert>
  88. </mapper>