CardExcelImportMapper.xml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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.customer.mapper.CardExcelImportMapper">
  6. <resultMap type="CardExcelImport" id="CardExcelImportResult">
  7. <result property="excelId" column="excel_id" />
  8. <result property="balance" column="balance" />
  9. <result property="integral" column="integral" />
  10. <result property="phoneNumber" column="phone_number" />
  11. <result property="cardType" column="card_type" />
  12. <result property="stationId" column="station_id" />
  13. <result property="memberGrade" column="member_grade" />
  14. <result property="stationName" column="dept_name" />
  15. <result property="labelId" column="label_id" />
  16. <result property="couponIssueId" column="coupon_issue_id" />
  17. <result property="importExcelDate" column="import_excel_date" />
  18. <result property="importExcelUser" column="import_excel_user" />
  19. </resultMap>
  20. <sql id="selectCardExcelImportVo">
  21. SELECT a.excel_id,a.station_id,a.phone_number,
  22. a.member_grade,a.integral,a.card_type,a.balance,b.dept_name,
  23. a.label_id,a.coupon_issue_id,a.import_excel_date,a.import_excel_user
  24. from card_excel_import a
  25. left join sys_dept b on a.station_id=b.dept_id
  26. </sql>
  27. <select id="selectCardExcelImportList" parameterType="CardExcelImport" resultMap="CardExcelImportResult">
  28. <include refid="selectCardExcelImportVo"/>
  29. <where>
  30. <if test="balance != null and balance != ''"> and a.balance = #{balance}</if>
  31. <if test="integral != null and integral != ''"> and a.integral = #{integral}</if>
  32. <if test="phoneNumber != null and phoneNumber != ''"> and a.phone_number = #{phoneNumber}</if>
  33. <if test="cardType != null and cardType != ''"> and a.card_type = #{cardType} </if>
  34. <if test="stationId != null and stationId != ''"> and a.station_id = #{stationId}</if>
  35. <if test="memberGrade != null and memberGrade != ''"> and a.member_grade = #{memberGrade}</if>
  36. <if test="labelId != null and labelId != ''"> and a.label_id = #{labelId}</if>
  37. <if test="couponIssueId != null and couponIssueId != ''"> and a.coupon_issue_id = #{couponIssueId}</if>
  38. <if test="importFlag != null and importFlag != ''"> and a.import_flag = #{importFlag}</if>
  39. <if test="delFlag != null and delFlag != ''"> and a.del_flag = #{delFlag}</if>
  40. <if test="importExcelUser != null and importExcelUser != ''"> and a.import_excel_user = #{importExcelUser}</if>
  41. <if test="stationList != null ">
  42. and a.station_id in
  43. <foreach item="item" index="index" collection="stationList"
  44. open="(" separator="," close=")">
  45. #{item}
  46. </foreach>
  47. </if>
  48. </where>
  49. order by excel_id desc
  50. </select>
  51. <select id="selectCardExcelImportById" parameterType="Long" resultMap="CardExcelImportResult">
  52. <include refid="selectCardExcelImportVo"/>
  53. where excel_id = #{excelId}
  54. </select>
  55. <select id="selectCardExcelImportByPhoneStation" parameterType="CardExcelImport" resultMap="CardExcelImportResult">
  56. <include refid="selectCardExcelImportVo"/>
  57. <where>
  58. <if test="phoneNumber != null and phoneNumber != ''"> and a.phone_number = #{phoneNumber}</if>
  59. <if test="stationId != null and stationId != ''"> and a.station_id = #{stationId}</if>
  60. </where>
  61. </select>
  62. <insert id="insertCardExcelImport" parameterType="CardExcelImport" useGeneratedKeys="true" keyProperty="excelId">
  63. insert into card_excel_import
  64. <trim prefix="(" suffix=")" suffixOverrides=",">
  65. <if test="balance != null">balance,</if>
  66. <if test="integral != null">integral,</if>
  67. <if test="phoneNumber != null">phone_number,</if>
  68. <if test="cardType != null">card_type,</if>
  69. <if test="stationId != null">station_id,</if>
  70. <if test="memberGrade != null">member_grade,</if>
  71. <if test="labelId != null">label_id,</if>
  72. <if test="couponIssueId != null">coupon_issue_id,</if>
  73. <if test="importFlag != null">import_flag,</if>
  74. <if test="delFlag != null">del_flag,</if>
  75. <if test="importExcelDate != null">import_excel_date,</if>
  76. <if test="importExcelUser != null">import_excel_user,</if>
  77. </trim>
  78. <trim prefix="values (" suffix=")" suffixOverrides=",">
  79. <if test="balance != null">#{balance},</if>
  80. <if test="integral != null">#{integral},</if>
  81. <if test="phoneNumber != null">#{phoneNumber},</if>
  82. <if test="cardType != null">#{cardType},</if>
  83. <if test="stationId != null">#{stationId},</if>
  84. <if test="memberGrade != null">#{memberGrade},</if>
  85. <if test="labelId != null">#{labelId},</if>
  86. <if test="couponIssueId != null">#{couponIssueId},</if>
  87. <if test="importFlag != null">#{importFlag},</if>
  88. <if test="delFlag != null">#{delFlag},</if>
  89. <if test="importExcelDate != null">#{importExcelDate},</if>
  90. <if test="importExcelUser != null">#{importExcelUser},</if>
  91. </trim>
  92. </insert>
  93. <update id="updateCardExcelImport" parameterType="CardExcelImport">
  94. update card_excel_import
  95. <trim prefix="SET" suffixOverrides=",">
  96. <if test="balance != null">balance = #{balance},</if>
  97. <if test="integral != null">integral = #{integral},</if>
  98. <if test="phoneNumber != null">phone_number = #{phoneNumber},</if>
  99. <if test="cardType != null">card_type = #{cardType},</if>
  100. <if test="stationId != null">station_id = #{stationId},</if>
  101. <if test="memberGrade != null">member_grade = #{memberGrade},</if>
  102. <if test="labelId != null">label_id = #{labelId},</if>
  103. <if test="couponIssueId != null">coupon_issue_id = #{couponIssueId},</if>
  104. <if test="importFlag != null">import_flag = #{importFlag},</if>
  105. <if test="delFlag != null">del_flag = #{delFlag},</if>
  106. </trim>
  107. where excel_id = #{excelId}
  108. </update>
  109. <update id="updateCardExcelGrade" parameterType="CardExcelImport">
  110. update card_excel_import
  111. <trim prefix="SET" suffixOverrides=",">
  112. member_grade = null,
  113. </trim>
  114. where excel_id = #{excelId}
  115. </update>
  116. <update id="updateCardExcelLabel" parameterType="CardExcelImport">
  117. update card_excel_import
  118. <trim prefix="SET" suffixOverrides=",">
  119. label_id = null,
  120. </trim>
  121. where excel_id = #{excelId}
  122. </update>
  123. <update id="updateCardExcelCoupon" parameterType="CardExcelImport">
  124. update card_excel_import
  125. <trim prefix="SET" suffixOverrides=",">
  126. coupon_issue_id = null,
  127. </trim>
  128. where excel_id = #{excelId}
  129. </update>
  130. <delete id="deleteCardExcelImportById" parameterType="Long">
  131. delete from card_excel_import where excel_id = #{excelId}
  132. </delete>
  133. <delete id="deleteCardExcelImportByIds" parameterType="String">
  134. delete from card_excel_import where excel_id in
  135. <foreach item="excelId" collection="array" open="(" separator="," close=")">
  136. #{excelId}
  137. </foreach>
  138. </delete>
  139. </mapper>