Files
wx-cashier-service/src/main/resources/mapper/TbShopInfoMapper.xml
2024-10-24 13:26:18 +08:00

162 lines
8.9 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.chaozhanggui.system.cashierservice.dao.TbShopInfoMapper">
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbShopInfo" id="BaseResultMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="account" column="account" jdbcType="VARCHAR"/>
<result property="shopCode" column="shop_code" jdbcType="VARCHAR"/>
<result property="subTitle" column="sub_title" jdbcType="VARCHAR"/>
<result property="merchantId" column="merchant_id" jdbcType="VARCHAR"/>
<result property="shopName" column="shop_name" jdbcType="VARCHAR"/>
<result property="chainName" column="chain_name" jdbcType="VARCHAR"/>
<result property="backImg" column="back_img" jdbcType="VARCHAR"/>
<result property="frontImg" column="front_img" jdbcType="VARCHAR"/>
<result property="contactName" column="contact_name" jdbcType="VARCHAR"/>
<result property="phone" column="phone" jdbcType="VARCHAR"/>
<result property="logo" column="logo" jdbcType="VARCHAR"/>
<result property="isDeposit" column="is_deposit" jdbcType="INTEGER"/>
<result property="isSupply" column="is_supply" jdbcType="INTEGER"/>
<result property="coverImg" column="cover_img" jdbcType="VARCHAR"/>
<result property="shareImg" column="share_img" jdbcType="VARCHAR"/>
<result property="view" column="view" jdbcType="VARCHAR"/>
<result property="detail" column="detail" jdbcType="VARCHAR"/>
<result property="lat" column="lat" jdbcType="VARCHAR"/>
<result property="lng" column="lng" jdbcType="VARCHAR"/>
<result property="mchId" column="mch_id" jdbcType="VARCHAR"/>
<result property="registerType" column="register_type" jdbcType="VARCHAR"/>
<result property="isWxMaIndependent" column="is_wx_ma_independent" jdbcType="INTEGER"/>
<result property="address" column="address" jdbcType="VARCHAR"/>
<result property="city" column="city" jdbcType="VARCHAR"/>
<result property="type" column="type" jdbcType="VARCHAR"/>
<result property="industry" column="industry" jdbcType="VARCHAR"/>
<result property="industryName" column="industry_name" jdbcType="VARCHAR"/>
<result property="businessStartDay" column="business_start_day" jdbcType="VARCHAR"/>
<result property="businessEndDay" column="business_end_day" jdbcType="VARCHAR"/>
<result property="businessTime" column="business_time" jdbcType="VARCHAR"/>
<result property="postTime" column="post_time" jdbcType="VARCHAR"/>
<result property="postAmountLine" column="post_amount_line" jdbcType="NUMERIC"/>
<result property="onSale" column="on_sale" jdbcType="INTEGER"/>
<result property="settleType" column="settle_type" jdbcType="INTEGER"/>
<result property="settleTime" column="settle_time" jdbcType="VARCHAR"/>
<result property="enterAt" column="enter_at" jdbcType="INTEGER"/>
<result property="expireAt" column="expire_at" jdbcType="INTEGER"/>
<result property="status" column="status" jdbcType="INTEGER"/>
<result property="average" column="average" jdbcType="VARCHAR"/>
<result property="orderWaitPayMinute" column="order_wait_pay_minute" jdbcType="INTEGER"/>
<result property="supportDeviceNumber" column="support_device_number" jdbcType="INTEGER"/>
<result property="distributeLevel" column="distribute_level" jdbcType="INTEGER"/>
<result property="createdAt" column="created_at" jdbcType="INTEGER"/>
<result property="updatedAt" column="updated_at" jdbcType="INTEGER"/>
<result property="proxyId" column="proxy_id" jdbcType="VARCHAR"/>
<result property="profiles" column="profiles" jdbcType="VARCHAR"/>
<result property="shopQrcode" column="shop_qrcode" jdbcType="VARCHAR"/>
<result property="tag" column="tag" jdbcType="VARCHAR"/>
<result property="isOpenYhq" column="is_open_yhq" jdbcType="VARCHAR"/>
<result property="isUseVip" column="is_use_vip" jdbcType="INTEGER"/>
<result property="provinces" column="provinces" jdbcType="VARCHAR"/>
<result property="cities" column="cities" jdbcType="VARCHAR"/>
<result property="districts" column="districts" jdbcType="VARCHAR"/>
<result property="isCustom" column="is_custom" jdbcType="VARCHAR"/>
<result property="isReturn" column="is_return" jdbcType="VARCHAR"/>
<result property="isMemberIn" column="is_member_in" jdbcType="VARCHAR"/>
<result property="isMemberReturn" column="is_member_return" jdbcType="VARCHAR"/>
<result property="isTableFee" column="is_table_fee" jdbcType="INTEGER"/>
<result property="isMemberPrice" column="is_member_price" jdbcType="INTEGER"/>
<result property="consumeColony" column="consume_colony" jdbcType="VARCHAR"/>
<result property="tableFee" column="table_fee" jdbcType="NUMERIC"/>
<result property="eatModel" column="eat_model" jdbcType="VARCHAR"/>
<result property="smallQrcode" column="small_qrcode" jdbcType="VARCHAR"/>
<result property="paymentQrcode" column="payment_qrcode" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id
, account, shop_code, sub_title, merchant_id, shop_name, chain_name, back_img, front_img, contact_name, phone, logo, is_deposit, is_supply, cover_img, share_img, view, detail, lat, lng, mch_id, register_type, is_wx_ma_independent, address, city, type, industry, industry_name, business_start_day, business_end_day, business_time, post_time, post_amount_line, on_sale, settle_type, settle_time, enter_at, expire_at, status, average, order_wait_pay_minute, support_device_number, distribute_level, created_at, updated_at, proxy_id, profiles, shop_qrcode, tag, is_open_yhq, is_use_vip, provinces, cities, districts, is_custom, is_return, is_member_in, is_member_return, is_table_fee, is_member_price, consume_colony, table_fee, eat_model, small_qrcode, payment_qrcode </sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tb_shop_info
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selNumByChain" resultType="java.lang.Integer">
select
count(1)
from tb_shop_info
where chain_name = #{chainName}
</select>
<select id="selShopInfoByGps" resultType="com.chaozhanggui.system.cashierservice.entity.vo.SubShopVo">
SELECT
*
FROM
tb_shop_info as info
<where>
info.status=1
AND (info.cities =#{cities} or info.districts =#{cities})
<if test="rightTopLng != null and rightTopLng != '' and leftBottomLng != null and leftBottomLng != ''">
AND info.lng BETWEEN #{leftBottomLng} AND #{rightTopLng}
AND info.lat BETWEEN #{leftBottomLat} AND #{rightTopLat}
</if>
<if test="shopName != null and shopName != ''">
AND shop_name = #{shopName}
</if>
</where>
ORDER BY (ABS(info.lat - #{lat}) + ABS(info.lng - #{lng})) ASC
</select>
<select id="selectByQrCode" resultMap="BaseResultMap">
SELECT i.*
FROM tb_shop_table t
LEFT JOIN tb_shop_info i ON t.shop_id = i.id
where t.qrcode = #{qrcode}
</select>
<select id="selectByPhone" resultMap="BaseResultMap">
select *
from tb_shop_info
where account = #{phone}
</select>
<select id="selectShopInfo" resultType="com.chaozhanggui.system.cashierservice.entity.vo.HomeVO">
SELECT shop.shop_name shopName,
product.`name` productName,
product.cover_img image,
product.id productId
FROM tb_shop_info shop
LEFT JOIN tb_product product ON shop.id = product.shop_id
WHERE product.is_hot = 1
Limit #{page}
, #{size}
</select>
<select id="searchUserDutyDetail" resultType="com.chaozhanggui.system.cashierservice.entity.vo.UserDutyVo">
SELECT
sum( num ),
product_id
FROM
tb_shop_user_duty_detail
WHERE
product_id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
GROUP BY
product_id
</select>
<select id="selectByIds" resultType="com.chaozhanggui.system.cashierservice.entity.TbShopInfo">
select
<include refid="Base_Column_List"/>
from tb_shop_info
where id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
</mapper>