zhwl/zhwl-business/zhwl-eatery/target/classes/mapper/eatery/ZdyEateryShopInfoMapper.xml

265 lines
10 KiB
XML
Raw Permalink Normal View History

2025-07-01 17:54:58 +08:00
<?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.ZdyEateryShopInfoMapper">
<resultMap type="ZdyEateryShopInfo" id="ZdyEateryShopInfoResult">
<result property="id" column="id"/>
<result property="shopName" column="shop_name"/>
<result property="shopPhone" column="shop_phone"/>
<result property="beginTime" column="begin_time"/>
<result property="endTime" column="end_time"/>
<result property="productIds" column="product_ids"/>
<result property="shopAddress" column="shop_address"/>
<result property="shopCuisine" column="shop_cuisine"/>
<result property="averageConsumption" column="average_consumption"/>
<result property="lng" column="lng"/>
<result property="lat" column="lat"/>
<result property="doorImage" column="door_image"/>
<result property="environmentImage" column="environment_image"/>
<result property="status" column="status"/>
<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"/>
<result property="isRecommend" column="is_recommend"/>
<result property="storeId" column="store_id"/>
<result property="registerAuditStatus" column="register_audit_status"/>
</resultMap>
<sql id="selectZdyEateryShopInfoVo">
select ea.id,
ea.product_ids,
ea.shop_cuisine,
ea.average_consumption,
ea.is_recommend,
ea.store_id,
sbi.name shop_name,
sbi.contact_phone shop_phone,
sbi.business_start_hours begin_time,
sbi.business_end_hours end_time,
sbi.address shop_address,
sbi.longitude lng,
sbi.latitude lat,
sbi.images door_image,
sbi.carousel_image environment_image,
sbi.grounding_status status,
sbi.register_audit_status register_audit_status,
sbi.create_by,
sbi.create_time,
sbi.update_by,
sbi.update_time,
sbi.remark,
sbi.dept_id merchant_id
from zdy_eatery_shop_info ea
inner join zdy_store_base_info sbi on sbi.id = ea.store_id
</sql>
<select id="selectZdyEateryShopInfoList" parameterType="ZdyEateryShopInfo" resultMap="ZdyEateryShopInfoResult">
<include refid="selectZdyEateryShopInfoVo"/>
left join sys_dept d on sbi.dept_id = d.dept_id
<where>
<if test="registerAuditStatus != null and registerAuditStatus != ''">
and sbi.register_audit_status = #{registerAuditStatus}
</if>
<if test="shopName != null and shopName != ''">
and sbi.name like concat('%', #{shopName}, '%')
</if>
<choose>
<when test="statusArray != null and statusArray.length != 0">
and sbi.grounding_status in
<foreach item="status" collection="statusArray" open="(" separator="," close=")">
#{status}
</foreach>
</when>
<otherwise>
<if test="status != null and status != ''">
and sbi.grounding_status = #{status}
</if>
</otherwise>
</choose>
<if test="ids != null and ids.size() != 0">
and ea.id in
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
</if>
${params.dataScope}
</where>
</select>
<select id="selectZdyEateryShopInfoListApp" parameterType="ZdyEateryShopInfo" resultMap="ZdyEateryShopInfoResult">
<include refid="selectZdyEateryShopInfoVo"/>
<where>
sbi.del_flag = 0
<if test="shopName != null and shopName != ''">
and sbi.name like concat('%', #{shopName}, '%')
</if>
<if test="merchantId != null ">
and sbi.dept_id = #{merchantId}
</if>
<if test="isRecommend != null and isRecommend != ''">
and ea.is_recommend = #{isRecommend}
</if>
<if test="status!= null and status != ''">
and sbi.grounding_status = #{status}
</if>
<if test="registerAuditStatus!= null and registerAuditStatus != ''">
and sbi.register_audit_status = #{registerAuditStatus}
</if>
</where>
</select>
<select id="selectZdyEateryShopInfoById" parameterType="Long"
resultMap="ZdyEateryShopInfoResult">
<include refid="selectZdyEateryShopInfoVo"/>
where ea.id = #{id}
</select>
<insert id="insertZdyEateryShopInfo" parameterType="ZdyEateryShopInfo" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_eatery_shop_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="storeId != null">
id,
</if>
<if test="productIds != null">product_ids,
</if>
<if test="shopCuisine != null">shop_cuisine,
</if>
<if test="averageConsumption != null">average_consumption,
</if>
<if test="isRecommend != null">is_recommend,
</if>
<if test="storeId != null">
store_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="storeId != null">#{storeId},
</if>
<if test="productIds != null">#{productIds},
</if>
<if test="shopCuisine != null">#{shopCuisine},
</if>
<if test="averageConsumption != null">#{averageConsumption},
</if>
<if test="isRecommend != null">#{isRecommend},
</if>
<if test="storeId != null">
#{storeId},
</if>
</trim>
</insert>
<update id="updateZdyEateryShopInfo" parameterType="ZdyEateryShopInfo">
update zdy_eatery_shop_info
<trim prefix="SET" suffixOverrides=",">
<if test="productIds != null">product_ids =
#{productIds},
</if>
<if test="shopCuisine != null">shop_cuisine =
#{shopCuisine},
</if>
<if test="averageConsumption != null">average_consumption =
#{averageConsumption},
</if>
<if test="isRecommend != null">is_recommend =
#{isRecommend},
</if>
<if test="storeId != null">
store_id = #{storeId},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyEateryShopInfoById" parameterType="Long">
delete
from zdy_eatery_shop_info
where id = #{id}
</delete>
<delete id="deleteZdyEateryShopInfoByIds" parameterType="String">
delete from zdy_eatery_shop_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="countByShopName" resultType="int">
select count(1)
from zdy_eatery_shop_info esi
inner join zdy_store_base_info sbi on esi.store_id = sbi.id
where sbi.name = #{shopName}
</select>
<select id="selectZdyEateryShopInfoByIds" resultMap="ZdyEateryShopInfoResult">
<include refid="selectZdyEateryShopInfoVo"/>
<where>
<if test="ids != null and ids.size() != 0">
and ea.id in
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</where>
</select>
<select id="getByMerchantId" parameterType="Long" resultMap="ZdyEateryShopInfoResult">
<include refid="selectZdyEateryShopInfoVo"/>
where sbi.dept_id = #{deptId}
</select>
<update id="updateStoreInfoByStoreId" parameterType="ZdyEateryShopInfo">
update zdy_eatery_shop_info
<trim prefix="SET" suffixOverrides=",">
<if test="productIds != null">product_ids =
#{productIds},
</if>
<if test="shopCuisine != null">shop_cuisine =
#{shopCuisine},
</if>
<if test="averageConsumption != null">average_consumption =
#{averageConsumption},
</if>
<if test="isRecommend != null">is_recommend =
#{isRecommend},
</if>
<if test="storeId != null">
store_id = #{storeId}
</if>
</trim>
where store_id = #{storeId}
</update>
<select id="getByStoreId" parameterType="Long" resultMap="ZdyEateryShopInfoResult">
<include refid="selectZdyEateryShopInfoVo"/>
where store_id = #{storeId}
</select>
<select id="selectBaseList" resultType="java.util.Map">
SELECT
b.id,
b.name as shopName,
b.contact_name as contactName,
b.contact_phone as shopPhone,
b.business_start_hours as beginTime,
b.business_end_hours as endTime,
b.address as address,
b.longitude as lng,
b.latitude as lat,
b.images as image,
b.legal_person_name as legalPersonName,
b.legal_person_phone as legalPersonPhone,
b.business_license as businessLicense
FROM
zdy_eatery_shop_info e
LEFT JOIN zdy_store_base_info b on e.store_id=b.id where !ISNULL(b.id)
</select>
</mapper>