|
- <?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="img_url" jdbcType="VARCHAR" property="imgUrl"/>
- <result column="name" jdbcType="VARCHAR" property="name"/>
- <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="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="introduction" jdbcType="VARCHAR" property="introduction"/>
- <result column="action_desc" jdbcType="VARCHAR" property="actionDesc"/>
- <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"/>
-
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`img_url`,`name`,`link_phone`,`create_date`,`update_date`,`car_vendor_type`,`car_params`,`status`,`link_person`,
- `business_id`,`sub_business_id`,`shop_type`,`brand`,`type`,`is_public`,email,`title`,`cover_picture`,`is_admin`,`bill_setting`,`qr_code`,
- `introduction`,`action_desc`,`is_del`,
- `talk_user_main`,`talk_user_aux`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where is_del = 0
-
- <if test=" null != id ">
- and `id` = #{id}
- </if>
-
- <if test=" null != tenantId ">
- and `tenant_id` = #{tenantId}
- </if>
-
- <if test=" null != imgUrl ">
- and `img_url` like concat('%', #{imgUrl},'%')
- </if>
-
- <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 != createDate ">
- and `create_date` = #{createDate}
- </if>
-
- <if test=" null != updateDate ">
- and `update_date` = #{updateDate}
- </if>
-
- <if test=" null != carVendorType ">
- and `car_vendor_type` = #{carVendorType}
- </if>
-
- <if test=" null != businessId ">
- and `business_id` = #{businessId}
- </if>
-
- <if test=" null != subBusinessId ">
- and `sub_business_id` = #{subBusinessId}
- </if>
-
- <if test=" null != carParams ">
- and `car_params` like concat('%', #{carParams},'%')
- </if>
- <if test=" null != status ">
- and `status` = #{status}
- </if>
- <if test=" null != linkPerson ">
- and `link_person` = #{linkPerson}
- </if>
- <if test=" null != type ">
- and `type` = #{type}
- </if>
- <if test=" null != isPublic ">
- and `is_public` = #{isPublic}
- </if>
- <if test=" null != email ">
- and `email` = #{email}
- </if>
- <if test=" null != isAdmin ">
- and `is_admin` = #{isAdmin}
- </if>
- <if test=" null != isDel ">
- and `is_del` = #{isDel}
- </if>
- <if test=" null != brand ">
- and `brand` = #{brand}
- </if>
- <if test=" null != rentShopType ">
- and id not in(
- select merchant_id from wx_rent_contract where tenant_id=#{tenantId} and rent_shop_type=1 and merchant_id is
- not null and status in(1,2,3,4)
- )
- </if>
- <if test=" null != ids ">
- and id in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
- <if test=" null != sortColumns">order by ${sortColumns}</if>
- </sql>
-
- <select id="findList" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_merchant
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <sql id="allMerchantVoColumns">
- m.id,m.img_url,m.name,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
- </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 m.`tenant_id` = #{tenantId}
- </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="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"/>
-
- <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.vo.WxMerchantVo" resultMap="MerchantVoResultMap">
- select
- <include refid="allMerchantVoColumns"/>
- FROM wx_merchant m
- left join wx_business bu on bu.id = m.business_id
- where 1=1
- <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;
- </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_business b on(m.business_id = b.id)
- where f.id = #{id}
- and m.tenant_id = #{tenantId}
- group by m.business_id
- </select>
-
- <select id="hasMerchant" parameterType="com.iformall.domain.po.WxMerchant" resultType="int">
- select count(*) from wx_merchant where tenant_id = #{tenantId} and `name`=#{name} and status=#{status}
- <if test=" null != id">
- and `id` != #{id}
- </if>
- </select>
-
- </mapper>
|