ShopRoomOrderMapper.xml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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.huijy.management.mapper.ShopRoomOrderMapper">
  6. <resultMap type="ShopRoomOrder" id="ShopRoomOrderResult">
  7. <result property="id" column="id"/>
  8. <result property="roomId" column="room_id"/>
  9. <result property="memberId" column="member_id"/>
  10. <result property="name" column="name"/>
  11. <result property="phone" column="phone"/>
  12. <result property="card" column="card"/>
  13. <result property="min" column="min"/>
  14. <result property="state" column="state"/>
  15. <result property="max" column="max"/>
  16. <result property="createTime" column="create_time"/>
  17. <result property="days" column="days"/>
  18. <result property="shopId" column="shopId"/>
  19. <result property="shopName" column="shopName"/>
  20. <result property="bossPhone" column="bossPhone"/>
  21. <result property="openid" column="openid"/>
  22. <association property="shopRoom" javaType="ShopRoom" resultMap="ShopRoomResult"/>
  23. </resultMap>
  24. <resultMap type="shopRoom" id="ShopRoomResult">
  25. <result property="title" column="title"/>
  26. <result property="price" column="price"/>
  27. <result property="pic" column="pic"/>
  28. <result property="nums" column="nums"/>
  29. </resultMap>
  30. <sql id="selectShopRoomOrderVo">
  31. select id, room_id, member_id, name, phone, card, day, state, create_time from tb_shop_room_order
  32. </sql>
  33. <select id="selectShopRoomOrderList" parameterType="ShopRoomOrder" resultMap="ShopRoomOrderResult">
  34. <include refid="selectShopRoomOrderVo"/>
  35. <where>
  36. <if test="roomId != null ">and room_id = #{roomId}</if>
  37. <if test="memberId != null ">and member_id = #{memberId}</if>
  38. <if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
  39. </where>
  40. </select>
  41. <select id="selectShopRoomOrderById" parameterType="Long" resultMap="ShopRoomOrderResult">
  42. <include refid="selectShopRoomOrderVo"/>
  43. where id = #{id}
  44. </select>
  45. <select id="selectShopRoomOrder" resultMap="ShopRoomOrderResult">
  46. SELECT o.*,r.title,r.pic,r.price,s.name AS shopName,s.shop_id AS shopId,s.boss_phone AS bossPhone FROM
  47. tb_shop_room_order o
  48. LEFT JOIN tb_shop_room r ON r.id=o.room_id
  49. LEFT JOIN t_shop s ON s.shop_id=r.shop_id
  50. <if test="role =='member'">WHERE o.member_id=#{memberId}</if>
  51. <if test="role =='sale'">WHERE s.member_id=#{memberId}</if>
  52. <if test="state != null ">AND o.state = #{state}</if>
  53. ORDER BY create_time DESC
  54. </select>
  55. <insert id="insertShopRoomOrder" parameterType="ShopRoomOrder" useGeneratedKeys="true" keyProperty="id">
  56. insert into tb_shop_room_order
  57. <trim prefix="(" suffix=")" suffixOverrides=",">
  58. <if test="roomId != null">room_id,</if>
  59. <if test="memberId != null">member_id,</if>
  60. <if test="name != null">name,</if>
  61. <if test="phone != null">phone,</if>
  62. <if test="card != null">card,</if>
  63. <if test="min != null">min,</if>
  64. <if test="state != null">state,</if>
  65. <if test="max != null">max,</if>
  66. <if test="createTime != null">create_time,</if>
  67. <if test="days != null">days,</if>
  68. <if test="openid != null">openid,</if>
  69. </trim>
  70. <trim prefix="values (" suffix=")" suffixOverrides=",">
  71. <if test="roomId != null">#{roomId},</if>
  72. <if test="memberId != null">#{memberId},</if>
  73. <if test="name != null">#{name},</if>
  74. <if test="phone != null">#{phone},</if>
  75. <if test="card != null">#{card},</if>
  76. <if test="min != null">#{min},</if>
  77. <if test="state != null">#{state},</if>
  78. <if test="max != null">#{max},</if>
  79. <if test="createTime != null">#{createTime},</if>
  80. <if test="days != null">#{days},</if>
  81. <if test="openid != null">#{openid},</if>
  82. </trim>
  83. </insert>
  84. <update id="updateShopRoomOrder" parameterType="ShopRoomOrder">
  85. update tb_shop_room_order
  86. <trim prefix="SET" suffixOverrides=",">
  87. <if test="roomId != null">room_id = #{roomId},</if>
  88. <if test="memberId != null">member_id = #{memberId},</if>
  89. <if test="name != null">name = #{name},</if>
  90. <if test="phone != null">phone = #{phone},</if>
  91. <if test="card != null">card = #{card},</if>
  92. <if test="min != null">min = #{min},</if>
  93. <if test="state != null">state = #{state},</if>
  94. <if test="max != null">max = #{max},</if>
  95. <if test="createTime != null">create_time = #{createTime},</if>
  96. <if test="days != null">days = #{days},</if>
  97. <if test="openid != null">openid = #{openid},</if>
  98. </trim>
  99. where id = #{id}
  100. </update>
  101. <delete id="deleteShopRoomOrderById" parameterType="Long">
  102. delete from tb_shop_room_order where id = #{id}
  103. </delete>
  104. <delete id="deleteShopRoomOrderByIds" parameterType="String">
  105. delete from tb_shop_room_order where id in
  106. <foreach item="id" collection="array" open="(" separator="," close=")">
  107. #{id}
  108. </foreach>
  109. </delete>
  110. </mapper>