236 lines
9.3 KiB
XML
236 lines
9.3 KiB
XML
|
<?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.zhwl.eatery.mapper.ZdyEateryDishesAttributeMapper">
|
||
|
|
||
|
<resultMap type="ZdyEateryDishesAttribute" id="ZdyEateryDishesAttributeResult">
|
||
|
<result property="id" column="id"/>
|
||
|
<result property="type" column="type"/>
|
||
|
<result property="name" column="name"/>
|
||
|
<result property="priceMarkup" column="price_markup"/>
|
||
|
<result property="enable" column="enable"/>
|
||
|
<result property="sort" column="sort"/>
|
||
|
<result property="applicationScope" column="application_scope"/>
|
||
|
<result property="applicationScopeId" column="application_scope_id"/>
|
||
|
<result property="createBy" column="create_by"/>
|
||
|
<result property="createTime" column="create_time"/>
|
||
|
<result property="updateBy" column="update_by"/>
|
||
|
<result property="updateTime" column="update_time"/>
|
||
|
<result property="remark" column="remark"/>
|
||
|
<result property="merchantId" column="merchant_id"/>
|
||
|
</resultMap>
|
||
|
|
||
|
<sql id="selectZdyEateryDishesAttributeVo">
|
||
|
select epa.id, epa.type, epa.name, epa.price_markup, epa.enable, epa.sort, epa.application_scope,
|
||
|
epa.application_scope_id, epa.create_by, epa.create_time, epa.update_by, epa.update_time, epa.remark, epa.merchant_id
|
||
|
from zdy_eatery_product_attribute epa
|
||
|
left join sys_dept d on epa.merchant_id = d.dept_id
|
||
|
</sql>
|
||
|
|
||
|
<select id="selectZdyEateryDishesAttributeList" parameterType="ZdyEateryDishesAttribute"
|
||
|
resultMap="ZdyEateryDishesAttributeResult">
|
||
|
<include refid="selectZdyEateryDishesAttributeVo"/>
|
||
|
<where>
|
||
|
<if test="type != null and type != ''">
|
||
|
and type = #{type}
|
||
|
</if>
|
||
|
<if test="name != null and name != ''">
|
||
|
and name like concat('%', #{name}, '%')
|
||
|
</if>
|
||
|
<if test="enable != null and enable != ''">
|
||
|
and enable = #{enable}
|
||
|
</if>
|
||
|
<if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''">
|
||
|
and epa.create_time between #{params.beginTime} and #{params.endTime}
|
||
|
</if>
|
||
|
<if test="applicationScope != null ">
|
||
|
and application_scope = #{applicationScope}
|
||
|
</if>
|
||
|
<if test="applicationScopeId != null ">
|
||
|
and find_in_set(#{applicationScopeId},application_scope_id)
|
||
|
</if>
|
||
|
<if test="merchantId != null ">
|
||
|
and merchant_id = #{merchantId}
|
||
|
</if>
|
||
|
${params.dataScope}
|
||
|
</where>
|
||
|
order by sort
|
||
|
</select>
|
||
|
|
||
|
<select id="selectZdyEateryDishesAttributeListByProductId" resultMap="ZdyEateryDishesAttributeResult"
|
||
|
parameterType="java.lang.Long">
|
||
|
<include refid="selectZdyEateryDishesAttributeVo"/>
|
||
|
<where>
|
||
|
and ( FIND_IN_SET(#{id}, application_scope_id) OR application_scope = 'all' OR FIND_IN_SET((SELECT type FROM
|
||
|
zdy_eatery_product WHERE id = #{id}), application_scope_id) )
|
||
|
</where>
|
||
|
|
||
|
</select>
|
||
|
<select id="selectZdyEateryDishesAttributeById" parameterType="Long"
|
||
|
resultMap="ZdyEateryDishesAttributeResult">
|
||
|
<include refid="selectZdyEateryDishesAttributeVo"/>
|
||
|
where id = #{id}
|
||
|
</select>
|
||
|
|
||
|
<select id="listCanAll" resultMap="ZdyEateryDishesAttributeResult" parameterType="ZdyEateryDishesAttribute" >
|
||
|
<include refid="selectZdyEateryDishesAttributeVo"/>
|
||
|
<where>
|
||
|
<if test="type != null and type != ''">
|
||
|
and type = #{type}
|
||
|
</if>
|
||
|
<if test="enable != null and enable != ''">
|
||
|
and enable = #{enable}
|
||
|
</if>
|
||
|
${params.dataScope}
|
||
|
</where>
|
||
|
order by sort
|
||
|
</select>
|
||
|
<select id="selectZdyEateryDishesAttributeListAdded" resultMap="ZdyEateryDishesAttributeResult" parameterType="ZdyEateryDishesAttribute" >
|
||
|
<include refid="selectZdyEateryDishesAttributeVo"/>
|
||
|
<where>
|
||
|
and ( FIND_IN_SET(#{id}, application_scope_id) OR application_scope = 'all' OR FIND_IN_SET((SELECT type FROM
|
||
|
zdy_eatery_product WHERE id = #{id}), application_scope_id))
|
||
|
${params.dataScope}
|
||
|
</where>
|
||
|
order by sort
|
||
|
</select>
|
||
|
|
||
|
|
||
|
<insert id="insertZdyEateryDishesAttribute" parameterType="ZdyEateryDishesAttribute" useGeneratedKeys="true"
|
||
|
keyProperty="id">
|
||
|
insert into zdy_eatery_product_attribute
|
||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
<if test="type != null">type,
|
||
|
</if>
|
||
|
<if test="name != null">name,
|
||
|
</if>
|
||
|
<if test="priceMarkup != null">price_markup,
|
||
|
</if>
|
||
|
<if test="enable != null">enable,
|
||
|
</if>
|
||
|
<if test="applicationScope != null">application_scope,
|
||
|
</if>
|
||
|
<if test="applicationScopeId != null">application_scope_id,
|
||
|
</if>
|
||
|
<if test="createBy != null">create_by,
|
||
|
</if>
|
||
|
<if test="createTime != null">create_time,
|
||
|
</if>
|
||
|
<if test="updateBy != null">update_by,
|
||
|
</if>
|
||
|
<if test="updateTime != null">update_time,
|
||
|
</if>
|
||
|
<if test="remark != null">remark,
|
||
|
</if>
|
||
|
<if test="merchantId != null">merchant_id,
|
||
|
</if>
|
||
|
<if test="sort != null">sort,
|
||
|
</if>
|
||
|
</trim>
|
||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
<if test="type != null">#{type},
|
||
|
</if>
|
||
|
<if test="name != null">#{name},
|
||
|
</if>
|
||
|
<if test="priceMarkup != null">#{priceMarkup},
|
||
|
</if>
|
||
|
<if test="enable != null">#{enable},
|
||
|
</if>
|
||
|
<if test="applicationScope != null">#{applicationScope},
|
||
|
</if>
|
||
|
<if test="applicationScopeId != null">#{applicationScopeId},
|
||
|
</if>
|
||
|
<if test="createBy != null">#{createBy},
|
||
|
</if>
|
||
|
<if test="createTime != null">#{createTime},
|
||
|
</if>
|
||
|
<if test="updateBy != null">#{updateBy},
|
||
|
</if>
|
||
|
<if test="updateTime != null">#{updateTime},
|
||
|
</if>
|
||
|
<if test="remark != null">#{remark},
|
||
|
</if>
|
||
|
<if test="merchantId != null">#{merchantId},
|
||
|
</if>
|
||
|
<if test="sort != null">#{sort},
|
||
|
</if>
|
||
|
</trim>
|
||
|
</insert>
|
||
|
|
||
|
<update id="updateZdyEateryDishesAttribute" parameterType="ZdyEateryDishesAttribute">
|
||
|
update zdy_eatery_product_attribute
|
||
|
<trim prefix="SET" suffixOverrides=",">
|
||
|
<if test="type != null">type =
|
||
|
#{type},
|
||
|
</if>
|
||
|
<if test="name != null">name =
|
||
|
#{name},
|
||
|
</if>
|
||
|
<if test="priceMarkup != null">price_markup =
|
||
|
#{priceMarkup},
|
||
|
</if>
|
||
|
<if test="enable != null">enable =
|
||
|
#{enable},
|
||
|
</if>
|
||
|
<if test="applicationScope != null">application_scope =
|
||
|
#{applicationScope},
|
||
|
</if>
|
||
|
<if test="applicationScopeId != null">application_scope_id =
|
||
|
#{applicationScopeId},
|
||
|
</if>
|
||
|
<if test="createBy != null">create_by =
|
||
|
#{createBy},
|
||
|
</if>
|
||
|
<if test="createTime != null">create_time =
|
||
|
#{createTime},
|
||
|
</if>
|
||
|
<if test="updateBy != null">update_by =
|
||
|
#{updateBy},
|
||
|
</if>
|
||
|
<if test="updateTime != null">update_time =
|
||
|
#{updateTime},
|
||
|
</if>
|
||
|
<if test="remark != null">remark =
|
||
|
#{remark},
|
||
|
</if>
|
||
|
<if test="sort != null">sort =
|
||
|
#{sort},
|
||
|
</if>
|
||
|
</trim>
|
||
|
where id = #{id}
|
||
|
<if test="merchantId != null">
|
||
|
and merchant_id = #{merchantId}
|
||
|
</if>
|
||
|
</update>
|
||
|
|
||
|
<delete id="deleteZdyEateryDishesAttributeById" parameterType="Long">
|
||
|
delete from zdy_eatery_product_attribute where id = #{id}
|
||
|
<if test="merchantId != null">
|
||
|
and merchant_id = #{merchantId}
|
||
|
</if>
|
||
|
</delete>
|
||
|
|
||
|
<delete id="deleteZdyEateryDishesAttributeByIds" parameterType="String">
|
||
|
delete from zdy_eatery_product_attribute where id in
|
||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||
|
#{id}
|
||
|
</foreach>
|
||
|
</delete>
|
||
|
|
||
|
<select id="selectZdyEateryDishesAttributeListByRelationProductId" resultMap="ZdyEateryDishesAttributeResult">
|
||
|
select *
|
||
|
from zdy_eatery_product_attribute epa
|
||
|
inner join zdy_eatery_product_attribute_relation epar on epa.id = epar.product_attribute_id
|
||
|
where epar.product_id = #{productId}
|
||
|
</select>
|
||
|
|
||
|
|
||
|
<delete id="deleteByDeptIds" parameterType="long">
|
||
|
delete from zdy_eatery_product_attribute where merchant_id in
|
||
|
<foreach item="deptId" collection="deptIds" open="(" separator="," close=")">
|
||
|
#{deptId}
|
||
|
</foreach>
|
||
|
</delete>
|
||
|
</mapper>
|