<?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.ruoyi.system.mapper.ShopRecommendMapper"> <resultMap type="ShopRecommend" id="ShopRecommendResult"> <result property="id" column="id" /> <result property="shopId" column="shop_id" /> <result property="machineId" column="machine_id" /> <result property="goodsId" column="goods_id" /> <result property="goodsName" column="goods_name" /> <result property="pic" column="pic" /> <result property="turn" column="turn" /> <result property="desc" column="desc" /> <result property="type" column="type" /> <result property="state" column="state" /> <result property="recDate" column="rec_date" /> <result property="createdAt" column="created_at" /> <result property="updatedAt" column="updated_at" /> </resultMap> <sql id="selectShopRecommendVo"> select id, shop_id, machine_id, goods_id, goods_name, pic, turn, `desc`, type, state, rec_date, created_at, updated_at from shop_recommend </sql> <select id="selectShopRecommendList" parameterType="ShopRecommend" resultMap="ShopRecommendResult"> <include refid="selectShopRecommendVo"/> <where> <if test="shopId != null and shopId != ''"> and shop_id = #{shopId}</if> <if test="machineId != null "> and machine_id = #{machineId}</if> <if test="goodsId != null and goodsId != ''"> and goods_id = #{goodsId}</if> <if test="goodsName != null and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if> <if test="pic != null and pic != ''"> and pic = #{pic}</if> <if test="turn != null and turn != ''"> and turn = #{turn}</if> <if test="desc != null and desc != ''"> and `desc` = #{desc}</if> <if test="type != null and type != ''"> and type = #{type}</if> <if test="state != null and state != ''"> and state = #{state}</if> <if test="recDate != null "> and rec_date = #{recDate}</if> <if test="createdAt != null "> and created_at = #{createdAt}</if> <if test="updatedAt != null "> and updated_at = #{updatedAt}</if> </where> </select> <select id="selectShopRecommendById" parameterType="String" resultMap="ShopRecommendResult"> <include refid="selectShopRecommendVo"/> where id = #{id} </select> <insert id="insertShopRecommend" parameterType="ShopRecommend" useGeneratedKeys="true" keyProperty="id"> insert into shop_recommend <trim prefix="(" suffix=")" suffixOverrides=","> <if test="shopId != null and shopId != ''">shop_id,</if> <if test="machineId != null">machine_id,</if> <if test="goodsId != null and goodsId != ''">goods_id,</if> <if test="goodsName != null and goodsName != ''">goods_name,</if> <if test="pic != null and pic != ''">pic,</if> <if test="turn != null and turn != ''">turn,</if> <if test="desc != null and desc != ''">`desc`,</if> <if test="type != null and type != ''">type,</if> <if test="state != null and state != ''">state,</if> <if test="recDate != null">rec_date,</if> <if test="createdAt != null">created_at,</if> <if test="updatedAt != null">updated_at,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="shopId != null and shopId != ''">#{shopId},</if> <if test="machineId != null">#{machineId},</if> <if test="goodsId != null and goodsId != ''">#{goodsId},</if> <if test="goodsName != null and goodsName != ''">#{goodsName},</if> <if test="pic != null and pic != ''">#{pic},</if> <if test="turn != null and turn != ''">#{turn},</if> <if test="desc != null and desc != ''">#{desc},</if> <if test="type != null and type != ''">#{type},</if> <if test="state != null and state != ''">#{state},</if> <if test="recDate != null">#{recDate},</if> <if test="createdAt != null">#{createdAt},</if> <if test="updatedAt != null">#{updatedAt},</if> </trim> </insert> <update id="updateShopRecommend" parameterType="ShopRecommend"> update shop_recommend <trim prefix="SET" suffixOverrides=","> <if test="shopId != null and shopId != ''">shop_id = #{shopId},</if> <if test="machineId != null">machine_id = #{machineId},</if> <if test="goodsId != null and goodsId != ''">goods_id = #{goodsId},</if> <if test="goodsName != null and goodsName != ''">goods_name = #{goodsName},</if> <if test="pic != null and pic != ''">pic = #{pic},</if> <if test="turn != null and turn != ''">turn = #{turn},</if> <if test="desc != null and desc != ''">`desc` = #{desc},</if> <if test="type != null and type != ''">type = #{type},</if> <if test="state != null and state != ''">state = #{state},</if> <if test="recDate != null">rec_date = #{recDate},</if> <if test="updatedAt != null">updated_at = #{updatedAt},</if> </trim> where id = #{id} </update> <delete id="deleteShopRecommendById" parameterType="String"> delete from shop_recommend where id = #{id} </delete> <delete id="deleteShopRecommendByIds" parameterType="String"> delete from shop_recommend where id in <foreach item="id" collection="array" open="(" separator="," close=")"> #{id} </foreach> </delete> <select id="selectShopGoodsByTyepe" resultType="com.ruoyi.system.domain.vo.orderTaking.GoodsVo"> select g.id as goodsId , g.name as name, g.price as price, g.discount as discount, g.pics as pictures , g.spec as specString, g.`desc`, g.remarks from shop_recommend sr , goods g where sr.goods_id = g.id and sr.`type` = #{type} and sr.shop_id =#{shopId} and sr.state ='1' and g.is_deleted ='0' order by sr.turn </select> <select id="selectShopRecommendGoods" resultType="com.ruoyi.system.domain.Goods"> select g.id, g.name, g.category, g.price, g.discount, g.take_time, g.spec, g.pics, g.`desc`, g.remarks, g.code from shop s , shop_recommend sr, goods g where sr.shop_id = #{shopId} and type = #{type} and sr.shop_id = s.id and g.is_deleted = 0 and g.id = sr.goods_id order by sr.turn </select> </mapper>