CustomerFavoritesMapper.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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.ruoyi.mingxue.mapper.CustomerFavoritesMapper">
  6. <resultMap type="CustomerFavorites" id="CustomerFavoritesResult">
  7. <result property="id" column="id" />
  8. <result property="customercode" column="customerCode" />
  9. <result property="type" column="type" />
  10. <result property="course" column="course" />
  11. <result property="refid" column="refId" />
  12. <result property="reftype" column="refType" />
  13. <result property="time" column="time" />
  14. <result property="status" column="status" />
  15. </resultMap>
  16. <sql id="selectCustomerFavoritesVo">
  17. select id, customerCode, type, course, refId, refType, time, status from b_customer_favorites
  18. </sql>
  19. <select id="selectCustomerFavoritesList" parameterType="CustomerFavorites" resultMap="CustomerFavoritesResult">
  20. <include refid="selectCustomerFavoritesVo"/>
  21. <where>
  22. <if test="customercode != null and customercode != ''"> and customerCode = #{customercode}</if>
  23. <if test="type != null and type != ''"> and type = #{type}</if>
  24. <if test="course != null and course != ''"> and course = #{course}</if>
  25. <if test="refid != null and refid != ''"> and refId = #{refid}</if>
  26. <if test="reftype != null and reftype != ''"> and refType = #{reftype}</if>
  27. <if test="time != null "> and time = #{time}</if>
  28. <if test="status != null "> and status = #{status}</if>
  29. </where>
  30. </select>
  31. <select id="selectCustomerFavoritesById" parameterType="Long" resultMap="CustomerFavoritesResult">
  32. <include refid="selectCustomerFavoritesVo"/>
  33. where id = #{id}
  34. </select>
  35. <insert id="insertCustomerFavorites" parameterType="CustomerFavorites" useGeneratedKeys="true" keyProperty="id">
  36. insert into b_customer_favorites
  37. <trim prefix="(" suffix=")" suffixOverrides=",">
  38. <if test="customercode != null">customerCode,</if>
  39. <if test="type != null">type,</if>
  40. <if test="course != null">course,</if>
  41. <if test="refid != null">refId,</if>
  42. <if test="reftype != null">refType,</if>
  43. <if test="time != null">time,</if>
  44. <if test="status != null">status,</if>
  45. </trim>
  46. <trim prefix="values (" suffix=")" suffixOverrides=",">
  47. <if test="customercode != null">#{customercode},</if>
  48. <if test="type != null">#{type},</if>
  49. <if test="course != null">#{course},</if>
  50. <if test="refid != null">#{refid},</if>
  51. <if test="reftype != null">#{reftype},</if>
  52. <if test="time != null">#{time},</if>
  53. <if test="status != null">#{status},</if>
  54. </trim>
  55. </insert>
  56. <update id="updateCustomerFavorites" parameterType="CustomerFavorites">
  57. update b_customer_favorites
  58. <trim prefix="SET" suffixOverrides=",">
  59. <if test="customercode != null">customerCode = #{customercode},</if>
  60. <if test="type != null">type = #{type},</if>
  61. <if test="course != null">course = #{course},</if>
  62. <if test="refid != null">refId = #{refid},</if>
  63. <if test="reftype != null">refType = #{reftype},</if>
  64. <if test="time != null">time = #{time},</if>
  65. <if test="status != null">status = #{status},</if>
  66. </trim>
  67. where id = #{id}
  68. </update>
  69. <delete id="deleteCustomerFavoritesById" parameterType="Long">
  70. delete from b_customer_favorites where id = #{id}
  71. </delete>
  72. <delete id="deleteCustomerFavoritesByIds" parameterType="String">
  73. delete from b_customer_favorites where id in
  74. <foreach item="id" collection="array" open="(" separator="," close=")">
  75. #{id}
  76. </foreach>
  77. </delete>
  78. <select id="selectSubjects" parameterType="CustomerFavorites" resultMap="CustomerFavoritesResult">
  79. select distinct course from b_customer_favorites
  80. where course is not null and course != ''
  81. <if test="customercode != null and customercode != ''"> and customerCode = #{customercode}</if>
  82. <if test="type != null and type != ''"> and type = #{type}</if>
  83. <if test="course != null and course != ''"> and course = #{course}</if>
  84. <if test="refid != null and refid != ''"> and refId = #{refid}</if>
  85. <if test="reftype != null and reftype != ''"> and refType = #{reftype}</if>
  86. <if test="time != null "> and time = #{time}</if>
  87. <if test="status != null "> and status = #{status}</if>
  88. </select>
  89. </mapper>