|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444 |
- <?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="is_private" jdbcType="SMALLINT" property="isPrivate"/>
- <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.`is_private`,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="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=" null != createDate ">
- and m.`create_date` = #{createDate}
- </if>
-
- <if test=" null != updateDate ">
- and m.`update_date` = #{updateDate}
- </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 != businessForRule and '' != businessForRule ">
- and m.business_id in (${businessForRule}) and m.is_del=0
- </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 != isPrivate ">
- and m.`is_private` = #{isPrivate}
- </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 != ids ">
- and m.id in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
- <if test=" null != notInids ">
- and m.id not in
- <foreach collection="notInids" index="index" item="notInIdItem" open="(" separator="," close=")">
- #{notInIdItem}
- </foreach>
- </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="findByTenantIds" parameterType="java.util.Map" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_merchant m
- where m.is_del = 0
- and m.`status` = 1
- <if test=" null != tenantIds ">
- and m.tenant_id in
- <foreach collection="tenantIds" index="index" item="tenantId" open="(" separator="," close=")">
- #{tenantId}
- </foreach>
- </if>
- </select>
-
- <select id="findIdList" parameterType="com.iformall.domain.po.WxMerchant" resultType="Long">
- select id
- from wx_merchant m
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="getMerchantByEncode" parameterType="String" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_merchant m where m.encode = #{encode}
- </select>
-
- <select id="getMerchantByCode" parameterType="java.util.Map" resultMap="BaseResultMap">
- select <include refid="allColumns"/>
- FROM wx_merchant m where md5(m.`id`) = #{merchantCode}
- <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>
- </select>
-
- <select id="findListCVo" parameterType="com.iformall.domain.dto.WxMerchantDto" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- FROM wx_merchant m where 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 != isPrivate">
- and m.`is_private` = #{isPrivate}
- </if>
-
- <if test=" null != id">
- and m.`id` = #{id}
- </if>
-
- <if test=" null != ids ">
- and m.id in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
-
- order by m.top_time desc
- </select>
-
- <select id="findQrcodeEmptyList" resultMap="BaseResultMap">
- select <include refid="allColumns"/> from wx_merchant m where (m.qr_code is null or m.tt_qr_code is null);
- </select>
-
- <select id="findBusByFloorId" resultType="hashmap" parameterType="hashmap">
- select count(distinct m.id) count,m.business_id bid
- from wx_merchant m
- where m.status = 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 != ids ">
- and m.id in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
- group by m.business_id
- </select>
-
- <select id="hasMerchant" parameterType="com.iformall.domain.po.WxMerchant" resultType="int">
- select count(1) from wx_merchant where `name`=#{name}
- <if test=" null != status ">
- and `status` = #{status}
- </if>
- <if test=" null != id">
- and `id` != #{id}
- </if>
- </select>
-
- <select id="hasMerchantEncode" parameterType="com.iformall.domain.po.WxMerchant" resultType="int">
- select count(1) from wx_merchant where `encode`=#{encode}
- <if test=" null != status ">
- and `status` = #{status}
- </if>
- <if test=" null != id">
- and `id` != #{id}
- </if>
- </select>
-
- <select id="hasMerchantBrand" parameterType="com.iformall.domain.po.WxMerchant" resultType="int">
- select count(1) from wx_merchant where `brand`=#{brand}
- <if test=" null != status ">
- and `status` = #{status}
- </if>
- <if test=" null != id">
- and `id` != #{id}
- </if>
- </select>
-
- <select id="hasMerchantIsAdmin" parameterType="com.iformall.domain.po.WxMerchant" resultType="int">
- select count(1) from wx_merchant where `is_admin`=#{isAdmin}
- <if test=" null != status ">
- and `status` = #{status}
- </if>
- <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="userTradeMerchantList" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap">
- SELECT m.id, m.`img_url` , m.`name` ,m.`encode` , m.`link_person`
- FROM wx_merchant m
- 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="findByTrade" parameterType="java.util.Map" resultMap="BaseResultMap">
- select <include refid="allColumns"/> from wx_merchant m where
- m.id in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- limit 1
- </select>
-
-
- <select id="getMerchantList" parameterType="com.iformall.domain.po.WxMerchant" resultMap="BaseResultMap">
- select <include refid="allColumns"/>
- from wx_merchant m
- where m.is_del=0 and m.status=1
- <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 != isPrivate">
- and m.`is_private` = #{isPrivate}
- </if>
- order by m.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="findShopMerchant" 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.`is_private`,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
- from wx_merchant m where m.id = #{id}
- </select>
-
- <select id="detailShopMerchantById" 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.`is_private`,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
- from wx_merchant m where m.id = #{id} and 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>
- </select>
-
- <update id="deleteByUpdate" parameterType="Long">
- update wx_merchant set is_del = 1
- where id = #{id}
- </update>
-
- </mapper>
|