| @@ -23,6 +23,7 @@ import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -65,7 +66,12 @@ public class WxCouponChannelController extends BaseController { | |||||
| wxCouponChannel.setStatus(null); | wxCouponChannel.setStatus(null); | ||||
| } | } | ||||
| wxCouponChannel.updateTenantInfo(getTenantInfo()); | wxCouponChannel.updateTenantInfo(getTenantInfo()); | ||||
| wxCouponChannel.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||||
| wxCouponChannel.setSortColumns(BaseEntity.SortField.CCUpdateDate_DESC); | |||||
| if(StringUtils.isNotBlank(wxCouponChannel.getSortColumn())){ | |||||
| wxCouponChannel.setSortColumn("cc."+wxCouponChannel.getSortColumn()); | |||||
| } | |||||
| final PageInfo<WxCouponChannelVo> page = wxCouponChannelService.listPageCVo(wxCouponChannel, pageNum, pageSize); | final PageInfo<WxCouponChannelVo> page = wxCouponChannelService.listPageCVo(wxCouponChannel, pageNum, pageSize); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @@ -25,6 +25,7 @@ import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.apache.commons.collections.CollectionUtils; | import org.apache.commons.collections.CollectionUtils; | ||||
| import org.apache.commons.collections.map.HashedMap; | import org.apache.commons.collections.map.HashedMap; | ||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -68,6 +69,9 @@ public class WxCouponController extends BaseController { | |||||
| if(null == wxCoupon.getSourceType()){ | if(null == wxCoupon.getSourceType()){ | ||||
| wxCoupon.setSourceType(EnumCouponSourceType.COUPONSource_Admin.getCode()); | wxCoupon.setSourceType(EnumCouponSourceType.COUPONSource_Admin.getCode()); | ||||
| } | } | ||||
| if(StringUtils.isNotBlank(wxCoupon.getSortColumn())){ | |||||
| wxCoupon.setSortColumn("c."+wxCoupon.getSortColumn()); | |||||
| } | |||||
| return wxCouponService.list(wxCoupon, pageNum, pageSize); //全列表 | return wxCouponService.list(wxCoupon, pageNum, pageSize); //全列表 | ||||
| } | } | ||||
| @@ -91,6 +95,9 @@ public class WxCouponController extends BaseController { | |||||
| EnumCouponType.COUPON_PRESS.getCode()}; | EnumCouponType.COUPON_PRESS.getCode()}; | ||||
| wxCoupon.setTypes(Arrays.asList(typeArray)); | wxCoupon.setTypes(Arrays.asList(typeArray)); | ||||
| if(StringUtils.isNotBlank(wxCoupon.getSortColumn())){ | |||||
| wxCoupon.setSortColumn("c."+wxCoupon.getSortColumn()); | |||||
| } | |||||
| return wxCouponService.list(wxCoupon, pageNum, pageSize); //全列表 | return wxCouponService.list(wxCoupon, pageNum, pageSize); //全列表 | ||||
| } | } | ||||
| @@ -54,7 +54,11 @@ public class MemCouponController extends BaseController { | |||||
| wxCouponChannel.updateTenantInfo(getTenantInfo()); | wxCouponChannel.updateTenantInfo(getTenantInfo()); | ||||
| wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_H5.getCode()); | wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_H5.getCode()); | ||||
| wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | ||||
| wxCouponChannel.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||||
| wxCouponChannel.setSortColumns(BaseEntity.SortField.CCUpdateDate_DESC); | |||||
| if(StringUtils.isNotBlank(wxCouponChannel.getSortColumn())){ | |||||
| wxCouponChannel.setSortColumn("cc."+wxCouponChannel.getSortColumn()); | |||||
| } | |||||
| final PageInfo<WxCouponChannelVo> page = couponChannelService.listPageCVo(wxCouponChannel, pageNum, pageSize); | final PageInfo<WxCouponChannelVo> page = couponChannelService.listPageCVo(wxCouponChannel, pageNum, pageSize); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @@ -19,6 +19,7 @@ import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -57,8 +58,13 @@ public class WxCouponChannelController extends BaseController { | |||||
| if (wxCouponChannel.getStatus() != null && wxCouponChannel.getStatus() == -1) { | if (wxCouponChannel.getStatus() != null && wxCouponChannel.getStatus() == -1) { | ||||
| wxCouponChannel.setStatus(null); | wxCouponChannel.setStatus(null); | ||||
| } | } | ||||
| wxCouponChannel.setMerchantId(getUser().getMerchantId()); | |||||
| wxCouponChannel.updateTenantInfo(getTenantInfo()); | wxCouponChannel.updateTenantInfo(getTenantInfo()); | ||||
| wxCouponChannel.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||||
| wxCouponChannel.setSortColumns(BaseEntity.SortField.CCUpdateDate_DESC); | |||||
| if(StringUtils.isNotBlank(wxCouponChannel.getSortColumn())){ | |||||
| wxCouponChannel.setSortColumn("cc."+wxCouponChannel.getSortColumn()); | |||||
| } | |||||
| final PageInfo<WxCouponChannelVo> page = wxCouponChannelService.listPageCVo(wxCouponChannel, pageNum, pageSize); | final PageInfo<WxCouponChannelVo> page = wxCouponChannelService.listPageCVo(wxCouponChannel, pageNum, pageSize); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.controller; | package com.iformall.controller; | ||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| @@ -7,6 +8,7 @@ import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.domain.po.WxCouponChannel; | import com.iformall.domain.po.WxCouponChannel; | ||||
| import com.iformall.domain.po.WxCouponPassword; | import com.iformall.domain.po.WxCouponPassword; | ||||
| import com.iformall.domain.po.WxMerchant; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.WxCouponStatisVo; | import com.iformall.domain.vo.WxCouponStatisVo; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| @@ -14,6 +16,7 @@ import com.iformall.mapper.WxCouponChannelMapper; | |||||
| import com.iformall.service.WxCouponPasswordService; | import com.iformall.service.WxCouponPasswordService; | ||||
| import com.iformall.service.WxCouponService; | import com.iformall.service.WxCouponService; | ||||
| import com.iformall.service.WxFlowService; | import com.iformall.service.WxFlowService; | ||||
| import com.iformall.service.WxMerchantService; | |||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| import com.iformall.utils.RedisLock; | import com.iformall.utils.RedisLock; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| @@ -22,6 +25,7 @@ import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.apache.commons.collections.CollectionUtils; | import org.apache.commons.collections.CollectionUtils; | ||||
| import org.apache.commons.collections.map.HashedMap; | import org.apache.commons.collections.map.HashedMap; | ||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -29,10 +33,7 @@ import org.springframework.web.bind.annotation.*; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.util.Arrays; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| import java.util.*; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("/api/coupon") | @RequestMapping("/api/coupon") | ||||
| @@ -49,6 +50,8 @@ public class WxCouponController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxFlowService wxFlowService; | private WxFlowService wxFlowService; | ||||
| @Autowired | @Autowired | ||||
| private WxMerchantService wxMerchantService; | |||||
| @Autowired | |||||
| RedisLock redisLock; | RedisLock redisLock; | ||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @@ -63,6 +66,12 @@ public class WxCouponController extends BaseController { | |||||
| if(null == wxCoupon.getSourceType()){ | if(null == wxCoupon.getSourceType()){ | ||||
| wxCoupon.setSourceType(EnumCouponSourceType.COUPONSource_Bapi.getCode()); | wxCoupon.setSourceType(EnumCouponSourceType.COUPONSource_Bapi.getCode()); | ||||
| } | } | ||||
| wxCoupon.setMerchantId(getUser().getMerchantId()); | |||||
| if(StringUtils.isNotBlank(wxCoupon.getSortColumn())){ | |||||
| wxCoupon.setSortColumn("c."+wxCoupon.getSortColumn()); | |||||
| } | |||||
| return wxCouponService.list(wxCoupon, pageNum, pageSize); //全列表 | return wxCouponService.list(wxCoupon, pageNum, pageSize); //全列表 | ||||
| } | } | ||||
| @@ -85,6 +94,10 @@ public class WxCouponController extends BaseController { | |||||
| EnumCouponType.COUPON_PRESS.getCode()}; | EnumCouponType.COUPON_PRESS.getCode()}; | ||||
| wxCoupon.setTypes(Arrays.asList(typeArray)); | wxCoupon.setTypes(Arrays.asList(typeArray)); | ||||
| wxCoupon.setMerchantId(getUser().getMerchantId()); | |||||
| if(StringUtils.isNotBlank(wxCoupon.getSortColumn())){ | |||||
| wxCoupon.setSortColumn("c."+wxCoupon.getSortColumn()); | |||||
| } | |||||
| return wxCouponService.list(wxCoupon, pageNum, pageSize); //全列表 | return wxCouponService.list(wxCoupon, pageNum, pageSize); //全列表 | ||||
| } | } | ||||
| @@ -98,6 +111,11 @@ public class WxCouponController extends BaseController { | |||||
| if(null == wxCoupon.getSourceType()){ | if(null == wxCoupon.getSourceType()){ | ||||
| wxCoupon.setSourceType(EnumCouponSourceType.COUPONSource_Bapi.getCode()); | wxCoupon.setSourceType(EnumCouponSourceType.COUPONSource_Bapi.getCode()); | ||||
| } | } | ||||
| List<WxMerchant> merchantList = new ArrayList<>(); | |||||
| WxMerchant wxMerchant = wxMerchantService.getById(getUser().getMerchantId()); | |||||
| merchantList.add(wxMerchant); | |||||
| wxCoupon.setMerchantParams(JSONObject.toJSONString(merchantList)); | |||||
| ResultData resultData = wxCouponService.saveOrUpdate(wxCoupon); | ResultData resultData = wxCouponService.saveOrUpdate(wxCoupon); | ||||
| if (resultData.code != 200) { | if (resultData.code != 200) { | ||||
| @@ -132,6 +150,12 @@ public class WxCouponController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| List<WxMerchant> merchantList = new ArrayList<>(); | |||||
| WxMerchant wxMerchant = wxMerchantService.getById(getUser().getMerchantId()); | |||||
| merchantList.add(wxMerchant); | |||||
| wxCoupon.setMerchantParams(JSONObject.toJSONString(merchantList)); | |||||
| WxCoupon coupon = wxCouponService.getById(wxCoupon.getId()); | WxCoupon coupon = wxCouponService.getById(wxCoupon.getId()); | ||||
| if (null == coupon) { | if (null == coupon) { | ||||
| return new ResultData(ResultData.ERROR, "券未查询到。"+wxCoupon.getId()); | return new ResultData(ResultData.ERROR, "券未查询到。"+wxCoupon.getId()); | ||||
| @@ -4,6 +4,7 @@ import java.util.Date; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| import org.apache.commons.collections.map.HashedMap; | import org.apache.commons.collections.map.HashedMap; | ||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -55,7 +56,11 @@ public class WxCouponChannelController extends BaseController { | |||||
| wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | ||||
| wxCouponChannel.setCouponStatus(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()); | wxCouponChannel.setCouponStatus(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()); | ||||
| wxCouponChannel.setSortColumns(BaseEntity.SortField.UpdateDate_DESC, BaseEntity.SortField.Id_DESC); | |||||
| wxCouponChannel.setSortColumns(BaseEntity.SortField.CCUpdateDate_DESC, BaseEntity.SortField.CCId_DESC); | |||||
| if(StringUtils.isNotBlank(wxCouponChannel.getSortColumn())){ | |||||
| wxCouponChannel.setSortColumn("cc."+wxCouponChannel.getSortColumn()); | |||||
| } | |||||
| PageInfo<WxCouponChannelVo> page = wxCouponChannelService.listPageCVo(wxCouponChannel, pageNum, pageSize); | PageInfo<WxCouponChannelVo> page = wxCouponChannelService.listPageCVo(wxCouponChannel, pageNum, pageSize); | ||||
| filterTimed(wxCouponChannel, page); | filterTimed(wxCouponChannel, page); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| @@ -145,6 +145,8 @@ public class WxCoupon extends TenantEntity { | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private String merchantParams; | private String merchantParams; | ||||
| @TableField(exist = false) | |||||
| private Long merchantId; | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| @io.swagger.annotations.ApiModelProperty(value="投放频道参数,用来过滤",name="targetAd") | @io.swagger.annotations.ApiModelProperty(value="投放频道参数,用来过滤",name="targetAd") | ||||
| @@ -134,9 +134,18 @@ public class BaseEntity implements Serializable { | |||||
| Id_ASC("`id` ASC"), | Id_ASC("`id` ASC"), | ||||
| Id_DESC("`id` DESC"), | Id_DESC("`id` DESC"), | ||||
| CId_ASC("c.`id` ASC"), | |||||
| CId_DESC("c.`id` DESC"), | |||||
| CCId_ASC("cc.`id` ASC"), | |||||
| CCId_DESC("cc.`id` DESC"), | |||||
| CreateDate_ASC("`create_date` ASC"), | CreateDate_ASC("`create_date` ASC"), | ||||
| CreateDate_DESC("`create_date` DESC"), | CreateDate_DESC("`create_date` DESC"), | ||||
| CCreateDate_ASC("c.`create_date` ASC"), | |||||
| CCreateDate_DESC("c.`create_date` DESC"), | |||||
| SId_ASC("s.`id` ASC"), | SId_ASC("s.`id` ASC"), | ||||
| SId_DESC("s.`id` DESC"), | SId_DESC("s.`id` DESC"), | ||||
| @@ -146,6 +155,9 @@ public class BaseEntity implements Serializable { | |||||
| UpdateDate_ASC("`update_date` ASC"), | UpdateDate_ASC("`update_date` ASC"), | ||||
| UpdateDate_DESC("`update_date` DESC"), | UpdateDate_DESC("`update_date` DESC"), | ||||
| CCUpdateDate_ASC("cc.`update_date` ASC"), | |||||
| CCUpdateDate_DESC("cc.`update_date` DESC"), | |||||
| Createtime_ASC("`createtime` ASC"), | Createtime_ASC("`createtime` ASC"), | ||||
| Createtime_DESC("`createtime` DESC"), | Createtime_DESC("`createtime` DESC"), | ||||
| @@ -85,7 +85,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| @Override | @Override | ||||
| public ResultData list(WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { | public ResultData list(WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { | ||||
| if (null == wxCoupon) wxCoupon = new WxCoupon(); | if (null == wxCoupon) wxCoupon = new WxCoupon(); | ||||
| wxCoupon.setSortColumns(BaseEntity.SortField.CreateDate_DESC, BaseEntity.SortField.Id_DESC); | |||||
| wxCoupon.setSortColumns(BaseEntity.SortField.CCreateDate_DESC, BaseEntity.SortField.CId_DESC); | |||||
| PageInfo<WxCoupon> page = null; | PageInfo<WxCoupon> page = null; | ||||
| if (wxCoupon.getStatus() != null && wxCoupon.getStatus() == -1) | if (wxCoupon.getStatus() != null && wxCoupon.getStatus() == -1) | ||||
| wxCoupon.setStatus(null); | wxCoupon.setStatus(null); | ||||
| @@ -21,7 +21,7 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| cc.`id`,cc.`tenant_id`,cc.`parent_tenant_id`,cc.`coupon_id`,cc.`coupon_status`,cc.`type`,cc.`title`,cc.`target_ad`,cc.`business`,cc.`sub_business`,cc.`begin_time`,cc.`end_time`,cc.`status`,cc.`create_date`,cc.`update_date`,cc.`sub_target_id`,cc.qr_code | |||||
| distinct cc.`id`,cc.`tenant_id`,cc.`parent_tenant_id`,cc.`coupon_id`,cc.`coupon_status`,cc.`type`,cc.`title`,cc.`target_ad`,cc.`business`,cc.`sub_business`,cc.`begin_time`,cc.`end_time`,cc.`status`,cc.`create_date`,cc.`update_date`,cc.`sub_target_id`,cc.qr_code | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -100,9 +100,11 @@ | |||||
| </if> | </if> | ||||
| <if test=" null != sourceType "> | <if test=" null != sourceType "> | ||||
| and `source_type` = #{sourceType} | |||||
| and c.`source_type` = #{sourceType} | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and cm.`merchant_id` = #{merchantId} | |||||
| </if> | </if> | ||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and cc.id in | and cc.id in | ||||
| @@ -150,7 +152,7 @@ | |||||
| <sql id="CouponChannelVoColumns"> | <sql id="CouponChannelVoColumns"> | ||||
| <include refid="allColumns" />, | <include refid="allColumns" />, | ||||
| c.remain_inventory,c.inventory,c.cover_img,c.title,c.sub_title,c.sale_price, | |||||
| c.remain_inventory,c.inventory,c.cover_img,c.sub_title,c.sale_price, | |||||
| c.use_price,c.price,c.unit,c.use_limit_quantity,c.send_type,c.support_transfer,c.press_limit_num,c.auto_refund,c.conditions, | c.use_price,c.price,c.unit,c.use_limit_quantity,c.send_type,c.support_transfer,c.press_limit_num,c.auto_refund,c.conditions, | ||||
| c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.credit_price,c.content_type,c.source_type | c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.credit_price,c.content_type,c.source_type | ||||
| </sql> | </sql> | ||||
| @@ -206,6 +208,7 @@ | |||||
| select <include refid="CouponChannelVoColumns" /> | select <include refid="CouponChannelVoColumns" /> | ||||
| from wx_coupon_channel cc | from wx_coupon_channel cc | ||||
| left join wx_coupon c on cc.coupon_id = c.id | left join wx_coupon c on cc.coupon_id = c.id | ||||
| left join wx_coupon_merchant cm on c.id = cm.product_id and cm.status = 0 | |||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| @@ -98,11 +98,12 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`parent_tenant_id`,`type`,`cover_img`,`cover_picture`,`detail_picture`,`title`,`sub_title`,`sale_price`,`use_price`,`use_limit_quantity`,`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`,`sub_business`,`support_transfer`,`subsidy_num`,`subsidy_type`, | |||||
| `press_limit_num`, `press_limit_hours`, `auto_refund`,`credit_price`,`credit_refund`,`put_apply_status`,`stock_apply_status`,`cancle_apply_status`, | |||||
| `conditions`,approval_type,content_type,source_type | |||||
| distinct c.`id`,c.`tenant_id`,c.`parent_tenant_id`,c.`type`,c.`cover_img`,c.`cover_picture`,c.`detail_picture`, | |||||
| c.`title`,c.`sub_title`,c.`sale_price`,c.`use_price`,c.`use_limit_quantity`,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`,c.`sub_business`,c.`support_transfer`,c.`subsidy_num`,c.`subsidy_type`, | |||||
| c.`press_limit_num`, c.`press_limit_hours`, c.`auto_refund`,c.`credit_price`,c.`credit_refund`,c.`put_apply_status`,c.`stock_apply_status`,c.`cancle_apply_status`, | |||||
| c.`conditions`,c.approval_type,c.content_type,c.source_type | |||||
| </sql> | </sql> | ||||
| <sql id="statusColumns"> | <sql id="statusColumns"> | ||||
| @@ -294,7 +295,7 @@ | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | <select id="findList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | ||||
| select | select | ||||
| <include refid="allColumns"/> | <include refid="allColumns"/> | ||||
| from wx_coupon | |||||
| from wx_coupon c | |||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </select> | ||||
| @@ -315,7 +316,7 @@ | |||||
| <sql id="dynamicWhereConditionsForCoupon"> | <sql id="dynamicWhereConditionsForCoupon"> | ||||
| where is_del = 0 | |||||
| where c.is_del = 0 | |||||
| <if test=" null != targetAd "> | <if test=" null != targetAd "> | ||||
| and 0 = (select count(*) from wx_coupon_channel cc | and 0 = (select count(*) from wx_coupon_channel cc | ||||
| where c.`id` = cc.coupon_id | where c.`id` = cc.coupon_id | ||||
| @@ -427,7 +428,7 @@ | |||||
| </if> | </if> | ||||
| <if test=" null != subBusiness "> | <if test=" null != subBusiness "> | ||||
| and `sub_business` = #{subBusiness} | |||||
| and c.`sub_business` = #{subBusiness} | |||||
| </if> | </if> | ||||
| <if test=" null != supportTransfer "> | <if test=" null != supportTransfer "> | ||||
| @@ -459,10 +460,10 @@ | |||||
| </if> | </if> | ||||
| <if test=" null != putApplyStatus and putApplyStatus == 2"> | <if test=" null != putApplyStatus and putApplyStatus == 2"> | ||||
| and `put_apply_status` = #{putApplyStatus} | |||||
| and c.`put_apply_status` = #{putApplyStatus} | |||||
| </if> | </if> | ||||
| <if test=" null != putApplyStatus and putApplyStatus == -1"> | <if test=" null != putApplyStatus and putApplyStatus == -1"> | ||||
| and `put_apply_status` != 2 | |||||
| and c.`put_apply_status` != 2 | |||||
| </if> | </if> | ||||
| <if test=" null != stockApplyStatus "> | <if test=" null != stockApplyStatus "> | ||||
| @@ -477,10 +478,14 @@ | |||||
| and c.`source_type` = #{sourceType} | and c.`source_type` = #{sourceType} | ||||
| </if> | </if> | ||||
| <!--如果配置了审批模板,需要过滤投放审批状态--> | |||||
| <if test=" null != merchantId "> | |||||
| and cm.`merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <!--<!–如果配置了审批模板,需要过滤投放审批状态–> | |||||
| <if test="0 != filterCanPut or null ==filterCanPut "> | <if test="0 != filterCanPut or null ==filterCanPut "> | ||||
| <if test=" null != pressModelId and 0l != pressModelId"> | <if test=" null != pressModelId and 0l != pressModelId"> | ||||
| and if(type=8,put_apply_status =2 or c.id in ( | |||||
| and if(c.type=8,c.put_apply_status =2 or c.id in ( | |||||
| select coupon_id from wx_coupon_channel | select coupon_id from wx_coupon_channel | ||||
| where status=0 | where status=0 | ||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| @@ -492,7 +497,7 @@ | |||||
| ) ,1=1) | ) ,1=1) | ||||
| </if> | </if> | ||||
| <if test=" null != groupModelId and 0l != groupModelId"> | <if test=" null != groupModelId and 0l != groupModelId"> | ||||
| and if(type=9,put_apply_status =2 or c.id in ( | |||||
| and if(c.type=9,c.put_apply_status =2 or c.id in ( | |||||
| select coupon_id from wx_coupon_channel | select coupon_id from wx_coupon_channel | ||||
| where status=0 | where status=0 | ||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| @@ -504,7 +509,7 @@ | |||||
| ),1=1) | ),1=1) | ||||
| </if> | </if> | ||||
| <if test=" null != cardModelId and 0l != cardModelId"> | <if test=" null != cardModelId and 0l != cardModelId"> | ||||
| and if(type=100,put_apply_status =2 or c.id in ( | |||||
| and if(c.type=100,c.put_apply_status =2 or c.id in ( | |||||
| select coupon_id from wx_coupon_channel | select coupon_id from wx_coupon_channel | ||||
| where status=0 | where status=0 | ||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| @@ -516,7 +521,7 @@ | |||||
| ),1=1) | ),1=1) | ||||
| </if> | </if> | ||||
| <if test=" null != couponModelId and 0l != couponModelId"> | <if test=" null != couponModelId and 0l != couponModelId"> | ||||
| and if(type !=8 and type !=9 and type!=100,put_apply_status =2 or c.id in ( | |||||
| and if(c.type !=8 and c.type !=9 and c.type!=100, c.put_apply_status =2 or c.id in ( | |||||
| select coupon_id from wx_coupon_channel | select coupon_id from wx_coupon_channel | ||||
| where status=0 | where status=0 | ||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| @@ -527,7 +532,7 @@ | |||||
| </if> | </if> | ||||
| ),1=1) | ),1=1) | ||||
| </if> | </if> | ||||
| </if> | |||||
| </if>--> | |||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and c.id in | and c.id in | ||||
| @@ -550,6 +555,7 @@ | |||||
| select | select | ||||
| <include refid="allColumns"/> | <include refid="allColumns"/> | ||||
| from wx_coupon c | from wx_coupon c | ||||
| left join wx_coupon_merchant cm on c.id = cm.product_id and cm.status = 0 | |||||
| <include refid="dynamicWhereConditionsForCoupon"/> | <include refid="dynamicWhereConditionsForCoupon"/> | ||||
| <if test="null != limitStart and null != limitEnd"> | <if test="null != limitStart and null != limitEnd"> | ||||
| @@ -559,8 +565,9 @@ | |||||
| <select id="findCouponListCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Integer"> | <select id="findCouponListCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Integer"> | ||||
| select | select | ||||
| count(*) | |||||
| count(distinct c.id) | |||||
| from wx_coupon c | from wx_coupon c | ||||
| left join wx_coupon_merchant cm on c.id = cm.product_id and cm.status = 0 | |||||
| <include refid="dynamicWhereConditionsForCoupon"/> | <include refid="dynamicWhereConditionsForCoupon"/> | ||||
| </select> | </select> | ||||
| @@ -650,7 +657,7 @@ | |||||
| <select id="findVoDetail" parameterType="java.lang.Long" resultMap="WxCouponCVoMap"> | <select id="findVoDetail" parameterType="java.lang.Long" resultMap="WxCouponCVoMap"> | ||||
| select | select | ||||
| <include refid="allColumns"/> | <include refid="allColumns"/> | ||||
| from wx_coupon | |||||
| from wx_coupon c | |||||
| where id = #{id} | where id = #{id} | ||||
| </select> | </select> | ||||