|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <?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.WxMerchantShopMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxMerchantShop">
- <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="merchant_id" jdbcType="BIGINT" property="merchantId" />
- <result column="shop_id" jdbcType="BIGINT" property="shopId" />
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
- <result column="is_del" jdbcType="SMALLINT" property="isDel" />
-
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`parent_tenant_id`,`merchant_id`,`shop_id`,`create_date`,`update_date`,`is_del`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where 1 = 1
-
- <if test=" null != id ">
- and `id` = #{id}
-
- </if>
-
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
-
- <if test=" null != merchantId ">
- and `merchant_id` = #{merchantId}
-
- </if>
-
- <if test=" null != shopId ">
- and `shop_id` = #{shopId}
-
- </if>
-
- <if test=" null != createDate ">
- and `create_date` = #{createDate}
-
- </if>
-
- <if test=" null != updateDate ">
- and `update_date` = #{updateDate}
-
- </if>
-
- <if test=" null != isDel ">
- and `is_del` = #{isDel}
- </if>
- <if test=" null != ids ">
- and id in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
-
- <if test=" null != shopIdList ">
- and shop_id in
- <foreach collection="shopIdList" index="index" item="shopIdItem" open="(" separator="," close=")">
- #{shopIdItem}
- </foreach>
- </if>
-
- <if test=" null != merchantIds ">
- and merchant_id in
- <foreach collection="merchantIds" index="index" item="merchantIdItem" open="(" separator="," close=")">
- #{merchantIdItem}
- </foreach>
- </if>
-
- <if test=" null != sortColumns"> order by ${sortColumns} </if>
- </sql>
-
- <select id="findList" parameterType="com.iformall.domain.po.WxMerchantShop" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_merchant_shop
- <include refid="dynamicWhereConditions" />
- </select>
-
- <select id="findMerchantIdList" parameterType="com.iformall.domain.po.WxMerchantShop" resultType="Long">
- select distinct merchant_id
- from wx_merchant_shop
- <include refid="dynamicWhereConditions" />
- </select>
-
-
- <select id="findShopIds" parameterType="Long" resultType="Long">
- select shop_id from wx_merchant_shop where is_del = 0
-
- <if test=" null != merchantIds ">
- and merchant_id in
- <foreach collection="merchantIds" index="index" item="merchantIdItem" open="(" separator="," close=")">
- #{merchantIdItem}
- </foreach>
- </if>
- </select>
-
- <update id = "delShops" parameterType="java.util.Map">
- update wx_merchant_shop set is_del = 1 where merchant_id = #{merchantId}
- and shop_id in
- <foreach collection="shopList" index="index" item="shopItem" open="(" separator="," close=")">
- #{shopItem}
- </foreach>
- </update>
-
- <delete id="realDelByMerchantId" parameterType="java.util.Map">
- delete from wx_merchant_shop where merchant_id = #{merchantId} and shop_id in
- <foreach collection="shopList" index="index" item="shopItem" open="(" separator="," close=")">
- #{shopItem}
- </foreach>
- </delete>
-
- <select id="rentRateHistory" resultType="hashmap" parameterType="hashmap">
- select
- <if test="1 == dateType">
- DATE_FORMAT(w.create_date,'%Y/%m/%d') xTime
- </if>
- <if test="2 == dateType">
- DATE_FORMAT(w.create_date,'%Y/%m') xTime
- </if>
- ,count(distinct w.shop_id) xCount
- from wx_merchant_shop w
- where w.is_del=0
- <if test=" null != tenantId and '' != tenantId">
- and w.`tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and w.`parent_tenant_id` = #{parentTenantId}
- </if>
- <if test=" null != shopIds ">
- and w.shop_id in
- <foreach collection="shopIds" index="index" item="shopIdItem" open="(" separator="," close=")">
- #{shopIdItem}
- </foreach>
- </if>
- group by xTime
- order by xTime
- </select>
-
-
- </mapper>
|