|
- <?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.iformall.mapper.WxMerchantMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxMerchant">
- <id column="id" jdbcType="BIGINT" property="id"/>
- <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
- <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
- <result column="img_url" jdbcType="VARCHAR" property="imgUrl"/>
- <result column="name" jdbcType="VARCHAR" property="name"/>
- <result column="encode" jdbcType="VARCHAR" property="encode"/>
- <result column="link_phone" jdbcType="VARCHAR" property="linkPhone"/>
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
- <result column="car_vendor_type" jdbcType="INTEGER" property="carVendorType"/>
- <result column="car_params" jdbcType="VARCHAR" property="carParams"/>
- <result column="status" jdbcType="INTEGER" property="status"/>
- <result column="link_person" jdbcType="VARCHAR" property="linkPerson"/>
- <result column="business_id" jdbcType="INTEGER" property="businessId"/>
- <result column="business_types" jdbcType="VARCHAR" property="businessTypes"/>
-
- <result column="sub_business_id" jdbcType="INTEGER" property="subBusinessId"/>
- <result column="shop_type" jdbcType="INTEGER" property="shopType"/>
- <result column="brand" jdbcType="VARCHAR" property="brand"/>
- <result column="type" jdbcType="SMALLINT" property="type"/>
- <result column="is_public" jdbcType="SMALLINT" property="isPublic"/>
- <result column="email" jdbcType="VARCHAR" property="email"/>
- <result column="title" jdbcType="VARCHAR" property="title"/>
- <result column="cover_picture" jdbcType="VARCHAR" property="coverPicture"/>
- <result column="is_admin" jdbcType="INTEGER" property="isAdmin"/>
- <result column="bill_setting" jdbcType="INTEGER" property="billSetting"/>
- <result column="qr_code" jdbcType="VARCHAR" property="qrCode"/>
- <result column="tt_qr_code" jdbcType="VARCHAR" property="ttQrCode"/>
- <result column="introduction" jdbcType="VARCHAR" property="introduction"/>
- <result column="action_desc" jdbcType="VARCHAR" property="actionDesc"/>
- <result column="mark" jdbcType="INTEGER" property="mark"/>
- <result column="mark_time" jdbcType="TIMESTAMP" property="markTime"/>
-
- <result column="is_del" jdbcType="INTEGER" property="isDel"/>
- <result column="talk_user_main" jdbcType="VARCHAR" property="talkUserMain"/>
- <result column="talk_user_aux" jdbcType="VARCHAR" property="talkUserAux"/>
- <result column="link_line_phone" property="linkLinePhone"/>
- <result column="rental_start_date" property="rentalStartDate"/>
- <result column="rental_end_date" property="rentalEndDate"/>
- <result column="credit_locked" property="creditLocked"/>
- <result column="entry_amount" jdbcType="INTEGER" property="entryAmount"/>
- <result column="cash_out_number" jdbcType="INTEGER" property="cashOutNumber"/>
- <result column="cash_out_count" jdbcType="INTEGER" property="cashOutCount"/>
- <result column="cash_out_last_time" jdbcType="TIMESTAMP" property="cashOutLastTime"/>
- </resultMap>
-
- <sql id="allColumns">
- m.`id`,m.`tenant_id`,m.`parent_tenant_id`,m.`img_url`,m.`name`,m.`encode`,m.`link_phone`,m.`create_date`,m.`update_date`,m.`car_vendor_type`,m.`car_params`,m.`status`,m.`link_person`,
- m.`business_id`,m.`business_types`,m.`sub_business_id`,m.`shop_type`,m.`brand`,m.`type`,m.`is_public`,m.email,m.`title`,m.`cover_picture`,m.`is_admin`,m.`bill_setting`,m.`qr_code`,m.`tt_qr_code`,
- m.`introduction`,m.`action_desc`,m.`mark`,m.mark_time,m.`is_del`,m.`talk_user_main`,m.`talk_user_aux`,m.link_line_phone,m.credit_locked,m.credit_locked,m.entry_amount,m.cash_out_count,m.cash_out_last_time
- </sql>
-
- <sql id="allColumnsVo">
- m.`id`,m.`tenant_id`,m.`parent_tenant_id`,m.`img_url`,m.`name`,m.`encode`,m.`link_phone`,m.`create_date`,m.`update_date`,m.`car_vendor_type`,m.`car_params`,m.`status`,m.`link_person`,
- m.`business_id`,m.`business_types`,m.`sub_business_id`,m.`shop_type`,m.`brand`,m.`type`,m.`is_public`,m.email,m.`title`,m.`cover_picture`,m.`is_admin`,m.`bill_setting`,m.`qr_code`,m.`tt_qr_code`,
- m.`introduction`,m.`action_desc`,m.`mark`,m.mark_time,m.`is_del`,m.`talk_user_main`,m.`talk_user_aux`,m.link_line_phone,r.rental_start_date,r.rental_end_date,m.entry_amount,m.cash_out_number,m.cash_out_count,m.cash_out_last_time
- </sql>
-
- <sql id="dynamicWhereConditions">
- where m.is_del = 0
-
- <if test=" null != id ">
- and m.`id` = #{id}
- </if>
-
- <if test=" null != tenantId and '' != tenantId">
- and m.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and m.`parent_tenant_id` = #{parentTenantId}
- </if>
-
- <if test=" null != imgUrl ">
- and m.`img_url` like concat('%', #{imgUrl},'%')
- </if>
-
- <if test=" null != encode and ''!=encode ">
- and m.`encode` like concat('%', #{encode},'%')
- </if>
-
- <if test=" null != name and ''!=name ">
- and m.`name` like concat('%', #{name},'%')
- </if>
-
- <if test=" null != linkPhone and ''!=linkPhone ">
- and m.`link_phone` like concat('%', #{linkPhone},'%')
- </if>
- <if test=" null != linkPerson and ''!=linkPerson ">
- and m.`link_person` like concat('%', #{linkPerson},'%')
- </if>
-
- <if test="starttime != null">
- and m.create_date >= #{starttime}
- </if>
- <if test="endtime != null">
- and m.create_date <= #{endtime}
- </if>
-
- <if test=" null != carVendorType ">
- and m.`car_vendor_type` = #{carVendorType}
- </if>
-
- <if test=" null != businessId ">
- and m.`business_id` = #{businessId}
- </if>
-
- <if test=" null != businessTypes ">
- and JSON_CONTAINS(m.business_types,JSON_OBJECT('id', #{businessTypes}))
- </if>
-
- <if test=" null != subBusinessId ">
- and m.`sub_business_id` = #{subBusinessId}
- </if>
-
- <if test=" null != carParams ">
- and m.`car_params` like concat('%', #{carParams},'%')
- </if>
- <if test=" null != status ">
- and m.`status` = #{status}
- </if>
-
- <if test=" null != type ">
- and m.`type` = #{type}
- </if>
- <if test=" null != isPublic ">
- and m.`is_public` = #{isPublic}
- </if>
- <if test=" null != email ">
- and m.`email` = #{email}
- </if>
- <if test=" null != isAdmin ">
- and m.`is_admin` = #{isAdmin}
- </if>
- <if test=" null != mark ">
- <if test="mark == 0" >
- and (m.`mark` is null or m.`mark` <> 1)
- </if>
- <if test="mark == 1" >
- and m.`mark` = 1
- </if>
- </if>
- <if test=" null != isDel ">
- and m.`is_del` = #{isDel}
- </if>
- <if test=" null != brand ">
- and m.`brand` = #{brand}
- </if>
- <if test=" null != creditLocked ">
- and m.`credit_locked` = #{creditLocked}
- </if>
- <if test=" null != rentShopType ">
- and m.id not in(
- select merchant_id from wx_rent_contract where rent_shop_type=1
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- and merchant_id is not null and status in(1,2,3,4)
- )
- </if>
-
- <if test=" null != ids ">
- and m.id in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
-
- <if test="(null != floorForRule and '' != floorForRule) or (null != businessForRule and '' != businessForRule)">
- and m.id in(
- select ms.merchant_id from (select merchant_id,shop_id from wx_merchant_shop where is_del=0) ms
- inner join wx_merchant m on ms.merchant_id = m.id
- inner join wx_shop s on s.id=ms.shop_id
- where s.is_del=0
- <if test=" null != tenantId and '' != tenantId">
- and m.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and m.`parent_tenant_id` = #{parentTenantId}
- </if>
- <if test=" null != businessForRule and '' != businessForRule ">
- and m.business_id in (${businessForRule})
- </if>
- <if test=" null != floorForRule and '' != floorForRule ">
- and s.`floor` in (${floorForRule})
- </if>
- )
- </if>
-
- <if test=" null != sortColumns">order by ${sortColumns}</if>
- </sql>
-
- <select id="findIdNameList" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap">
- select id,name
- from wx_merchant m
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="findList" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_merchant m
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="findIdList" parameterType="com.iformall.domain.po.WxMerchant" resultType="Long">
- select id
- from wx_merchant m
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="findListVo" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap">
- select
- <include refid="allColumnsVo"/>
- from wx_merchant m left join (select merchant_id,rental_start_date,rental_end_date from wx_rent_contract
- where 1=1
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- and status in(2,3,4)) r
- on m.id=r.merchant_id
- <include refid="dynamicWhereConditionsVo"/>
- <if test=" null != sortColumns">order by ${sortColumns}</if>
-
- </select>
-
- <select id="findListVo2" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap">
- select distinct m.* from wx_merchant m
- left join wx_merchant_b_user wmbu on wmbu.merchant_id = m.id
- <include refid="dynamicWhereConditionsVo"/>
-
- <if test=" null != phone and ''!=phone ">
- and wmbu.`phone` like concat('%', #{phone},'%')
- and wmbu.`status` = 0
- </if>
-
- <if test=" null != sortColumns">order by ${sortColumns}</if>
-
- </select>
-
- <select id="getMerchantByEncode" parameterType="String" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_merchant m where m.encode = #{encode}
- </select>
-
- <sql id="dataRule">
- <if test="(null != floorForRule and '' != floorForRule) or (null != businessForRule and '' != businessForRule)">
- and m.id in(
- select ms.merchant_id from (select merchant_id,shop_id from wx_merchant_shop where is_del=0) ms
- inner join wx_merchant m on ms.merchant_id = m.id
- inner join wx_shop s on s.id=ms.shop_id
- where s.is_del=0
- <if test=" null != tenantId and '' != tenantId">
- and m.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and m.`parent_tenant_id` = #{parentTenantId}
- </if>
- <if test=" null != businessForRule and '' != businessForRule ">
- and m.business_id in (${businessForRule})
- </if>
- <if test=" null != floorForRule and '' != floorForRule ">
- and s.`floor` in (${floorForRule})
- </if>
- )
- </if>
- </sql>
-
- <sql id="dynamicWhereConditionsVo">
- where m.is_del = 0
-
- <if test=" null != id ">
- and m.`id` = #{id}
- </if>
-
- <if test=" null != tenantId and '' != tenantId">
- and m.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and m.`parent_tenant_id` = #{parentTenantId}
- </if>
-
- <if test=" null != imgUrl ">
- and m.`img_url` like concat('%', #{imgUrl},'%')
- </if>
-
- <if test=" null != name and '' != name ">
- and m.`name` like concat('%', #{name},'%')
- </if>
-
- <if test=" null != encode and '' != encode ">
- and m.`encode` like concat('%', #{encode},'%')
- </if>
-
- <if test=" null != linkPhone and '' != linkPhone ">
- and m.`link_phone` like concat('%', #{linkPhone},'%')
- </if>
-
- <if test=" null != createDate ">
- and m.`create_date` = #{createDate}
- </if>
-
- <if test=" null != updateDate ">
- and m.`update_date` = #{updateDate}
- </if>
-
- <if test=" null != carVendorType ">
- and m.`car_vendor_type` = #{carVendorType}
- </if>
-
- <if test=" null != businessId ">
- and m.`business_id` = #{businessId}
- </if>
-
- <if test=" null != subBusinessId ">
- and m.`sub_business_id` = #{subBusinessId}
- </if>
-
- <if test=" null != carParams ">
- and m.`car_params` like concat('%', #{carParams},'%')
- </if>
- <if test=" null != status ">
- and m.`status` = #{status}
- </if>
- <if test=" null != linkPerson ">
- and m.`link_person` = #{linkPerson}
- </if>
- <if test=" null != type ">
- and m.`type` = #{type}
- </if>
- <if test=" null != isPublic ">
- and m.`is_public` = #{isPublic}
- </if>
- <if test=" null != email ">
- and m.`email` = #{email}
- </if>
- <if test=" null != isAdmin ">
- and m.`is_admin` = #{isAdmin}
- </if>
- <if test=" null != mark ">
- <if test="mark == 0" >
- and (m.`mark` is null or m.`mark` <> 1)
- </if>
- <if test="mark == 1" >
- and m.`mark` = 1
- </if>
- </if>
- <if test=" null != isDel ">
- and m.`is_del` = #{isDel}
- </if>
- <if test=" null != brand ">
- and m.`brand` = #{brand}
- </if>
- <if test=" null != rentShopType ">
- and m.id not in(
- select merchant_id from wx_rent_contract where rent_shop_type=1
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- and merchant_id is not null and status in(1,2,3,4,8)
- )
- </if>
- <if test=" null != ids ">
- and m.id in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
- <if test=" null != building or null != floor">
- and m.id in(
- select ms.merchant_id from (select merchant_id,shop_id from wx_merchant_shop where is_del=0) ms
- inner join wx_merchant m on ms.merchant_id = m.id
- inner join wx_shop s on s.id=ms.shop_id
- where s.is_del=0
- <if test=" null != building ">
- and s.`building`= #{building}
- </if>
- <if test=" null != floor">
- and s.`floor` = #{floor}
- </if>
- )
-
- </if>
- <include refid="dataRule"/>
-
-
- </sql>
-
-
- <sql id="allMerchantVoColumns">
- distinct m.id,m.img_url,m.name,m.encode,m.link_phone,m.status,m.business_id,
- m.is_public,m.email,m.title,m.cover_picture,m.sub_business_id,
- m.shop_type,m.introduction,m.action_desc,bu.title as business_name,m.link_line_phone,m.top_time
- </sql>
-
- <select id="getMerchantByCode" parameterType="java.util.Map" resultMap="MerchantVoResultMap">
- select
- <include refid="allMerchantVoColumns"/>
- FROM wx_merchant m
- left join wx_business bu on bu.id = m.business_id
- <where>
- <if test=" null != tenantId and '' != tenantId">
- and m.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and m.`parent_tenant_id` = #{parentTenantId}
- </if>
- <if test=" null != status ">
- and m.`status` = #{status}
- </if>
- <if test=" null != merchantCode ">
- and md5(m.`id`) = #{merchantCode}
- </if>
- </where>
- </select>
-
- <resultMap id="MerchantVoResultMap" type="com.iformall.domain.vo.WxMerchantVo">
- <id column="id" jdbcType="BIGINT" property="id"/>
- <result column="img_url" jdbcType="VARCHAR" property="merchantImgUrl"/>
- <result column="name" jdbcType="VARCHAR" property="merchantName"/>
- <result column="encode" jdbcType="VARCHAR" property="merchantEncode"/>
- <result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone"/>
- <result column="status" jdbcType="VARCHAR" property="merchantStatus"/>
- <result column="business_id" jdbcType="INTEGER" property="businessId"/>
- <result column="sub_business_id" jdbcType="INTEGER" property="subBusinessId"/>
- <result column="is_public" jdbcType="INTEGER" property="isPublic"/>
- <result column="email" jdbcType="VARCHAR" property="email"/>
- <result column="title" jdbcType="VARCHAR" property="title"/>
- <result column="cover_picture" jdbcType="VARCHAR" property="coverPicture"/>
- <result column="shop_type" jdbcType="VARCHAR" property="shopType"/>
-
- <result column="brand_name" jdbcType="VARCHAR" property="brandName"/>
- <result column="brand_img" jdbcType="VARCHAR" property="brandImg"/>
- <result column="summary" jdbcType="VARCHAR" property="summary"/>
-
- <result column="business_name" jdbcType="VARCHAR" property="businessName"/>
-
- <result column="introduction" jdbcType="VARCHAR" property="introduction"/>
- <result column="action_desc" jdbcType="VARCHAR" property="actionDesc"/>
- <result column="link_line_phone" property="linkLinePhone"/>
- <result column="top_time" property="topTime"/>
-
- <collection column="{merchantId=id}" property="shopVoList"
- ofType="com.iformall.domain.vo.WxShopVo"
- javaType="java.util.List"
- select="com.iformall.mapper.WxShopMapper.findShopVoList">
- </collection>
-
- </resultMap>
-
- <select id="findListCVo" parameterType="com.iformall.domain.dto.WxMerchantDto" resultMap="MerchantVoResultMap">
- select
- <include refid="allMerchantVoColumns"/>
- FROM wx_merchant m
- <if test=" null != building or null != floor ">
- join wx_merchant_shop ms on ms.merchant_id=m.id
- join wx_shop s on ms.shop_id=s.id
- <if test=" null != building">
- and s.building = #{building}
- </if>
- <if test=" null != floor ">
- and s.floor = #{floor}
- </if>
- </if>
- left join wx_business bu on bu.id = m.business_id
- where 1=1 and m.is_del=0
- <if test=" null != tenantId and '' != tenantId">
- and m.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and m.`parent_tenant_id` = #{parentTenantId}
- </if>
- <if test=" null != merchantName and ''!=merchantName ">
- and m.`name` like concat('%', #{merchantName},'%')
- </if>
-
- <if test=" null != merchantLinkPhone and ''!=merchantLinkPhone ">
- and m.`link_phone` like concat('%', #{merchantLinkPhone},'%')
- </if>
-
- <if test=" null != businessId ">
- and m.`business_id` = #{businessId}
- </if>
-
- <if test=" null != subBusinessId ">
- and m.`sub_business_id` = #{subBusinessId}
- </if>
-
- <if test=" null != merchantStatus ">
- and m.`status` = #{merchantStatus}
- </if>
-
- <if test=" null != isPublic">
- and m.`is_public` = #{isPublic}
- </if>
-
- <if test=" null != id">
- and m.`id` = #{id}
- </if>
-
- order by m.top_time desc
- </select>
-
- <select id="queryMerchantByMerchantIdOfSharingReceiver" resultType="com.iformall.domain.po.WxMerchant"
- parameterType="com.iformall.domain.po.WxMerchant">
- select m.name,psr.id from wx_merchant m
- left join (select * from wx_profit_sharing_receiver where status=0) psr on m.id=psr.merchant_id
- where m.id=#{id}
- </select>
-
- <select id="findQrcodeEmptyList" resultMap="BaseResultMap">
- select * from wx_merchant where (qr_code is null or tt_qr_code is null);
- </select>
-
- <select id="findBusByFloorId" resultType="hashmap" parameterType="hashmap">
- select count(distinct m.id) count,b.id bid,b.`title` btitle from wx_merchant m
- left join wx_merchant_shop ms on(m.id = ms.merchant_id)
- left join wx_shop s on(ms.shop_id = s.id)
- left join wx_mall_floor f on(s.floor = f.id)
- left join wx_mall_building mb on(f.building_id = mb.id)
- left join wx_business b on(m.business_id = b.id)
- where 1=1
- <if test=" null != id">
- and f.id = #{id}
- </if>
- <if test=" null != buildingId">
- and mb.id = #{buildingId}
- </if>
- <if test=" null != tenantId and '' != tenantId">
- and m.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and m.`parent_tenant_id` = #{parentTenantId}
- </if>
- and s.is_del = 0
- and ms.is_del = 0
- and m.status = 1
- and m.is_del = 0
- group by m.business_id
- </select>
-
- <select id="hasMerchant" parameterType="com.iformall.domain.po.WxMerchant" resultType="int">
- select count(*) from wx_merchant where `name`=#{name} and status=#{status}
- <if test=" null != id">
- and `id` != #{id}
- </if>
- </select>
-
- <select id="hasMerchantEncode" parameterType="com.iformall.domain.po.WxMerchant" resultType="int">
- select count(*) from wx_merchant where `encode`=#{encode}
- <if test=" null != id">
- and `id` != #{id}
- </if>
- </select>
-
- <update id="updateCreditLocked" parameterType="com.iformall.domain.po.WxMerchant">
- update wx_merchant set credit_locked = #{creditLocked} where tenant_id = #{tenantId}
- </update>
-
- <select id="userTradeList" parameterType="com.iformall.domain.po.WxMerchant" resultType="com.iformall.domain.vo.WxMerchantTradeVo">
-
- SELECT m.id, m.`img_url` cover, m.`name` merchantName,m.`encode` merchantEncode, m.`link_person` linkName,
- ifnull(consume.consumeCount,0) consumeCount,ifnull(consume.consumeCountP,0) as consumeCountP,
- ifnull(consume.tradeAmt,0) tradeAmt
- FROM wx_merchant m
- left join (select count(co.c_user_id) AS consumeCountP,
- count(DISTINCT co.c_user_id) AS consumeCount,sum(co.coupon_price) AS tradeAmt, m.id as merchant_id from
- wx_coupon_order co
- left join (select m.id,mbu.id as b_user_id from wx_merchant m
- left join wx_merchant_b_user mbu on m.id=mbu.merchant_id where mbu.status=0) m
- on co.b_user_id=m.b_user_id
- WHERE co.coupon_order_status = 1
- <if test=" null != tenantId and '' != tenantId">
- and co.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and co.`parent_tenant_id` = #{parentTenantId}
- </if>
- <if test="starttime != null">
- and co.create_date >= #{starttime}
- </if>
- <if test="endtime != null">
- and co.create_date <= #{endtime}
- </if>
- group by m.id
- ) consume on consume.merchant_id=m.id
- where m.status=1
- <if test=" null != name and ''!=name ">
- and `name` like concat('%', #{name},'%')
- </if>
- <if test=" null != linkPhone and ''!=linkPhone ">
- and `link_phone` like concat('%', #{linkPhone},'%')
- </if>
- <if test=" null != linkPerson and ''!=linkPerson ">
- and `link_person` like concat('%', #{linkPerson},'%')
- </if>
-
- <if test=" null != sortColumns">order by ${sortColumns}</if>
- </select>
-
- <select id="userTradeDetailList" parameterType="com.iformall.domain.po.WxMerchant" resultType="com.iformall.domain.vo.WxMerchantTradeDetailVo">
- select cb.`name` 'userName',cb.`phone`,co.title couponName,co.`sale_price` couponSale ,co.price couponPrice,
- co.price tradeAmt,o.create_date tradeDate
- from wx_coupon_order o
- left join wx_coupon co on(o.`coupon_id`=co.id)
- left join wx_c_user_basic_info cb on o.c_user_id=cb.id
- where o.coupon_order_status=1
- <if test=" null != tenantId and '' != tenantId">
- and o.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and o.`parent_tenant_id` = #{parentTenantId}
- </if>
- <if test=" null != id ">
- and o.b_user_id in(
- select id from wx_merchant_b_user where status=0 and merchant_id=#{id}
- )
- </if>
-
- <if test=" null != userName and '' != userName ">
- and cb.`name` like concat('%', #{userName},'%')
- </if>
- <if test=" null != phone and '' != phone">
- and cb.`phone` like concat('%', #{phone},'%')
- </if>
- <if test=" null != couponName and '' != couponName">
- and co.`title` like concat('%', #{couponName},'%')
- </if>
- <if test="starttime != null">
- and o.create_date >= #{starttime}
- </if>
- <if test="endtime != null">
- and o.create_date <= #{endtime}
- </if>
- <if test=" null != sortColumns">order by ${sortColumns}</if>
- <if test=" null == sortColumns">order by o.create_date desc</if>
-
- </select>
-
- <select id="findByTrade" parameterType="java.util.Map" resultMap="BaseResultMap">
- select * from wx_merchant where id in(
- select merchant_id from wx_coupon_merchant where product_id=#{id}
- )limit 1
- </select>
-
-
- <select id="getMerchantList" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap">
- select * from wx_merchant where 1=1 and is_del=0 and status=1
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- order by create_date desc
- </select>
-
- <update id="increaseCash" parameterType="com.iformall.domain.po.WxMerchant">
- update wx_merchant set cash_out_number = cash_out_number+#{cashOutNumber} where id = #{id}
- </update>
-
- <update id="reduceCash" parameterType="com.iformall.domain.po.WxMerchant">
- update wx_merchant set cash_out_number = cash_out_number-#{cashOutNumber}, cash_out_count = cash_out_count+1,cash_out_last_time = now() where id = #{id}
- </update>
-
- <update id="increaseCashCount" parameterType="com.iformall.domain.po.WxMerchant">
- update wx_merchant set cash_out_count = cash_out_count+1 where id = #{id}
- </update>
-
- <update id="reSetCashCount" parameterType="com.iformall.domain.po.WxMerchant">
- update wx_merchant set cash_out_count = 0 where id = #{id}
- </update>
-
- <update id="recordedAmount" parameterType="com.iformall.domain.po.WxMerchant">
- update wx_merchant set
- entry_amount = ifnull(entry_amount,0)+#{entryAmount}
- /*,cash_out_number = ifnull(cash_out_number,0)+#{cashOutNumber}*/
- where id = #{id}
- </update>
-
-
- <select id="findMerchantByShop" parameterType="Long" resultType="hashmap">
- select
- m.`id`,m.`tenant_id`,m.`parent_tenant_id`,m.`img_url`,m.`name`,m.`encode`,m.`link_phone`,m.`create_date`,m.`update_date`,m.`car_vendor_type`,m.`car_params`,m.`status`,m.`link_person`,
- m.`business_id`,m.`business_types`,m.`sub_business_id`,m.`shop_type`,m.`brand`,m.`type`,m.`is_public`,m.email,m.`title`,m.`cover_picture`,m.`is_admin`,m.`bill_setting`,m.`qr_code`,m.`tt_qr_code`,
- m.`introduction`,m.`action_desc`,m.`mark`,m.mark_time,m.`is_del`,m.`talk_user_main`,m.`talk_user_aux`,m.link_line_phone,m.credit_locked,m.credit_locked,
- b.name brandName,bu.title businessTitle,mc.corp_papers_register_number corpPapersRegisterNumber,mc.corp_papers_address corpPapersAddress
- from wx_shop s
- left join wx_merchant_shop ms on ms.shop_id=s.id and ms.is_del=0
- left join wx_merchant m on ms.merchant_id=m.id
- left join wx_brand b on m.brand = b.id
- left join wx_business bu on m.business_id = bu.id
- left join wx_merchant_corp mc on mc.merchant_id = m.id
- where s.`id` = #{shopId}
- </select>
-
- <select id="detailByShopId" parameterType="hashmap" resultType="hashmap">
- select
- m.`id`,m.`tenant_id` tenantId,m.`parent_tenant_id` parentTenantId,m.`img_url`,m.`name`,m.`encode`,m.`link_phone`,m.`create_date`,m.`update_date`,
- m.`car_vendor_type`,m.`car_params`,m.`status`,m.`link_person`,
- m.`business_id`,m.`business_types`,m.`sub_business_id`,m.`shop_type`,m.`brand`,m.`type`,m.`is_public`,m.email,m.`title`,m.`cover_picture`,m.`is_admin`,m.`bill_setting`,m.`qr_code`,m.`tt_qr_code`,
- m.`introduction`,m.`action_desc`,m.`mark`,m.mark_time,m.`is_del`,m.`talk_user_main`,m.`talk_user_aux`,m.link_line_phone,m.credit_locked,m.credit_locked,
- b.name brandName,bu.title businessTitle,mc.corp_papers_register_number corpPapersRegisterNumber,mc.corp_papers_address corpPapersAddress
- from wx_merchant m
- left join wx_merchant_shop ms on ms.merchant_id = m.id and ms.is_del = 0
- left join wx_shop s on s.id = ms.shop_id
- left join wx_brand b on m.brand = b.id
- left join wx_business bu on m.business_id = bu.id
- left join wx_merchant_corp mc on mc.merchant_id = m.id
- where m.is_del = 0
- <if test=" null != tenantInfo.tenantId and '' != tenantInfo.tenantId">
- and m.`tenant_id` = #{tenantInfo.tenantId}
- </if>
- <if test=" null != tenantInfo.parentTenantId and '' != tenantInfo.parentTenantId">
- and m.`parent_tenant_id` = #{tenantInfo.parentTenantId}
- </if>
- and s.`id` = #{shopId}
- </select>
-
- </mapper>
|