| @@ -1,6 +1,7 @@ | |||||
| package com.iformall.domain.po; | package com.iformall.domain.po; | ||||
| import cn.afterturn.easypoi.excel.annotation.Excel; | import cn.afterturn.easypoi.excel.annotation.Excel; | ||||
| import io.swagger.models.auth.In; | |||||
| import lombok.Data; | import lombok.Data; | ||||
| import javax.persistence.*; | import javax.persistence.*; | ||||
| import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
| @@ -106,6 +107,12 @@ public class WxCardSpend implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value="时段(0,工作日白天,1,工作日晚上,2周末白天,3周末晚上)",name="timeSlot") | @io.swagger.annotations.ApiModelProperty(value="时段(0,工作日白天,1,工作日晚上,2周末白天,3周末晚上)",name="timeSlot") | ||||
| private Integer timeSlot; | private Integer timeSlot; | ||||
| @Transient | |||||
| private Integer businessId; | |||||
| @Transient | |||||
| private Integer subBusinessId; | |||||
| public String getDeductionAmountStr() { | public String getDeductionAmountStr() { | ||||
| if(getDeductionAmount()!=null) { | if(getDeductionAmount()!=null) { | ||||
| deductionAmountStr = new BigDecimal(getDeductionAmount()).divide(new BigDecimal(100)).toString(); | deductionAmountStr = new BigDecimal(getDeductionAmount()).divide(new BigDecimal(100)).toString(); | ||||
| @@ -102,7 +102,13 @@ public class WxCouponOrder extends BaseEntity{ | |||||
| @Transient | @Transient | ||||
| @io.swagger.annotations.ApiModelProperty(value="时段(0,工作日白天,1,工作日晚上,2周末白天,3周末晚上)",name="timeSlot") | @io.swagger.annotations.ApiModelProperty(value="时段(0,工作日白天,1,工作日晚上,2周末白天,3周末晚上)",name="timeSlot") | ||||
| private Integer timeSlot; | private Integer timeSlot; | ||||
| @Transient | |||||
| private Integer businessId; | |||||
| @Transient | |||||
| private Integer subBusinessId; | |||||
| public String getCouponPriceStr() { | public String getCouponPriceStr() { | ||||
| if(couponPrice!=null) { | if(couponPrice!=null) { | ||||
| DecimalFormat df=new DecimalFormat("0.00"); | DecimalFormat df=new DecimalFormat("0.00"); | ||||
| @@ -271,6 +277,22 @@ public class WxCouponOrder extends BaseEntity{ | |||||
| this.timeSlot = timeSlot; | this.timeSlot = timeSlot; | ||||
| } | } | ||||
| public Integer getBusinessId() { | |||||
| return businessId; | |||||
| } | |||||
| public void setBusinessId(Integer businessId) { | |||||
| this.businessId = businessId; | |||||
| } | |||||
| public Integer getSubBusinessId() { | |||||
| return subBusinessId; | |||||
| } | |||||
| public void setSubBusinessId(Integer subBusinessId) { | |||||
| this.subBusinessId = subBusinessId; | |||||
| } | |||||
| public static enum Field { | public static enum Field { | ||||
| Id_ASC("`id` ASC"), Id_DESC("`id` DESC"), | Id_ASC("`id` ASC"), Id_DESC("`id` DESC"), | ||||
| TenantId_ASC("`tenant_id` ASC"), TenantId_DESC("`tenant_id` DESC"), | TenantId_ASC("`tenant_id` ASC"), TenantId_DESC("`tenant_id` DESC"), | ||||
| @@ -0,0 +1,57 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumSubBusiness { | |||||
| SUB_BUSINESS_NULL(0,"无" ), | |||||
| SUB_BUSINESS_ID1 (1,"西餐"), | |||||
| SUB_BUSINESS_ID2 (2,"日本料理"), | |||||
| SUB_BUSINESS_ID3 (3,"韩国料理"), | |||||
| SUB_BUSINESS_ID4 (4,"东南亚菜"), | |||||
| SUB_BUSINESS_ID5 (5,"自助餐"), | |||||
| SUB_BUSINESS_ID6 (6,"火锅"), | |||||
| SUB_BUSINESS_ID7 (7,"特色菜"), | |||||
| SUB_BUSINESS_ID8 (8,"私房菜"), | |||||
| SUB_BUSINESS_ID9 (9,"素食"), | |||||
| SUB_BUSINESS_ID10(10,"烧烤"), | |||||
| SUB_BUSINESS_ID11(11,"小吃快餐"), | |||||
| SUB_BUSINESS_ID12(12,"川菜"), | |||||
| SUB_BUSINESS_ID13(13,"湘菜"), | |||||
| SUB_BUSINESS_ID14(14,"鲁菜"), | |||||
| SUB_BUSINESS_ID15(15,"粤菜"), | |||||
| SUB_BUSINESS_ID16(16,"湖北菜"), | |||||
| SUB_BUSINESS_ID17(17,"云贵菜"), | |||||
| SUB_BUSINESS_ID18(18,"东北菜"), | |||||
| SUB_BUSINESS_ID19(19,"面包店"), | |||||
| SUB_BUSINESS_ID20(20,"咖啡厅"), | |||||
| SUB_BUSINESS_ID21(21,"饮品店") | |||||
| ; | |||||
| public static EnumSubBusiness getEnum(Integer code) { | |||||
| for (EnumSubBusiness value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumSubBusiness(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -44,6 +44,12 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { | |||||
| @Autowired | @Autowired | ||||
| WxCUserCarMapper wxCUserCarMapper; | WxCUserCarMapper wxCUserCarMapper; | ||||
| @Autowired | |||||
| WxSubBusinessMapper wxSubBusinessMapper; | |||||
| @Autowired | |||||
| WxBusinessMapper wxBusinessMapper; | |||||
| @Autowired | @Autowired | ||||
| WxTagsService wxTagsService; | WxTagsService wxTagsService; | ||||
| @@ -339,6 +345,106 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { | |||||
| return assign(user, EnumTag.ID_58); | return assign(user, EnumTag.ID_58); | ||||
| } | } | ||||
| private List<WxTags> assignTypeId14(WxCUserBasicInfo user, WxCUser param) | |||||
| { | |||||
| List<WxTags> resList = null; | |||||
| Calendar endC = Calendar.getInstance(); | |||||
| Calendar startC = Calendar.getInstance(); | |||||
| endC.setTime(new Date()); | |||||
| startC.setTime(new Date()); | |||||
| startC.add(Calendar.DAY_OF_YEAR, -30); | |||||
| WxCouponOrder wxCouponOrder = new WxCouponOrder(); | |||||
| wxCouponOrder.setcUserId(param.getId()); | |||||
| wxCouponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode()); | |||||
| wxCouponOrder.setStartTime(startC.getTime()); | |||||
| wxCouponOrder.setEndTime(endC.getTime()); | |||||
| WxCardSpend wxCardSpend = new WxCardSpend(); | |||||
| wxCardSpend.setOwnerId(param.getId()); | |||||
| wxCardSpend.setStartdate(startC.getTime()); | |||||
| wxCardSpend.setEnddate(endC.getTime()); | |||||
| WxBusiness business = new WxBusiness(); | |||||
| List<WxBusiness> list = wxBusinessMapper.findList(business); | |||||
| list.stream().forEach(b->{ | |||||
| wxCardSpend.setBusinessId(b.getId()); | |||||
| wxCouponOrder.setBusinessId(b.getId()); | |||||
| int count = wxCardSpendMapper.findCount(wxCardSpend); | |||||
| count += wxCouponOrderMapper.findCount(wxCouponOrder); | |||||
| if (count > 0) { | |||||
| EnumTag tag = null; | |||||
| if (b.getId().intValue() >= EnumBusiness.BUSINESS_ID1.getCode() && | |||||
| b.getId().intValue() <= EnumBusiness.BUSINESS_ID5.getCode()){ | |||||
| tag = EnumTag.getEnum(EnumTag.ID_68.getCode() | |||||
| + (b.getId().intValue() - EnumBusiness.BUSINESS_ID1.getCode())); | |||||
| } | |||||
| if (b.getId().intValue() >= EnumBusiness.BUSINESS_ID7.getCode() && | |||||
| b.getId().intValue() <= EnumBusiness.BUSINESS_ID10.getCode()){ | |||||
| tag = EnumTag.getEnum(EnumTag.ID_73.getCode() | |||||
| + (b.getId().intValue() - EnumBusiness.BUSINESS_ID7.getCode())); | |||||
| } | |||||
| resList.clear(); | |||||
| resList.addAll(assign(user, tag)); | |||||
| } | |||||
| }); | |||||
| return resList; | |||||
| } | |||||
| private List<WxTags> assignTypeId17(WxCUserBasicInfo user, WxCUser param) | |||||
| { | |||||
| List<WxTags> resList = null; | |||||
| Calendar endC = Calendar.getInstance(); | |||||
| Calendar startC = Calendar.getInstance(); | |||||
| endC.setTime(new Date()); | |||||
| startC.setTime(new Date()); | |||||
| startC.add(Calendar.DAY_OF_YEAR, -30); | |||||
| WxCouponOrder wxCouponOrder = new WxCouponOrder(); | |||||
| wxCouponOrder.setcUserId(param.getId()); | |||||
| wxCouponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode()); | |||||
| wxCouponOrder.setStartTime(startC.getTime()); | |||||
| wxCouponOrder.setEndTime(endC.getTime()); | |||||
| wxCouponOrder.setBusinessId(EnumBusiness.BUSINESS_ID1.getCode()); | |||||
| WxCardSpend wxCardSpend = new WxCardSpend(); | |||||
| wxCardSpend.setOwnerId(param.getId()); | |||||
| wxCardSpend.setStartdate(startC.getTime()); | |||||
| wxCardSpend.setEnddate(endC.getTime()); | |||||
| wxCardSpend.setBusinessId(EnumBusiness.BUSINESS_ID1.getCode()); | |||||
| WxSubBusiness subBusiness = new WxSubBusiness(); | |||||
| subBusiness.setBusinessId(EnumBusiness.BUSINESS_ID1.getCode()); | |||||
| List<WxSubBusiness> list = wxSubBusinessMapper.findList(subBusiness); | |||||
| list.stream().forEach(sb->{ | |||||
| wxCardSpend.setSubBusinessId(sb.getId()); | |||||
| wxCouponOrder.setSubBusinessId(sb.getId()); | |||||
| int count = wxCardSpendMapper.findCount(wxCardSpend); | |||||
| count += wxCouponOrderMapper.findCount(wxCouponOrder); | |||||
| if (count > 0) { | |||||
| EnumTag tag = null; | |||||
| if (sb.getId().intValue() >= EnumSubBusiness.SUB_BUSINESS_ID1.getCode() && | |||||
| sb.getId().intValue() <= EnumSubBusiness.SUB_BUSINESS_ID5.getCode()){ | |||||
| tag = EnumTag.getEnum(EnumTag.ID_92.getCode() | |||||
| + (sb.getId().intValue() - EnumSubBusiness.SUB_BUSINESS_ID1.getCode())); | |||||
| } | |||||
| if (sb.getId().intValue() >= EnumSubBusiness.SUB_BUSINESS_ID6.getCode() && | |||||
| sb.getId().intValue() <= EnumSubBusiness.SUB_BUSINESS_ID21.getCode()){ | |||||
| tag = EnumTag.getEnum(EnumTag.ID_129.getCode() | |||||
| + (sb.getId().intValue() - EnumSubBusiness.SUB_BUSINESS_ID6.getCode())); | |||||
| } | |||||
| resList.clear(); | |||||
| resList.addAll(assign(user, tag)); | |||||
| } | |||||
| }); | |||||
| return resList; | |||||
| } | |||||
| private List<WxTags> assignTypeId18(WxCUserBasicInfo user, WxCUser param) { | private List<WxTags> assignTypeId18(WxCUserBasicInfo user, WxCUser param) { | ||||
| List<WxTags> resList = null; | List<WxTags> resList = null; | ||||
| @@ -520,6 +626,10 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { | |||||
| WxCUser param = (WxCUser) obj; | WxCUser param = (WxCUser) obj; | ||||
| WxCUserBasicInfo user = wxCUserBasicInfoMapper.selectByPrimaryKey(param.getId()); | WxCUserBasicInfo user = wxCUserBasicInfoMapper.selectByPrimaryKey(param.getId()); | ||||
| if (user != null) { | if (user != null) { | ||||
| //消费类别 | |||||
| resList = assignTypeId14(user, param); | |||||
| //饮食偏好 | |||||
| resList = assignTypeId17(user, param); | |||||
| //消费时段 | //消费时段 | ||||
| resList = assignTypeId18(user, param); | resList = assignTypeId18(user, param); | ||||
| //消费频度 | //消费频度 | ||||
| @@ -557,6 +667,7 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { | |||||
| WxCUserBasicInfo user = (WxCUserBasicInfo) obj; | WxCUserBasicInfo user = (WxCUserBasicInfo) obj; | ||||
| WxCUser param = wxCUserMapper.selectByPrimaryKey(user.getId()); | WxCUser param = wxCUserMapper.selectByPrimaryKey(user.getId()); | ||||
| if (user != null && param != null) { | if (user != null && param != null) { | ||||
| if (user.getSex() != null) { | if (user.getSex() != null) { | ||||
| //性别 | //性别 | ||||
| resList = assignTypeId1(user, user.getSex()); | resList = assignTypeId1(user, user.getSex()); | ||||
| @@ -578,6 +689,11 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { | |||||
| resList = assignTypeId6(user, user.getEducation()); | resList = assignTypeId6(user, user.getEducation()); | ||||
| } | } | ||||
| //消费类别 | |||||
| resList = assignTypeId14(user, param); | |||||
| //饮食偏好 | |||||
| resList = assignTypeId17(user, param); | |||||
| //消费时段 | //消费时段 | ||||
| resList = assignTypeId18(user, param); | resList = assignTypeId18(user, param); | ||||
| //消费频度 | //消费频度 | ||||
| @@ -80,34 +80,6 @@ | |||||
| and `create_date` between #{startdate} and #{enddate} | and `create_date` between #{startdate} and #{enddate} | ||||
| </if> | </if> | ||||
| <if test=" 0 == timeSlot"> | |||||
| and date_format(create_date,'%H:%m') >= '06:00' | |||||
| and date_format(create_date,'%H:%m') < '18:00' | |||||
| and date_format(create_date,'%w') in (1,2,3,4,5) | |||||
| </if> | |||||
| <if test=" 1 == timeSlot"> | |||||
| and ((date_format(create_date,'%H:%m') >= '18:00' | |||||
| and date_format(create_date,'%w') in (1,2,3,4)) | |||||
| or | |||||
| ((date_format(create_date,'%H:%m') < '06:00') | |||||
| and date_format(create_date,'%w') in (1,2,3,4,5))) | |||||
| </if> | |||||
| <if test=" 2 == timeSlot"> | |||||
| and date_format(create_date,'%H:%m') >= '06:00' | |||||
| and date_format(create_date,'%H:%m') < '18:00' | |||||
| and date_format(create_date,'%w') in (0,6) | |||||
| </if> | |||||
| <if test=" 3 == timeSlot"> | |||||
| and ((date_format(create_date,'%H:%m') >= '18:00' | |||||
| and date_format(create_date,'%w') in (5,6,0)) | |||||
| or | |||||
| ((date_format(create_date,'%H:%m') < '06:00') | |||||
| and date_format(create_date,'%w') in (6,0))) | |||||
| </if> | |||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||
| @@ -145,8 +117,52 @@ | |||||
| <select id="findCount" parameterType="com.iformall.domain.po.WxCardSpend" resultType="Integer"> | <select id="findCount" parameterType="com.iformall.domain.po.WxCardSpend" resultType="Integer"> | ||||
| select count(*) | select count(*) | ||||
| from wx_card_spend | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| from wx_card_spend cs | |||||
| <if test=" null != businessId "> | |||||
| inner join wx_merchant m | |||||
| on m.id = cs.merchant_id | |||||
| and m.business_id = #{businessId} | |||||
| <if test=" null != subBusinessId "> | |||||
| and m.sub_business_id = #{subBusinessId} | |||||
| </if> | |||||
| </if> | |||||
| where 1 = 1 | |||||
| <if test=" null != ownerId "> | |||||
| and cs.`owner_id` = #{ownerId} | |||||
| </if> | |||||
| <if test=" null != tenantId "> | |||||
| and cs.`tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != startdate and null!=enddate"> | |||||
| and cs.`create_date` between #{startdate} and #{enddate} | |||||
| </if> | |||||
| <if test=" 0 == timeSlot"> | |||||
| and date_format(cs.create_date,'%H:%m') >= '06:00' | |||||
| and date_format(cs.create_date,'%H:%m') < '18:00' | |||||
| and date_format(cs.create_date,'%w') in (1,2,3,4,5) | |||||
| </if> | |||||
| <if test=" 1 == timeSlot"> | |||||
| and ((date_format(cs.create_date,'%H:%m') >= '18:00' | |||||
| and date_format(cs.create_date,'%w') in (1,2,3,4)) | |||||
| or | |||||
| ((date_format(cs.create_date,'%H:%m') < '06:00') | |||||
| and date_format(cs.create_date,'%w') in (1,2,3,4,5))) | |||||
| </if> | |||||
| <if test=" 2 == timeSlot"> | |||||
| and date_format(cs.create_date,'%H:%m') >= '06:00' | |||||
| and date_format(cs.create_date,'%H:%m') < '18:00' | |||||
| and date_format(cs.create_date,'%w') in (0,6) | |||||
| </if> | |||||
| <if test=" 3 == timeSlot"> | |||||
| and ((date_format(cs.create_date,'%H:%m') >= '18:00' | |||||
| and date_format(cs.create_date,'%w') in (5,6,0)) | |||||
| or | |||||
| ((date_format(cs.create_date,'%H:%m') < '06:00') | |||||
| and date_format(cs.create_date,'%w') in (6,0))) | |||||
| </if> | |||||
| </select> | </select> | ||||
| @@ -228,87 +228,95 @@ | |||||
| </select> | </select> | ||||
| <select id="findCount" parameterType="com.iformall.domain.po.WxCouponOrder" resultType="java.lang.Integer"> | <select id="findCount" parameterType="com.iformall.domain.po.WxCouponOrder" resultType="java.lang.Integer"> | ||||
| select COUNT(*) FROM wx_coupon_order | |||||
| select COUNT(*) FROM wx_coupon_order co | |||||
| <if test=" null != businessId "> | |||||
| inner join wx_coupon c | |||||
| on c.id = co.coupon_id | |||||
| and c.business = #{businessId} | |||||
| <if test=" null != subBusinessId "> | |||||
| and c.sub_business = #{subBusinessId} | |||||
| </if> | |||||
| </if> | |||||
| where 1=1 | where 1=1 | ||||
| <if test=" null != tenantId"> | <if test=" null != tenantId"> | ||||
| and tenant_id = #{tenantId} | |||||
| and co.tenant_id = #{tenantId} | |||||
| </if> | </if> | ||||
| <if test=" null != couponOrderStatus"> | <if test=" null != couponOrderStatus"> | ||||
| and coupon_order_status = #{couponOrderStatus} | |||||
| and co.coupon_order_status = #{couponOrderStatus} | |||||
| </if> | </if> | ||||
| <if test=" null != cUserId"> | <if test=" null != cUserId"> | ||||
| and c_user_id = #{cUserId} | |||||
| and co.c_user_id = #{cUserId} | |||||
| </if> | </if> | ||||
| <if test=" null != couponId "> | <if test=" null != couponId "> | ||||
| and coupon_id = #{couponId} | |||||
| and co.coupon_id = #{couponId} | |||||
| </if> | </if> | ||||
| <if test=" null != couponType "> | <if test=" null != couponType "> | ||||
| and coupon_type = #{couponType} | |||||
| and co.coupon_type = #{couponType} | |||||
| </if> | </if> | ||||
| <if test=" 1 == couponOrderStatus"> | <if test=" 1 == couponOrderStatus"> | ||||
| <if test=" null != startTime"> | <if test=" null != startTime"> | ||||
| and update_date >= #{startTime} | |||||
| and co.update_date >= #{startTime} | |||||
| </if> | </if> | ||||
| <if test=" null != endTime"> | <if test=" null != endTime"> | ||||
| and update_date <= #{endTime} | |||||
| and co.update_date <= #{endTime} | |||||
| </if> | </if> | ||||
| <if test=" 0 == timeSlot"> | <if test=" 0 == timeSlot"> | ||||
| and date_format(update_date,'%H:%m') >= '06:00' | |||||
| and date_format(update_date,'%H:%m') < '18:00' | |||||
| and date_format(update_date,'%w') in (1,2,3,4,5) | |||||
| and date_format(co.update_date,'%H:%m') >= '06:00' | |||||
| and date_format(co.update_date,'%H:%m') < '18:00' | |||||
| and date_format(co.update_date,'%w') in (1,2,3,4,5) | |||||
| </if> | </if> | ||||
| <if test=" 1 == timeSlot"> | <if test=" 1 == timeSlot"> | ||||
| and ((date_format(update_date,'%H:%m') >= '18:00' | |||||
| and date_format(update_date,'%w') in (1,2,3,4)) | |||||
| and ((date_format(co.update_date,'%H:%m') >= '18:00' | |||||
| and date_format(co.update_date,'%w') in (1,2,3,4)) | |||||
| or | or | ||||
| ((date_format(update_date,'%H:%m') < '06:00') | |||||
| and date_format(update_date,'%w') in (1,2,3,4,5))) | |||||
| ((date_format(co.update_date,'%H:%m') < '06:00') | |||||
| and date_format(co.update_date,'%w') in (1,2,3,4,5))) | |||||
| </if> | </if> | ||||
| <if test=" 2 == timeSlot"> | <if test=" 2 == timeSlot"> | ||||
| and date_format(update_date,'%H:%m') >= '06:00' | |||||
| and date_format(update_date,'%H:%m') < '18:00' | |||||
| and date_format(update_date,'%w') in (0,6) | |||||
| and date_format(co.update_date,'%H:%m') >= '06:00' | |||||
| and date_format(co.update_date,'%H:%m') < '18:00' | |||||
| and date_format(co.update_date,'%w') in (0,6) | |||||
| </if> | </if> | ||||
| <if test=" 3 == timeSlot"> | <if test=" 3 == timeSlot"> | ||||
| and ((date_format(update_date,'%H:%m') >= '18:00' | |||||
| and date_format(update_date,'%w') in (5,6,0)) | |||||
| and ((date_format(co.update_date,'%H:%m') >= '18:00' | |||||
| and date_format(co.update_date,'%w') in (5,6,0)) | |||||
| or | or | ||||
| ((date_format(update_date,'%H:%m') < '06:00') | |||||
| and date_format(update_date,'%w') in (6,0))) | |||||
| ((date_format(co.update_date,'%H:%m') < '06:00') | |||||
| and date_format(co.update_date,'%w') in (6,0))) | |||||
| </if> | </if> | ||||
| </if> | </if> | ||||
| <if test=" 1 != couponOrderStatus"> | <if test=" 1 != couponOrderStatus"> | ||||
| <if test=" null != startTime"> | <if test=" null != startTime"> | ||||
| and create_date >= #{startTime} | |||||
| and co.create_date >= #{startTime} | |||||
| </if> | </if> | ||||
| <if test=" null != endTime"> | <if test=" null != endTime"> | ||||
| and create_date <= #{endTime} | |||||
| and co.create_date <= #{endTime} | |||||
| </if> | </if> | ||||
| <if test=" 0 == timeSlot"> | <if test=" 0 == timeSlot"> | ||||
| and date_format(create_date,'%H:%m') >= '06:00' | |||||
| and date_format(create_date,'%H:%m') < '18:00' | |||||
| and date_format(create_date,'%w') in (1,2,3,4,5) | |||||
| and date_format(co.create_date,'%H:%m') >= '06:00' | |||||
| and date_format(co.create_date,'%H:%m') < '18:00' | |||||
| and date_format(co.create_date,'%w') in (1,2,3,4,5) | |||||
| </if> | </if> | ||||
| <if test=" 1 == timeSlot"> | <if test=" 1 == timeSlot"> | ||||
| and ((date_format(create_date,'%H:%m') >= '18:00' | |||||
| and date_format(create_date,'%w') in (1,2,3,4)) | |||||
| and ((date_format(co.create_date,'%H:%m') >= '18:00' | |||||
| and date_format(co.create_date,'%w') in (1,2,3,4)) | |||||
| or | or | ||||
| ((date_format(create_date,'%H:%m') < '06:00') | |||||
| and date_format(create_date,'%w') in (1,2,3,4,5))) | |||||
| ((date_format(co.create_date,'%H:%m') < '06:00') | |||||
| and date_format(co.create_date,'%w') in (1,2,3,4,5))) | |||||
| </if> | </if> | ||||
| <if test=" 2 == timeSlot"> | <if test=" 2 == timeSlot"> | ||||
| and date_format(create_date,'%H:%m') >= '06:00' | |||||
| and date_format(create_date,'%H:%m') < '18:00' | |||||
| and date_format(create_date,'%w') in (0,6) | |||||
| and date_format(co.create_date,'%H:%m') >= '06:00' | |||||
| and date_format(co.create_date,'%H:%m') < '18:00' | |||||
| and date_format(co.create_date,'%w') in (0,6) | |||||
| </if> | </if> | ||||
| <if test=" 3 == timeSlot"> | <if test=" 3 == timeSlot"> | ||||
| and ((date_format(create_date,'%H:%m') >= '18:00' | |||||
| and date_format(create_date,'%w') in (5,6,0)) | |||||
| and ((date_format(co.create_date,'%H:%m') >= '18:00' | |||||
| and date_format(co.create_date,'%w') in (5,6,0)) | |||||
| or | or | ||||
| ((date_format(create_date,'%H:%m') < '06:00') | |||||
| and date_format(create_date,'%w') in (6,0))) | |||||
| ((date_format(co.create_date,'%H:%m') < '06:00') | |||||
| and date_format(co.create_date,'%w') in (6,0))) | |||||
| </if> | </if> | ||||
| </if> | </if> | ||||
| </select> | </select> | ||||