Просмотр исходного кода

[业态查询修复][新增]:业态查询修复

release_toaliyun_real
Stormeye.Wu 7 лет назад
Родитель
Сommit
6d79d4ddde
2 измененных файлов: 254 добавлений и 287 удалений
  1. +5
    -15
      mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml
  2. +249
    -272
      mallinkService/src/main/resources/mapper/WxCouponMapper.xml

+ 5
- 15
mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml Просмотреть файл

@@ -27,71 +27,61 @@

<if test=" null != id ">
and `id` = #{id}

</if>

<if test=" null != tenantId ">
and `tenant_id` like concat('%', #{tenantId},'%')

</if>

<if test=" null != merchantId ">
and `merchant_id` = #{merchantId}

</if>

<if test=" null != couponId ">
and `coupon_id` = #{couponId}

</if>


<if test=" null != type ">
and `type` = #{type}

</if>

<if test=" null != title ">
and `title` like concat('%', #{title},'%')

</if>

<if test=" null != targetAd ">
and `target_ad` = #{targetAd}

</if>

<if test=" null != business ">
and `business` like concat('%', #{business},'%')
<if test=" null != business and '0' == business">
and JSON_CONTAINS(`business`->'$',JSON_ARRAY('0'))
</if>
<if test=" null != business and '0' != business">
and (JSON_CONTAINS(`business`->'$',JSON_ARRAY('0')) or (JSON_CONTAINS(`business`->'$',JSON_ARRAY(#{business}))))
</if>

<if test=" null != beginTime ">
and `begin_time` = #{beginTime}

</if>

<if test=" null != endTime ">
and `end_time` = #{endTime}

</if>

<if test=" null != status ">
and `status` = #{status}

</if>

<if test=" null != createDate ">
and `create_date` = #{createDate}

</if>

<if test=" null != updateDate ">
and `update_date` = #{updateDate}

</if>
<if test=" null != subTargetId ">
and `sub_target_id` = #{subTargetId}

</if>
<if test=" null != ids ">
and id in


+ 249
- 272
mallinkService/src/main/resources/mapper/WxCouponMapper.xml Просмотреть файл

@@ -1,238 +1,214 @@
<?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.simple.mapper.WxCouponMapper">
<resultMap id="BaseResultMap" type="com.simple.domain.po.WxCoupon">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
<result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
<result column="type" jdbcType="INTEGER" property="type" />
<result column="cover_img" jdbcType="VARCHAR" property="coverImg" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="sub_title" jdbcType="VARCHAR" property="subTitle" />
<result column="sale_price" jdbcType="INTEGER" property="salePrice" />
<result column="use_price" jdbcType="INTEGER" property="usePrice" />
<result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity" />
<result column="target_ad" jdbcType="INTEGER" property="targetAd" />
<result column="send_type" jdbcType="INTEGER" property="sendType" />
<result column="valid_type" jdbcType="INTEGER" property="validType" />
<result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate" />
<result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate" />
<result column="valid_days" jdbcType="INTEGER" property="validDays" />
<result column="detail" jdbcType="VARCHAR" property="detail" />
<result column="price" jdbcType="INTEGER" property="price" />
<result column="unit" jdbcType="INTEGER" property="unit" />
<result column="remain_inventory" jdbcType="INTEGER" property="remainInventory" />
<result column="inventory" jdbcType="INTEGER" property="inventory" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
<result column="business" jdbcType="VARCHAR" property="business" />
</resultMap>
<sql id="allColumns">
<resultMap id="BaseResultMap" type="com.simple.domain.po.WxCoupon">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
<result column="type" jdbcType="INTEGER" property="type"/>
<result column="cover_img" jdbcType="VARCHAR" property="coverImg"/>
<result column="title" jdbcType="VARCHAR" property="title"/>
<result column="sub_title" jdbcType="VARCHAR" property="subTitle"/>
<result column="sale_price" jdbcType="INTEGER" property="salePrice"/>
<result column="use_price" jdbcType="INTEGER" property="usePrice"/>
<result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity"/>
<result column="target_ad" jdbcType="INTEGER" property="targetAd"/>
<result column="send_type" jdbcType="INTEGER" property="sendType"/>
<result column="valid_type" jdbcType="INTEGER" property="validType"/>
<result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate"/>
<result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate"/>
<result column="valid_days" jdbcType="INTEGER" property="validDays"/>
<result column="detail" jdbcType="VARCHAR" property="detail"/>
<result column="price" jdbcType="INTEGER" property="price"/>
<result column="unit" jdbcType="INTEGER" property="unit"/>
<result column="remain_inventory" jdbcType="INTEGER" property="remainInventory"/>
<result column="inventory" jdbcType="INTEGER" property="inventory"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="business" jdbcType="VARCHAR" property="business"/>
</resultMap>
<sql id="allColumns">
`id`,`tenant_id`,`merchant_id`,`type`,`cover_img`,`title`,`sub_title`,`sale_price`,`use_price`,`use_limit_quantity`,`target_ad`,`send_type`,`valid_type`,`valid_start_date`,`valid_end_date`,`valid_days`,`detail`,`price`,`unit`,`remain_inventory`,`inventory`,`remark`,`status`,`create_date`,`update_date`,`business`
</sql>

<sql id="dynamicWhereConditions">
where 1 = 1
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and `tenant_id` like concat('%', #{tenantId},'%')
</if>
<if test=" null != merchantId ">
and `merchant_id` = #{merchantId}
</if>
<if test=" null != type ">
and `type` = #{type}
</if>
<if test=" null != coverImg ">
and `cover_img` like concat('%', #{coverImg},'%')
</if>
<if test=" null != title ">
and `title` like concat('%', #{title},'%')
</if>
<if test=" null != subTitle ">
and `sub_title` like concat('%', #{subTitle},'%')
</if>
<if test=" null != salePrice ">
and `sale_price` = #{salePrice}
</if>
<if test=" null != usePrice ">
and `use_price` = #{usePrice}
</if>
<if test=" null != useLimitQuantity ">
and `use_limit_quantity` = #{useLimitQuantity}
</if>
<if test=" null != targetAd ">
and `target_ad` = #{targetAd}
</if>
<if test=" null != sendType ">
and `send_type` = #{sendType}
</if>

<if test=" null != validType ">
and `valid_type` = #{validType}
</if>
<if test=" null != validStartDate ">
and `valid_start_date` = #{validStartDate}
</if>
<if test=" null != validEndDate ">
and `valid_end_date` = #{validEndDate}
</if>
<if test=" null != validDays ">
and `valid_days` = #{validDays}
</if>
<if test=" null != detail ">
and `detail` like concat('%', #{detail},'%')
</if>
<if test=" null != price ">
and `price` = #{price}
</if>

<if test=" null != unit ">
and `unit` = #{unit}

</if>

<if test=" null != remainInventory ">
and `remain_inventory` = #{remainInventory}
</if>
<if test=" null != inventory ">
and `inventory` = #{inventory}
</if>
<if test=" null != remark ">
and `remark` like concat('%', #{remark},'%')
</if>
<if test=" null != status ">
and `status` = #{status}
</if>
<if test=" null != createDate ">
and `create_date` = #{createDate}
</if>
<if test=" null != updateDate ">
and `update_date` = #{updateDate}
</if>
<if test=" null != business ">
and `business` like concat('%', #{business},'%')
</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>
<sql id="dynamicWhereConditions">
where 1 = 1

<if test=" null != id ">
and `id` = #{id}
</if>

<if test=" null != tenantId ">
and `tenant_id` like concat('%', #{tenantId},'%')
</if>

<if test=" null != merchantId ">
and `merchant_id` = #{merchantId}
</if>

<if test=" null != type ">
and `type` = #{type}
</if>

<if test=" null != coverImg ">
and `cover_img` like concat('%', #{coverImg},'%')
</if>

<if test=" null != title ">
and `title` like concat('%', #{title},'%')
</if>

<if test=" null != subTitle ">
and `sub_title` like concat('%', #{subTitle},'%')
</if>

<if test=" null != salePrice ">
and `sale_price` = #{salePrice}
</if>

<if test=" null != usePrice ">
and `use_price` = #{usePrice}
</if>

<if test=" null != useLimitQuantity ">
and `use_limit_quantity` = #{useLimitQuantity}
</if>

<if test=" null != targetAd ">
and `target_ad` = #{targetAd}
</if>

<if test=" null != sendType ">
and `send_type` = #{sendType}
</if>


<if test=" null != validType ">
and `valid_type` = #{validType}
</if>

<if test=" null != validStartDate ">
and `valid_start_date` = #{validStartDate}
</if>

<if test=" null != validEndDate ">
and `valid_end_date` = #{validEndDate}
</if>

<if test=" null != validDays ">
and `valid_days` = #{validDays}
</if>

<if test=" null != detail ">
and `detail` like concat('%', #{detail},'%')
</if>

<if test=" null != price ">
and `price` = #{price}
</if>

<if test=" null != unit ">
and `unit` = #{unit}
</if>

<select id="findList" parameterType="com.simple.domain.po.WxCoupon" resultMap="BaseResultMap">
select <include refid="allColumns" /> from wx_coupon
<include refid="dynamicWhereConditions" />
</select>



<resultMap id="CUserResultMap" type="com.simple.domain.vo.WxCouponCVo">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="coupon_id" jdbcType="BIGINT" property="couponId" />
<result column="begin_time" jdbcType="TIMESTAMP" property="beginTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />


<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
<result column="merchant_id" jdbcType="BIGINT" property="merchantId" />
<result column="type" jdbcType="INTEGER" property="type" />
<result column="cover_img" jdbcType="VARCHAR" property="coverImg" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="sub_title" jdbcType="VARCHAR" property="subTitle" />
<result column="sale_price" jdbcType="INTEGER" property="salePrice" />
<result column="use_price" jdbcType="INTEGER" property="usePrice" />
<result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity" />
<result column="target_ad" jdbcType="INTEGER" property="targetAd" />
<result column="send_type" jdbcType="INTEGER" property="sendType" />
<result column="valid_type" jdbcType="INTEGER" property="validType" />
<result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate" />
<result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate" />
<result column="valid_days" jdbcType="INTEGER" property="validDays" />
<result column="detail" jdbcType="VARCHAR" property="detail" />
<result column="price" jdbcType="INTEGER" property="price" />
<result column="unit" jdbcType="INTEGER" property="unit" />
<result column="remain_inventory" jdbcType="INTEGER" property="remainInventory" />
<result column="inventory" jdbcType="INTEGER" property="inventory" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
<result column="business" jdbcType="VARCHAR" property="business" />

<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="addr" jdbcType="VARCHAR" property="addr"/>
<result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
<result column="building_name" jdbcType="VARCHAR" property="buildingName" />
<result column="floor_name" jdbcType="VARCHAR" property="floorName" />
<result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/>

</resultMap>

<sql id="allCUserColumns">
<if test=" null != remainInventory ">
and `remain_inventory` = #{remainInventory}
</if>

<if test=" null != inventory ">
and `inventory` = #{inventory}
</if>

<if test=" null != remark ">
and `remark` like concat('%', #{remark},'%')
</if>

<if test=" null != status ">
and `status` = #{status}
</if>

<if test=" null != createDate ">
and `create_date` = #{createDate}
</if>

<if test=" null != updateDate ">
and `update_date` = #{updateDate}
</if>

<if test=" null != business and '0' == business">
and JSON_CONTAINS(`business`->'$',JSON_ARRAY('0'))
</if>
<if test=" null != business and '0' != business">
and (JSON_CONTAINS(`business`->'$',JSON_ARRAY('0')) or (JSON_CONTAINS(`business`->'$',JSON_ARRAY(#{business}))))
</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.simple.domain.po.WxCoupon" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from wx_coupon
<include refid="dynamicWhereConditions"/>
</select>


<resultMap id="CUserResultMap" type="com.simple.domain.vo.WxCouponCVo">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="coupon_id" jdbcType="BIGINT" property="couponId"/>
<result column="begin_time" jdbcType="TIMESTAMP" property="beginTime"/>
<result column="end_time" jdbcType="TIMESTAMP" property="endTime"/>


<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
<result column="type" jdbcType="INTEGER" property="type"/>
<result column="cover_img" jdbcType="VARCHAR" property="coverImg"/>
<result column="title" jdbcType="VARCHAR" property="title"/>
<result column="sub_title" jdbcType="VARCHAR" property="subTitle"/>
<result column="sale_price" jdbcType="INTEGER" property="salePrice"/>
<result column="use_price" jdbcType="INTEGER" property="usePrice"/>
<result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity"/>
<result column="target_ad" jdbcType="INTEGER" property="targetAd"/>
<result column="send_type" jdbcType="INTEGER" property="sendType"/>
<result column="valid_type" jdbcType="INTEGER" property="validType"/>
<result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate"/>
<result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate"/>
<result column="valid_days" jdbcType="INTEGER" property="validDays"/>
<result column="detail" jdbcType="VARCHAR" property="detail"/>
<result column="price" jdbcType="INTEGER" property="price"/>
<result column="unit" jdbcType="INTEGER" property="unit"/>
<result column="remain_inventory" jdbcType="INTEGER" property="remainInventory"/>
<result column="inventory" jdbcType="INTEGER" property="inventory"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="business" jdbcType="VARCHAR" property="business"/>

<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="addr" jdbcType="VARCHAR" property="addr"/>
<result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
<result column="building_name" jdbcType="VARCHAR" property="buildingName"/>
<result column="floor_name" jdbcType="VARCHAR" property="floorName"/>
<result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/>

</resultMap>

<sql id="allCUserColumns">
c.tenant_id,c.merchant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_quantity,c.target_ad,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business,
m.img_url,m.name,m.link_phone,m.status,
s.addr,s.shop_number,s.baidu_poi,
@@ -241,57 +217,58 @@
</sql>


<select id="selectDetailForCUser" parameterType="com.simple.domain.po.WxCouponChannel" resultMap="CUserResultMap">
select <include refid="allCUserColumns" />
from wx_coupon_channel cc,
wx_coupon c,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 ms.shop_id = s.id
left join wx_mall_building mb on s.building = mb.id
left join wx_mall_floor mf on s.floor = mf.id
where c.merchant_id = m.id
and cc.coupon_id = c.id
<if test=" null != id ">
and cc.id = #{id}
</if>
<if test=" null != couponId ">
and c.id = #{couponId}
</if>
<if test=" null != tenantId ">
and c.tenant_id = #{tenantId}
</if>
<if test=" null != targetAd ">
and cc.target_ad = #{targetAd}
</if>
</select>
<sql id="allCUserColumns2">
<select id="selectDetailForCUser" parameterType="com.simple.domain.po.WxCouponChannel" resultMap="CUserResultMap">
select
<include refid="allCUserColumns"/>
from wx_coupon_channel cc,
wx_coupon c,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 ms.shop_id = s.id
left join wx_mall_building mb on s.building = mb.id
left join wx_mall_floor mf on s.floor = mf.id
where c.merchant_id = m.id
and cc.coupon_id = c.id
<if test=" null != id ">
and cc.id = #{id}
</if>
<if test=" null != couponId ">
and c.id = #{couponId}
</if>
<if test=" null != tenantId ">
and c.tenant_id = #{tenantId}
</if>
<if test=" null != targetAd ">
and cc.target_ad = #{targetAd}
</if>
</select>
<sql id="allCUserColumns2">
c.tenant_id,c.merchant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_quantity,c.target_ad,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business,
m.img_url,m.name,m.link_phone,m.status,
s.addr,s.shop_number,s.baidu_poi,
mb.building_name,mf.floor_name
</sql>
<select id="selectDetailForCUserC" parameterType="com.simple.domain.po.WxCoupon" resultMap="CUserResultMap">
select <include refid="allCUserColumns2" />
from
wx_coupon c,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 ms.shop_id = s.id
left join wx_mall_building mb on s.building = mb.id
left join wx_mall_floor mf on s.floor = mf.id
where c.merchant_id = m.id
<if test=" null != id ">
and c.id = #{id}
</if>
<if test=" null != tenantId ">
and c.tenant_id = #{tenantId}
</if>

</select>

<update id="reduceInventory">
<select id="selectDetailForCUserC" parameterType="com.simple.domain.po.WxCoupon" resultMap="CUserResultMap">
select
<include refid="allCUserColumns2"/>
from
wx_coupon c,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 ms.shop_id = s.id
left join wx_mall_building mb on s.building = mb.id
left join wx_mall_floor mf on s.floor = mf.id
where c.merchant_id = m.id
<if test=" null != id ">
and c.id = #{id}
</if>
<if test=" null != tenantId ">
and c.tenant_id = #{tenantId}
</if>

</select>

<update id="reduceInventory">
update wx_coupon SET remain_inventory = remain_inventory - #{number} where id = #{id} and remain_inventory>= #{number}
</update>



Загрузка…
Отмена
Сохранить