| @@ -264,104 +264,103 @@ public class WxCUserDataController extends BaseController { | |||
| return new ResultData(mapVo); | |||
| } | |||
| //TODO 待优化数据 | |||
| // @ApiOperation("查询用户消费金额") | |||
| // @GetMapping("findUserAmountData") | |||
| // @SystemControllerLog(description = "会员首页-报表数据-查询用户消费金额") | |||
| // public ResultData findUserAmountData(Integer plat) { | |||
| // logger.debug("[" + getIpAddr() + "] WxCUserDataController::findUserAmountData"); | |||
| // if(plat == null){ | |||
| // plat = EnumAppPlat.WX.getCode(); | |||
| // } | |||
| // TenantEntity tenantEntity = getTenantInfo(); | |||
| // Calendar c = Calendar.getInstance(); | |||
| // Date today = c.getTime(); | |||
| // c.add(Calendar.DAY_OF_YEAR, 1); | |||
| // c.set(Calendar.HOUR_OF_DAY, 0); | |||
| // c.set(Calendar.MINUTE, 0); | |||
| // c.set(Calendar.SECOND, 0); | |||
| // Date endTime = c.getTime();//明天0点 | |||
| // c.add(Calendar.DAY_OF_YEAR, -30);//三十天前 | |||
| // Date startTime = c.getTime(); | |||
| // List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||
| // WxCouponOrder wxCouponOrder = new WxCouponOrder(); | |||
| // wxCouponOrder.updateTenantInfo(tenantEntity); | |||
| // wxCouponOrder.setStartTime(startTime); | |||
| // wxCouponOrder.setEndTime(endTime); | |||
| // int thisMonthCount = wxCouponOrderService.queryPriceTotal(wxCouponOrder,tenantEntitys);//月消费金额 | |||
| // c.clear(); | |||
| // c.setTime(endTime); | |||
| // Date eTime = c.getTime(); | |||
| // c.add(Calendar.DAY_OF_YEAR, -30); | |||
| // Date sTime = c.getTime(); | |||
| // List<CUserDateAmountVo> datas = wxCouponOrderService.queryPriceTotalGroup(tenantEntity, sTime, eTime); | |||
| // Map<String, Integer> dataMap = new HashMap<>(); | |||
| // for (CUserDateAmountVo v : datas) { | |||
| // dataMap.put(v.getXTime(), v.getPrice()); | |||
| // } | |||
| // Integer todayCount = 0;//今日金额数 | |||
| // Integer yesterdayCount = 0;//昨日金额数 | |||
| // Integer dayOfWeekCount = 0;//上周x | |||
| // List<UserStructureVo> weekVos = new ArrayList<>();//周消费金额 | |||
| // List<UserStructureVo> monthVos = new ArrayList<>();//周消费金额 | |||
| // for (int i = 29, sortNum = 0; i >= 0; i--) { | |||
| // c.clear(); | |||
| // c.setTime(today); | |||
| // c.add(Calendar.DAY_OF_YEAR, -i); | |||
| // String dateStr = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()); | |||
| // UserStructureVo vo = new UserStructureVo(); | |||
| // vo.setName(new SimpleDateFormat("MM/dd").format(c.getTime())); | |||
| // vo.setSortNum(sortNum++); | |||
| // if (dataMap.get(dateStr) != null) { | |||
| // int price = dataMap.get(dateStr); | |||
| // vo.setPrice(price); | |||
| // } else { | |||
| // vo.setPrice(0); | |||
| // } | |||
| // if (i <= 7) { | |||
| // UserStructureVo vow = new UserStructureVo(); | |||
| // vow.setName(vo.getName()); | |||
| // vow.setSortNum(vo.getSortNum()); | |||
| // vow.setPrice(vo.getPrice()); | |||
| // | |||
| // if (i == 0) { | |||
| // todayCount = vow.getPrice(); | |||
| // } | |||
| // if (i == 1) { | |||
| // yesterdayCount = vow.getPrice(); | |||
| // } | |||
| // if (i == 7) { | |||
| // dayOfWeekCount = vow.getPrice(); | |||
| // } else { | |||
| // weekVos.add(vow); | |||
| // } | |||
| // } | |||
| // monthVos.add(vo); | |||
| // } | |||
| // | |||
| // NumberFormat nf = NumberFormat.getPercentInstance(); | |||
| // nf.setMinimumFractionDigits(2); | |||
| // String dayPercentage = "--"; | |||
| // if (yesterdayCount > 0) { | |||
| // Integer count = todayCount - yesterdayCount; | |||
| // dayPercentage = nf.format(count.doubleValue() / new Double(yesterdayCount).doubleValue()); | |||
| // } | |||
| // String weekPercentage = "--"; | |||
| // if (dayOfWeekCount > 0) { | |||
| // Integer count = todayCount - dayOfWeekCount; | |||
| // weekPercentage = nf.format(count.doubleValue() / new Double(dayOfWeekCount).doubleValue()); | |||
| // } | |||
| // Map<String, Object> map = new HashMap<>(); | |||
| // DecimalFormat df = new DecimalFormat("0.00"); | |||
| // map.put("todayCount", df.format((float) todayCount / 100));//今日消费金额 | |||
| // String thisMonthCountStr = df.format((float) thisMonthCount / 100); | |||
| // map.put("thisMonthCount", thisMonthCountStr);//近一个月消费金额数 | |||
| // map.put("dayPercentage", dayPercentage);//日环比 | |||
| // map.put("weekPercentage", weekPercentage); //周同比 | |||
| // map.put("weekVos", weekVos);//一周金额列表 | |||
| // map.put("monthVos", monthVos);//一月金额列表 | |||
| // return new ResultData(map); | |||
| // } | |||
| @ApiOperation("查询用户消费金额") | |||
| @GetMapping("findUserAmountData") | |||
| @SystemControllerLog(description = "会员首页-报表数据-查询用户消费金额") | |||
| public ResultData findUserAmountData(Integer plat) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserDataController::findUserAmountData"); | |||
| if(plat == null){ | |||
| plat = EnumAppPlat.WX.getCode(); | |||
| } | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| Calendar c = Calendar.getInstance(); | |||
| Date today = c.getTime(); | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| c.set(Calendar.MINUTE, 0); | |||
| c.set(Calendar.SECOND, 0); | |||
| Date endTime = c.getTime();//明天0点 | |||
| c.add(Calendar.DAY_OF_YEAR, -30);//三十天前 | |||
| Date startTime = c.getTime(); | |||
| List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||
| WxCouponOrder wxCouponOrder = new WxCouponOrder(); | |||
| wxCouponOrder.updateTenantInfo(tenantEntity); | |||
| wxCouponOrder.setStartTime(startTime); | |||
| wxCouponOrder.setEndTime(endTime); | |||
| int thisMonthCount = wxCouponOrderService.queryPriceTotal(wxCouponOrder,tenantEntitys);//月消费金额 | |||
| c.clear(); | |||
| c.setTime(endTime); | |||
| Date eTime = c.getTime(); | |||
| c.add(Calendar.DAY_OF_YEAR, -30); | |||
| Date sTime = c.getTime(); | |||
| List<CUserDateAmountVo> datas = wxCouponOrderService.queryPriceTotalGroup(tenantEntity, sTime, eTime); | |||
| Map<String, Integer> dataMap = new HashMap<>(); | |||
| for (CUserDateAmountVo v : datas) { | |||
| dataMap.put(v.getXTime(), v.getPrice()); | |||
| } | |||
| Integer todayCount = 0;//今日金额数 | |||
| Integer yesterdayCount = 0;//昨日金额数 | |||
| Integer dayOfWeekCount = 0;//上周x | |||
| List<UserStructureVo> weekVos = new ArrayList<>();//周消费金额 | |||
| List<UserStructureVo> monthVos = new ArrayList<>();//周消费金额 | |||
| for (int i = 29, sortNum = 0; i >= 0; i--) { | |||
| c.clear(); | |||
| c.setTime(today); | |||
| c.add(Calendar.DAY_OF_YEAR, -i); | |||
| String dateStr = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()); | |||
| UserStructureVo vo = new UserStructureVo(); | |||
| vo.setName(new SimpleDateFormat("MM/dd").format(c.getTime())); | |||
| vo.setSortNum(sortNum++); | |||
| if (dataMap.get(dateStr) != null) { | |||
| int price = dataMap.get(dateStr); | |||
| vo.setPrice(price); | |||
| } else { | |||
| vo.setPrice(0); | |||
| } | |||
| if (i <= 7) { | |||
| UserStructureVo vow = new UserStructureVo(); | |||
| vow.setName(vo.getName()); | |||
| vow.setSortNum(vo.getSortNum()); | |||
| vow.setPrice(vo.getPrice()); | |||
| if (i == 0) { | |||
| todayCount = vow.getPrice(); | |||
| } | |||
| if (i == 1) { | |||
| yesterdayCount = vow.getPrice(); | |||
| } | |||
| if (i == 7) { | |||
| dayOfWeekCount = vow.getPrice(); | |||
| } else { | |||
| weekVos.add(vow); | |||
| } | |||
| } | |||
| monthVos.add(vo); | |||
| } | |||
| NumberFormat nf = NumberFormat.getPercentInstance(); | |||
| nf.setMinimumFractionDigits(2); | |||
| String dayPercentage = "--"; | |||
| if (yesterdayCount > 0) { | |||
| Integer count = todayCount - yesterdayCount; | |||
| dayPercentage = nf.format(count.doubleValue() / new Double(yesterdayCount).doubleValue()); | |||
| } | |||
| String weekPercentage = "--"; | |||
| if (dayOfWeekCount > 0) { | |||
| Integer count = todayCount - dayOfWeekCount; | |||
| weekPercentage = nf.format(count.doubleValue() / new Double(dayOfWeekCount).doubleValue()); | |||
| } | |||
| Map<String, Object> map = new HashMap<>(); | |||
| DecimalFormat df = new DecimalFormat("0.00"); | |||
| map.put("todayCount", df.format((float) todayCount / 100));//今日消费金额 | |||
| String thisMonthCountStr = df.format((float) thisMonthCount / 100); | |||
| map.put("thisMonthCount", thisMonthCountStr);//近一个月消费金额数 | |||
| map.put("dayPercentage", dayPercentage);//日环比 | |||
| map.put("weekPercentage", weekPercentage); //周同比 | |||
| map.put("weekVos", weekVos);//一周金额列表 | |||
| map.put("monthVos", monthVos);//一月金额列表 | |||
| return new ResultData(map); | |||
| } | |||
| } | |||
| @@ -18,7 +18,7 @@ public interface WxCouponMerchantMapper extends CommonMapper<WxCouponMerchant, L | |||
| List<WxMerchantVo> findMerchantNameList(@Param("productId")Long productId,@Param("tenantId")String tenantId); | |||
| List<WxMerchantVo> findMerchantBaseList(@Param("productId")Long productId,@Param("tenantId")String tenantId); | |||
| List<WxMerchantProductVo> findMerchantProduct(@Param("tenantId")String tenantId,@Param("merchantIdList")List<Long> merchantIdList); | |||
| List<Long> findMerchantProductIds(@Param("tenantId")String tenantId,@Param("merchantIdList")List<Long> merchantIdList); | |||
| List<Long> findMerchantProductIds(@Param("tenantId")String tenantId,@Param("merchantIdList")List<Long> merchantIdList,@Param("status")Integer status); | |||
| List<Long> findOneMerchantProductIds(@Param("tenantId")String tenantId,@Param("merchantId")Long merchantIdList); | |||
| List<Long> findMerchantByProductIds(@Param("tenantId")String tenantId,@Param("productIds")List<Long> productIds); | |||
| } | |||
| @@ -100,6 +100,6 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | |||
| Integer findWriteOffCount(WxCouponOrder wxCouponOrder); | |||
| List<WxCouponOrderBVo> findGoodsList(WxCouponOrderBVo record); | |||
| List<WxCouponOrder> findGoodsList(WxCouponOrderBVo record); | |||
| } | |||
| @@ -324,7 +324,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||
| } | |||
| cids.retainAll(mcids); | |||
| }else if(wxCouponChannel.getMerchantIds() != null && !wxCouponChannel.getMerchantIds().isEmpty()){ | |||
| List<Long> mcids = wxCouponMerchantMapper.findMerchantProductIds(wxCouponChannel.getTenantId(), wxCouponChannel.getMerchantIds()); | |||
| List<Long> mcids = wxCouponMerchantMapper.findMerchantProductIds(wxCouponChannel.getTenantId(), wxCouponChannel.getMerchantIds(),0); | |||
| if(mcids == null || mcids.isEmpty()){ | |||
| wxCouponChannel.setId(-999L); | |||
| return; | |||
| @@ -838,7 +838,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| List<Long> merchantProductIds = null; | |||
| if (null != merchantIdListQueryParam) { | |||
| //查询商户券 | |||
| merchantProductIds = wxCouponMerchantMapper.findMerchantProductIds(wxCouponOrder.getTenantId(), merchantIdListQueryParam); | |||
| merchantProductIds = wxCouponMerchantMapper.findMerchantProductIds(wxCouponOrder.getTenantId(), merchantIdListQueryParam,0); | |||
| if (null == merchantProductIds || merchantProductIds.size() <= 0) { | |||
| //throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"商户下查询不到券信息。"); | |||
| wxCouponOrder.setId(-999L); | |||
| @@ -2386,7 +2386,28 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||
| @Override | |||
| public PageInfo<WxCouponOrderBVo> goodsListAsPage(WxCouponOrderBVo record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findGoodsList(record)); | |||
| PageInfo<WxCouponOrderBVo> retPageInfo = new PageInfo<WxCouponOrderBVo>(); | |||
| List<Long> merchantIds = new ArrayList<Long>(); | |||
| merchantIds.add(record.getMerchantId()); | |||
| List<Long> couponIds = wxCouponMerchantMapper.findMerchantProductIds(record.getTenantId(),merchantIds,null); | |||
| if (null == couponIds) { | |||
| retPageInfo.setPageNum(pageIndex); | |||
| retPageInfo.setPageSize(pageSize); | |||
| retPageInfo.setPages(0); | |||
| return retPageInfo; | |||
| } | |||
| //查询商户下的券 | |||
| record.setCouponIds(couponIds); | |||
| PageInfo<WxCouponOrder> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findGoodsList(record)); | |||
| retPageInfo.setPageNum(pageIndex); | |||
| retPageInfo.setPageSize(pageSize); | |||
| retPageInfo.setPages(pageInfo.getPages()); | |||
| if (null != pageInfo && null != pageInfo.getList()){ | |||
| List<WxCouponOrderBVo> volist = handleQueryResult(pageInfo.getList(), record); | |||
| retPageInfo.setList(volist); | |||
| } | |||
| return retPageInfo; | |||
| } | |||
| @Override | |||
| @@ -161,9 +161,9 @@ | |||
| <select id = "findMerchantProductIds" parameterType="java.util.Map" resultType="Long"> | |||
| SELECT distinct wcm.product_id | |||
| FROM wx_coupon_merchant wcm | |||
| WHERE wcm.STATUS = 0 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and wcm.`tenant_id` = #{tenantId} | |||
| WHERE wcm.`tenant_id` = #{tenantId} | |||
| <if test=" null != status"> | |||
| and wcm.STATUS = #{status} | |||
| </if> | |||
| <if test=" null != merchantIdList"> | |||
| and wcm.merchant_id in | |||
| @@ -662,17 +662,13 @@ | |||
| <select id="queryPriceTotalGroup" resultType="com.iformall.domain.vo.CUserDateAmountVo" > | |||
| SELECT DATE_FORMAT(create_date,'%Y-%m-%d') as xTime,IFNULL(SUM(coupon_price),0) as price | |||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix} | |||
| </foreach>) wx_coupon_order | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| from wx_coupon_order | |||
| where create_date_times >= unix_timestamp(#{startTime}) and create_date_times < unix_timestamp(#{endTime}) | |||
| and `tenant_id` = #{tenantId} | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| AND create_date >= #{startTime} and create_date < #{endTime} GROUP BY xTime | |||
| GROUP BY xTime | |||
| </select> | |||
| @@ -693,56 +689,6 @@ | |||
| and shipping_type = 2 and shipping_status = 24 and coupon_order_status = 0 | |||
| </select> | |||
| <resultMap id="AdminBVoResultMap" type="com.iformall.domain.vo.WxCouponOrderBVo"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenant_id" jdbcType="BIGINT" property="tenantId" /> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId" /> | |||
| <result column="coupon_type" jdbcType="INTEGER" property="couponType" /> | |||
| <result column="c_user_id" jdbcType="BIGINT" property="cUserId" /> | |||
| <result column="owner_id" jdbcType="BIGINT" property="ownerId" /> | |||
| <result column="b_user_id" jdbcType="BIGINT" property="bUserId" /> | |||
| <result column="order_id" jdbcType="BIGINT" property="orderId" /> | |||
| <result column="expired_time" jdbcType="TIMESTAMP" property="expiredTime" /> | |||
| <result column="coupon_order_status" jdbcType="INTEGER" property="couponOrderStatus" /> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||
| <result column="coupon_price" jdbcType="INTEGER" property="couponPrice" /> | |||
| <result column="pay_vendor" jdbcType="INTEGER" property="payVendor" /> | |||
| <result column="verify_type" jdbcType="INTEGER" property="verifyType" /> | |||
| <result column="verify_remark" jdbcType="VARCHAR" property="verifyRemark" /> | |||
| <result column="freight_price" jdbcType="INTEGER" property="freightPrice"/> | |||
| <result column="shipping_type" jdbcType="INTEGER" property="shippingType"/> | |||
| <result column="shipping_address" jdbcType="VARCHAR" property="shippingAddress"/> | |||
| <result column="shipping_status" jdbcType="INTEGER" property="shippingStatus"/> | |||
| <result column="delivery_info" jdbcType="VARCHAR" property="deliveryInfo"/> | |||
| <result column="subsidy" jdbcType="INTEGER" property="subsidy"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||
| <result column="type" jdbcType="INTEGER" property="type" /> | |||
| <result column="title" jdbcType="VARCHAR" property="title" /> | |||
| <result column="sale_price" jdbcType="INTEGER" property="salePrice" /> | |||
| <result column="use_price" jdbcType="INTEGER" property="usePrice" /> | |||
| <result column="price" jdbcType="INTEGER" property="price" /> | |||
| <result column="auto_refund" jdbcType="INTEGER" property="autoRefund" /> | |||
| <result column="business" jdbcType="INTEGER" property="business"/> | |||
| <result column="subsidy_num" jdbcType="INTEGER" property="subsidyNum"/> | |||
| <result column="subsidy_type" jdbcType="INTEGER" property="subsidyType"/> | |||
| <result column="source_type" jdbcType="INTEGER" property="sourceType"/> | |||
| <result column="name" jdbcType="VARCHAR" property="bUserName" /> | |||
| <result column="bphone" jdbcType="VARCHAR" property="bUserPhone" /> | |||
| <result column="phone" jdbcType="VARCHAR" property="cUserPhone" /> | |||
| <result column="nick_name" jdbcType="VARCHAR" property="userNickName" /> | |||
| <result column="merchant_name" jdbcType="VARCHAR" property="merchantName" /> | |||
| <result column="verify_merchant_name" jdbcType="VARCHAR" property="verifyMerchantName"/> | |||
| <result column="send_merchant_id" jdbcType="INTEGER" property="sendMerchantId" /> | |||
| </resultMap> | |||
| <select id="findListOfAdmin" parameterType="com.iformall.domain.vo.WxCouponOrderBVo" resultMap="BaseResultMap"> | |||
| select co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.expired_time,co.coupon_order_status,co.order_id, | |||
| co.create_date,co.update_date,co.coupon_price, co.verify_type, co.verify_remark,co.pay_vendor, | |||
| @@ -838,18 +784,13 @@ | |||
| </select> | |||
| <select id="findGoodsList" parameterType="com.iformall.domain.vo.WxCouponOrderBVo" resultMap="AdminBVoResultMap"> | |||
| <select id="findGoodsList" parameterType="com.iformall.domain.vo.WxCouponOrderBVo" resultMap="BaseResultMap"> | |||
| select | |||
| co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id, | |||
| co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark, co.pay_vendor, | |||
| co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`, | |||
| c.type,c.title,c.sale_price,c.use_price,c.price,c.unit,c.auto_refund,c.business,c.subsidy_type, | |||
| cu.phone,cu.nick_name | |||
| FROM wx_coupon_order co | |||
| left join wx_coupon_merchant wcm on co.coupon_id = wcm.product_id and wcm.merchant_id = #{merchantId} | |||
| LEFT JOIN wx_c_user_basic_info cu ON cu.id=co.c_user_id | |||
| LEFT JOIN wx_coupon c ON c.id = co.coupon_id | |||
| where wcm.merchant_id = #{merchantId} | |||
| where co.`tenant_id` = #{tenantId} | |||
| <choose> | |||
| <when test=" null != couponType"> | |||
| and co.coupon_type = #{couponType} | |||
| @@ -862,9 +803,6 @@ | |||
| and co.coupon_type < 100 | |||
| </otherwise> | |||
| </choose> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and co.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and co.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| @@ -883,11 +821,11 @@ | |||
| </if> | |||
| <if test="startDate != null"> | |||
| AND co.create_date > #{startDate,jdbcType=TIMESTAMP} | |||
| AND co.create_date_times > unix_timestamp(#{startDate}) | |||
| </if> | |||
| <if test="endDate != null"> | |||
| AND co.create_date < #{endDate,jdbcType=TIMESTAMP} | |||
| AND co.create_date_times < unix_timestamp(#{endDate}) | |||
| </if> | |||
| <if test="verifyStartDate != null"> | |||
| @@ -919,8 +857,16 @@ | |||
| <if test=" null != sourceType "> | |||
| and c.`source_type` = #{sourceType} | |||
| </if> | |||
| <if test=" null != couponIds"> | |||
| and co.coupon_id in | |||
| <foreach collection="couponIds" index="index" item="couponIdItem" open="(" separator="," close=")"> | |||
| #{couponIdItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| <if test=" null == sortColumns">order by co.create_date desc,co.id desc</if> | |||
| <if test=" null == sortColumns">order co.id desc</if> | |||
| </select> | |||