123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.huijy.management.mapper.ShopRoomOrderMapper">
- <resultMap type="ShopRoomOrder" id="ShopRoomOrderResult">
- <result property="id" column="id"/>
- <result property="roomId" column="room_id"/>
- <result property="memberId" column="member_id"/>
- <result property="name" column="name"/>
- <result property="phone" column="phone"/>
- <result property="card" column="card"/>
- <result property="min" column="min"/>
- <result property="state" column="state"/>
- <result property="max" column="max"/>
- <result property="createTime" column="create_time"/>
- <result property="days" column="days"/>
- <result property="shopId" column="shopId"/>
- <result property="shopName" column="shopName"/>
- <result property="bossPhone" column="bossPhone"/>
- <result property="openid" column="openid"/>
- <association property="shopRoom" javaType="ShopRoom" resultMap="ShopRoomResult"/>
- </resultMap>
- <resultMap type="shopRoom" id="ShopRoomResult">
- <result property="title" column="title"/>
- <result property="price" column="price"/>
- <result property="pic" column="pic"/>
- <result property="nums" column="nums"/>
- </resultMap>
- <sql id="selectShopRoomOrderVo">
- select id, room_id, member_id, name, phone, card, day, state, create_time from tb_shop_room_order
- </sql>
- <select id="selectShopRoomOrderList" parameterType="ShopRoomOrder" resultMap="ShopRoomOrderResult">
- <include refid="selectShopRoomOrderVo"/>
- <where>
- <if test="roomId != null ">and room_id = #{roomId}</if>
- <if test="memberId != null ">and member_id = #{memberId}</if>
- <if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
- </where>
- </select>
- <select id="selectShopRoomOrderById" parameterType="Long" resultMap="ShopRoomOrderResult">
- <include refid="selectShopRoomOrderVo"/>
- where id = #{id}
- </select>
- <select id="selectShopRoomOrder" resultMap="ShopRoomOrderResult">
- SELECT o.*,r.title,r.pic,r.price,s.name AS shopName,s.shop_id AS shopId,s.boss_phone AS bossPhone FROM
- tb_shop_room_order o
- LEFT JOIN tb_shop_room r ON r.id=o.room_id
- LEFT JOIN t_shop s ON s.shop_id=r.shop_id
- <if test="role =='member'">WHERE o.member_id=#{memberId}</if>
- <if test="role =='sale'">WHERE s.member_id=#{memberId}</if>
- <if test="state != null ">AND o.state = #{state}</if>
- ORDER BY create_time DESC
- </select>
- <insert id="insertShopRoomOrder" parameterType="ShopRoomOrder" useGeneratedKeys="true" keyProperty="id">
- insert into tb_shop_room_order
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="roomId != null">room_id,</if>
- <if test="memberId != null">member_id,</if>
- <if test="name != null">name,</if>
- <if test="phone != null">phone,</if>
- <if test="card != null">card,</if>
- <if test="min != null">min,</if>
- <if test="state != null">state,</if>
- <if test="max != null">max,</if>
- <if test="createTime != null">create_time,</if>
- <if test="days != null">days,</if>
- <if test="openid != null">openid,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="roomId != null">#{roomId},</if>
- <if test="memberId != null">#{memberId},</if>
- <if test="name != null">#{name},</if>
- <if test="phone != null">#{phone},</if>
- <if test="card != null">#{card},</if>
- <if test="min != null">#{min},</if>
- <if test="state != null">#{state},</if>
- <if test="max != null">#{max},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="days != null">#{days},</if>
- <if test="openid != null">#{openid},</if>
- </trim>
- </insert>
- <update id="updateShopRoomOrder" parameterType="ShopRoomOrder">
- update tb_shop_room_order
- <trim prefix="SET" suffixOverrides=",">
- <if test="roomId != null">room_id = #{roomId},</if>
- <if test="memberId != null">member_id = #{memberId},</if>
- <if test="name != null">name = #{name},</if>
- <if test="phone != null">phone = #{phone},</if>
- <if test="card != null">card = #{card},</if>
- <if test="min != null">min = #{min},</if>
- <if test="state != null">state = #{state},</if>
- <if test="max != null">max = #{max},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="days != null">days = #{days},</if>
- <if test="openid != null">openid = #{openid},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteShopRoomOrderById" parameterType="Long">
- delete from tb_shop_room_order where id = #{id}
- </delete>
- <delete id="deleteShopRoomOrderByIds" parameterType="String">
- delete from tb_shop_room_order where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|