CardExcelImportMapper.xml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. </resultMap>
  18. <sql id="selectCardExcelImportVo">
  19. SELECT a.excel_id,a.station_id,a.phone_number,
  20. a.member_grade,a.integral,a.card_type,a.balance,b.dept_name,
  21. a.label_id,a.coupon_issue_id
  22. from card_excel_import a
  23. left join sys_dept b on a.station_id=b.dept_id
  24. </sql>
  25. <select id="selectCardExcelImportList" parameterType="CardExcelImport" resultMap="CardExcelImportResult">
  26. <include refid="selectCardExcelImportVo"/>
  27. <where>
  28. <if test="balance != null and balance != ''"> and a.balance = #{balance}</if>
  29. <if test="integral != null and integral != ''"> and a.integral = #{integral}</if>
  30. <if test="phoneNumber != null and phoneNumber != ''"> and a.phone_number = #{phoneNumber}</if>
  31. <if test="cardType != null and cardType != ''"> and a.card_type = #{cardType} </if>
  32. <if test="stationId != null and stationId != ''"> and a.station_id = #{stationId}</if>
  33. <if test="memberGrade != null and memberGrade != ''"> and a.member_grade = #{memberGrade}</if>
  34. <if test="labelId != null and labelId != ''"> and a.label_id = #{labelId}</if>
  35. <if test="couponIssueId != null and couponIssueId != ''"> and a.coupon_issue_id = #{couponIssueId}</if>
  36. <if test="stationIdList != null ">
  37. and a.station_id in
  38. <foreach item="item" index="index" collection="stationIdList"
  39. open="(" separator="," close=")">
  40. #{item}
  41. </foreach>
  42. </if>
  43. </where>
  44. order by excel_id desc
  45. </select>
  46. <select id="selectCardExcelImportById" parameterType="Long" resultMap="CardExcelImportResult">
  47. <include refid="selectCardExcelImportVo"/>
  48. where excel_id = #{excelId}
  49. </select>
  50. <select id="selectCardExcelImportByPhoneStation" parameterType="CardExcelImport" resultMap="CardExcelImportResult">
  51. <include refid="selectCardExcelImportVo"/>
  52. <where>
  53. <if test="phoneNumber != null and phoneNumber != ''"> and a.phone_number = #{phoneNumber}</if>
  54. <if test="stationId != null and stationId != ''"> and a.station_id = #{stationId}</if>
  55. </where>
  56. </select>
  57. <insert id="insertCardExcelImport" parameterType="CardExcelImport" useGeneratedKeys="true" keyProperty="excelId">
  58. insert into card_excel_import
  59. <trim prefix="(" suffix=")" suffixOverrides=",">
  60. <if test="balance != null">balance,</if>
  61. <if test="integral != null">integral,</if>
  62. <if test="phoneNumber != null">phone_number,</if>
  63. <if test="cardType != null">card_type,</if>
  64. <if test="stationId != null">station_id,</if>
  65. <if test="memberGrade != null">member_grade,</if>
  66. <if test="labelId != null">label_id,</if>
  67. <if test="couponIssueId != null">coupon_issue_id,</if>
  68. </trim>
  69. <trim prefix="values (" suffix=")" suffixOverrides=",">
  70. <if test="balance != null">#{balance},</if>
  71. <if test="integral != null">#{integral},</if>
  72. <if test="phoneNumber != null">#{phoneNumber},</if>
  73. <if test="cardType != null">#{cardType},</if>
  74. <if test="stationId != null">#{stationId},</if>
  75. <if test="memberGrade != null">#{memberGrade},</if>
  76. <if test="labelId != null">#{labelId},</if>
  77. <if test="couponIssueId != null">#{couponIssueId},</if>
  78. </trim>
  79. </insert>
  80. <update id="updateCardExcelImport" parameterType="CardExcelImport">
  81. update card_excel_import
  82. <trim prefix="SET" suffixOverrides=",">
  83. <if test="balance != null">balance = #{balance},</if>
  84. <if test="integral != null">integral = #{integral},</if>
  85. <if test="phoneNumber != null">phone_number = #{phoneNumber},</if>
  86. <if test="cardType != null">card_type = #{cardType},</if>
  87. <if test="stationId != null">station_id = #{stationId},</if>
  88. <if test="memberGrade != null">member_grade = #{memberGrade},</if>
  89. <if test="labelId != null">label_id = #{labelId},</if>
  90. <if test="couponIssueId != null">coupon_issue_id = #{couponIssueId},</if>
  91. </trim>
  92. where excel_id = #{excelId}
  93. </update>
  94. <delete id="deleteCardExcelImportById" parameterType="Long">
  95. delete from card_excel_import where excel_id = #{excelId}
  96. </delete>
  97. <delete id="deleteCardExcelImportByIds" parameterType="String">
  98. delete from card_excel_import where excel_id in
  99. <foreach item="excelId" collection="array" open="(" separator="," close=")">
  100. #{excelId}
  101. </foreach>
  102. </delete>
  103. </mapper>