VipGoodsMapper.xml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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.dtb.portal.mapper.VipGoodsMapper">
  4. <insert id="insert">
  5. insert into t_vpi_goods(id, name, pay_mode, privilege, vip_date, vip_money, create_time, update_time)
  6. values (#{id}, #{name}, #{payMode}, #{privilege}, #{vipDate}, #{vipMoney}, #{createTime}, #{updateTime})
  7. </insert>
  8. <select id="selectByName" resultType="com.dtb.portal.entity.VipGoodsData">
  9. select *
  10. from t_vpi_goods
  11. where 1=1
  12. <if test="name!=null and name!=''">
  13. and name = #{name,jdbcType=VARCHAR}
  14. </if>
  15. <if test="id!=null and id!=''">
  16. and id!=#{id,jdbcType=VARCHAR}
  17. </if>
  18. </select>
  19. <update id="update">
  20. update t_vpi_goods
  21. <set>
  22. <if test="name!=null and name!=''">
  23. name=#{name,jdbcType=VARCHAR},
  24. </if>
  25. <if test="payMode!=null and payMode!=''">
  26. pay_mode=#{payMode,jdbcType=VARCHAR},
  27. </if>
  28. <if test="privilege!=null and privilege!=''">
  29. privilege=#{privilege,jdbcType=VARCHAR},
  30. </if>
  31. <if test="vipDate!=null and vipDate!=''">
  32. vip_date=#{vipDate,jdbcType=VARCHAR},
  33. </if>
  34. <if test="vipDate!=null and vipDate!=''">
  35. vip_money=#{vipMoney,jdbcType=VARCHAR},
  36. </if>
  37. <if test="updateTime!=null">
  38. update_time=#{updateTime,jdbcType=VARCHAR},
  39. </if>
  40. </set>
  41. where id=#{id,jdbcType=VARCHAR}
  42. </update>
  43. <delete id="delete">
  44. delete
  45. from t_vpi_goods
  46. where id = #{id,jdbcType=VARCHAR}
  47. </delete>
  48. <select id="selectById" resultType="com.dtb.portal.entity.VipGoodsData">
  49. select *
  50. from t_vpi_goods
  51. where id = #{id}
  52. </select>
  53. <select id="selectPage" resultType="com.dtb.portal.entity.VipGoodsData">
  54. select * from t_vpi_goods where 1=1
  55. <if test="name!=null and name!=''">
  56. and name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  57. </if>
  58. <if test="payMode!=null and payMode!=''">
  59. and pay_mode=#{payMode,jdbcType=VARCHAR}
  60. </if>
  61. <if test="privilege!=null and privilege!=''">
  62. and privilege=#{privilege,jdbcType=VARCHAR}
  63. </if>
  64. <if test="vipDate!=null and vipDate!=''">
  65. and vip_date=#{vipDate,jdbcType=VARCHAR}
  66. </if>
  67. <if test="vipDate!=null and vipDate!=''">
  68. and vip_money=#{vipMoney,jdbcType=VARCHAR}
  69. </if>
  70. order by create_time desc
  71. </select>
  72. <select id="selectByUserId" resultType="com.dtb.portal.entity.VipUserData">
  73. select *
  74. from t_vpi_user
  75. where user_id = #{userId,jdbcType=VARCHAR} and vip_goods_id=#{vipGoodsId}
  76. order by t_vpi_user.create_time desc limit 1
  77. </select>
  78. <insert id="insertVipUser">
  79. insert into t_vpi_user (id, user_id, vip_goods_id, vip_start_date, vip_end_date, vip_residue_date, create_time,
  80. update_time)
  81. values (#{id}, #{userId}, #{vipGoodsId}, #{vipStartDate}, #{vipEndDate}, #{vipResidueDate}, #{createTime},
  82. #{updateTime})
  83. </insert>
  84. <delete id="deleteVipUser">
  85. delete
  86. from t_vpi_user
  87. where id = #{id}
  88. </delete>
  89. <insert id="insertVipOrderData">
  90. insert into t_vip_order(id, out_trade_no, vip_goods_id, user_id, openid, status, create_time, update_time)
  91. values (#{id}, #{outTradeNo}, #{vipGoodsId}, #{userId}, #{openid}, #{status}, #{createTime}, #{updateTime})
  92. </insert>
  93. <select id="selectByOutTradeNo" resultType="com.dtb.portal.entity.VipOrderData">
  94. select *
  95. from t_vip_order
  96. where out_trade_no = #{outTradeNo}
  97. </select>
  98. <update id="updateVipOrderData">
  99. update t_vip_order
  100. <set>
  101. <if test="status!=null and status!=''">
  102. status=#{status,jdbcType=VARCHAR},
  103. </if>
  104. <if test="updateTime!=null">
  105. update_time=#{updateTime,jdbcType=VARCHAR},
  106. </if>
  107. </set>
  108. where id=#{id,jdbcType=VARCHAR}
  109. </update>
  110. </mapper>