CmRefundsRecordMapper.xml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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.caimei.modules.bulkpurchase.dao.CmRefundsRecordDao">
  4. <sql id="cmRefundsRecordColumns">
  5. a.id AS "id",
  6. a.orderId AS "orderId",
  7. a.userId AS "userId",
  8. a.userType AS "userType",
  9. a.orderType AS "orderType",
  10. a.recordContent AS "recordContent",
  11. a.recordDate AS "recordDate"
  12. </sql>
  13. <sql id="cmRefundsRecordJoins">
  14. </sql>
  15. <select id="get" resultType="CmRefundsRecord">
  16. SELECT
  17. <include refid="cmRefundsRecordColumns"/>
  18. FROM cm_refunds_record a
  19. <include refid="cmRefundsRecordJoins"/>
  20. WHERE a.id = #{id}
  21. order BY a.recordDate DESC
  22. </select>
  23. <select id="findList" resultType="CmRefundsRecord">
  24. SELECT
  25. <include refid="cmRefundsRecordColumns"/>
  26. FROM cm_refunds_record a
  27. <include refid="cmRefundsRecordJoins"/>
  28. <where>
  29. <if test="userId != null and userId != ''">
  30. AND a.userId = #{userId}
  31. </if>
  32. <if test="orderId != null and orderId != ''">
  33. AND a.orderId = #{orderId}
  34. </if>
  35. </where>
  36. <choose>
  37. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  38. ORDER BY ${page.orderBy}
  39. </when>
  40. <otherwise>
  41. </otherwise>
  42. </choose>
  43. order BY a.recordDate DESC
  44. </select>
  45. <select id="findAllList" resultType="CmRefundsRecord">
  46. SELECT
  47. <include refid="cmRefundsRecordColumns"/>
  48. FROM cm_refunds_record a
  49. <include refid="cmRefundsRecordJoins"/>
  50. <where>
  51. </where>
  52. <choose>
  53. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  54. ORDER BY ${page.orderBy}
  55. </when>
  56. <otherwise>
  57. </otherwise>
  58. </choose>
  59. </select>
  60. <insert id="insert" parameterType="CmRefundsRecord" keyProperty="id" useGeneratedKeys="true">
  61. INSERT INTO cm_refunds_record(
  62. id,
  63. orderId,
  64. userId,
  65. userType,
  66. orderType,
  67. recordContent,
  68. recordDate
  69. ) VALUES (
  70. #{id},
  71. #{orderId},
  72. #{userId},
  73. #{userType},
  74. #{orderType},
  75. #{recordContent},
  76. #{recordDate}
  77. )
  78. </insert>
  79. <update id="update">
  80. UPDATE cm_refunds_record SET
  81. orderId = #{orderId},
  82. userId = #{userId},
  83. userType = #{userType},
  84. orderType = #{orderType},
  85. recordContent = #{recordContent},
  86. recordDate = #{recordDate}
  87. WHERE id = #{id}
  88. </update>
  89. <delete id="delete">
  90. DELETE FROM cm_refunds_record
  91. WHERE id = #{id}
  92. </delete>
  93. </mapper>