| @@ -218,4 +218,14 @@ public class WxCouponChannelController extends BaseController { | |||||
| } | } | ||||
| @ApiOperation("获取poi数据") | |||||
| @GetMapping("getChannelPoi") | |||||
| public ResultData getChannelPoi(Long id) { | |||||
| if (null == id){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | |||||
| return wxCouponChannelService.getCouponChannelPoi(getTenantInfo(),id); | |||||
| } | |||||
| } | } | ||||
| @@ -14,10 +14,7 @@ import com.iformall.domain.vo.WxCouponCVo; | |||||
| import com.iformall.domain.vo.WxCouponOrderCVo; | import com.iformall.domain.vo.WxCouponOrderCVo; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.service.MemCouponFromDspService; | |||||
| import com.iformall.service.SysConfigService; | |||||
| import com.iformall.service.WxCouponOrderService; | |||||
| import com.iformall.service.WxCouponService; | |||||
| import com.iformall.service.*; | |||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| @@ -61,6 +58,9 @@ public class WxCouponOrderController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| SysConfigService sysConfigService; | SysConfigService sysConfigService; | ||||
| @Autowired | |||||
| private WxPayOrderService wxPayOrderService; | |||||
| //@RedisCache(expireTime = 100) | //@RedisCache(expireTime = 100) | ||||
| @ApiOperation("券包分页列表接口") | @ApiOperation("券包分页列表接口") | ||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @@ -522,4 +522,41 @@ public class WxCouponOrderController extends BaseController { | |||||
| return new ResultData(couponOrder); | return new ResultData(couponOrder); | ||||
| } | } | ||||
| @ApiOperation("获取支付订单") | |||||
| @GetMapping("getChannelPoi") | |||||
| public ResultData getChannelPoi(Long id) { | |||||
| if (null == id){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | |||||
| WxCUserBasicInfo member; | |||||
| try { | |||||
| member = getCacheMember(); | |||||
| } catch (Exception e) { | |||||
| return new ResultData(Result.ERROR,e.getMessage()); | |||||
| } | |||||
| WxCouponOrder wxCouponOrder = wxCouponOrderService.getById(id,getTenantInfo().getTenantId()); | |||||
| if (wxCouponOrder == null) { | |||||
| logger.error("券ID不存在:" + id); | |||||
| return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); | |||||
| } | |||||
| if(!member.getId().equals(wxCouponOrder.getCUserId())){ | |||||
| logger.error("此券不属于此人:" + member.getId()); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||||
| } | |||||
| try{ | |||||
| WxPayOrder payOrderQ = new WxPayOrder(); | |||||
| payOrderQ.updateTenantInfo(getTenantInfo()); | |||||
| payOrderQ.setCUserId(member.getId()); | |||||
| payOrderQ.setOrderId(wxCouponOrder.getComposeOrderId()); | |||||
| payOrderQ.setPayOrderStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); | |||||
| WxPayOrder payOrder = wxPayOrderService.getByObj(payOrderQ); | |||||
| return new ResultData(payOrder); | |||||
| }catch(MallinkException e) { | |||||
| return new ResultData(e.getErrorCode(),e.getMessage()); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -1,26 +1,30 @@ | |||||
| //package com.iformall.schedule; | |||||
| // | |||||
| //import com.iformall.domain.po.*; | |||||
| //import com.iformall.enums.EnumSupplierMathStatus; | |||||
| //import com.iformall.enums.EnumSupplierSyncStatus; | |||||
| //import com.iformall.service.TtMerchantPoiService; | |||||
| //import org.slf4j.Logger; | |||||
| //import org.slf4j.LoggerFactory; | |||||
| //import org.springframework.beans.factory.annotation.Autowired; | |||||
| //import org.springframework.scheduling.annotation.Async; | |||||
| //import org.springframework.scheduling.annotation.Scheduled; | |||||
| //import org.springframework.stereotype.Component; | |||||
| // | |||||
| //import java.util.List; | |||||
| // | |||||
| //@Component | |||||
| //public class TtMerchantPoiSchedule { | |||||
| // | |||||
| // private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| // | |||||
| // @Autowired | |||||
| // private TtMerchantPoiService ttMerchantPoiService; | |||||
| // | |||||
| package com.iformall.schedule; | |||||
| import com.iformall.domain.po.*; | |||||
| import com.iformall.enums.EnumSpuSyncStatus; | |||||
| import com.iformall.enums.EnumSupplierMathStatus; | |||||
| import com.iformall.mapper.TtCouponChannelPoiMapper; | |||||
| import com.iformall.service.TtMerchantPoiService; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.scheduling.annotation.Async; | |||||
| import org.springframework.scheduling.annotation.Scheduled; | |||||
| import org.springframework.stereotype.Component; | |||||
| import java.util.List; | |||||
| @Component | |||||
| public class TtMerchantPoiSchedule { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private TtMerchantPoiService ttMerchantPoiService; | |||||
| @Autowired | |||||
| private TtCouponChannelPoiMapper ttCouponChannelPoiMapper; | |||||
| // @Async | // @Async | ||||
| // @Scheduled(cron = "0 0 */1 * * *?") // 每小时检查一次 | // @Scheduled(cron = "0 0 */1 * * *?") // 每小时检查一次 | ||||
| // public void supplierQueryTaskSchedule() { | // public void supplierQueryTaskSchedule() { | ||||
| @@ -54,5 +58,22 @@ | |||||
| // } | // } | ||||
| // } | // } | ||||
| // } | // } | ||||
| // | |||||
| //} | |||||
| @Async | |||||
| @Scheduled(cron = "0 0 */1 * * *?") // 每小时检查一次 | |||||
| public void supplierQueryTaskSchedule() { | |||||
| TtCouponChannelPoi ttCouponChannelPoi = new TtCouponChannelPoi(); | |||||
| ttCouponChannelPoi.setLastStatus(EnumSpuSyncStatus.sync_auditing.getCode()); | |||||
| List<TtCouponChannelPoi> list = ttCouponChannelPoiMapper.findList(ttCouponChannelPoi); | |||||
| if(list != null && list.size() > 0){ | |||||
| for (TtCouponChannelPoi poi:list) { | |||||
| try{ | |||||
| ttMerchantPoiService.spuGet(poi,poi.getId()); | |||||
| }catch(Exception e){ | |||||
| logger.error("查询商品同步任务失败"); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,43 @@ | |||||
| package com.iformall.domain.po; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import com.google.gson.JsonObject; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.utils.Constant; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| import java.math.BigDecimal; | |||||
| import java.util.Date; | |||||
| @TableName(value = "tt_coupon_channel_poi") | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class TtCouponChannelPoi extends TenantEntity { | |||||
| protected Long id;//coupon_channel_id | |||||
| @io.swagger.annotations.ApiModelProperty(value="spuId",name="spuId") | |||||
| private String spuId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="状态:0-审核中,1-上架,2-下架,3-审核拒绝 4-审核通过",name="status") | |||||
| private Integer status; | |||||
| @io.swagger.annotations.ApiModelProperty(value="描述",name="statusDesc") | |||||
| private String statusDesc; | |||||
| @io.swagger.annotations.ApiModelProperty(value="状态:0-审核中,1-上架,2-下架,3-审核拒绝 4-审核通过",name="lastStatus") | |||||
| private Integer lastStatus; | |||||
| @io.swagger.annotations.ApiModelProperty(value="描述",name="lastStatusDesc") | |||||
| private String lastStatusDesc; | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||||
| private Date createDate; | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||||
| private Date updateDate; | |||||
| } | |||||
| @@ -0,0 +1,40 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumSpuSyncStatus { | |||||
| // 状态:0-审核中,1-上架,2-下架,3-审核拒绝 4-审核通过 | |||||
| // sync_update(-1, "等待重新同步"), | |||||
| sync_auditing(0, "审核中"), | |||||
| sync_put_on(1, "上架"), | |||||
| sync_pull_off(2, "下架"), | |||||
| sync_audit_rejection(3, "审核拒绝"), | |||||
| sync_audit_pass(4, "审核通过"), | |||||
| ; | |||||
| public static EnumSpuSyncStatus getEnum(Integer code) { | |||||
| for (EnumSpuSyncStatus value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumSpuSyncStatus(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,14 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.TtCouponChannelPoi; | |||||
| import java.util.List; | |||||
| public interface TtCouponChannelPoiMapper extends CommonMapper<TtCouponChannelPoi, Long> { | |||||
| List<TtCouponChannelPoi> findList(TtCouponChannelPoi record); | |||||
| List<Long> findIdList(TtCouponChannelPoi record); | |||||
| } | |||||
| @@ -67,5 +67,6 @@ public interface WxCouponChannelService { | |||||
| void setChannelStock(WxCouponChannel record,Integer number); | void setChannelStock(WxCouponChannel record,Integer number); | ||||
| void releaseChannelStock(WxCouponChannel record); | void releaseChannelStock(WxCouponChannel record); | ||||
| void setChannelPrice(WxCouponChannel record); | void setChannelPrice(WxCouponChannel record); | ||||
| ResultData getCouponChannelPoi(TenantEntity tenantInfo, Long id); | |||||
| } | } | ||||
| @@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.google.gson.JsonArray; | import com.google.gson.JsonArray; | ||||
| import com.google.gson.JsonElement; | |||||
| import com.google.gson.JsonObject; | import com.google.gson.JsonObject; | ||||
| import com.google.gson.JsonParser; | import com.google.gson.JsonParser; | ||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| @@ -55,6 +54,9 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { | |||||
| @Autowired | @Autowired | ||||
| WxCouponChannelMapper wxCouponChannelMapper; | WxCouponChannelMapper wxCouponChannelMapper; | ||||
| @Autowired | |||||
| TtCouponChannelPoiMapper ttCouponChannelPoiMapper; | |||||
| @Autowired | @Autowired | ||||
| WxCouponMapper wxCouponMapper; | WxCouponMapper wxCouponMapper; | ||||
| @@ -605,9 +607,31 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { | |||||
| ccUpd.setTtSpuId(spuId); | ccUpd.setTtSpuId(spuId); | ||||
| ccUpd.setUpdateDate(new Date()); | ccUpd.setUpdateDate(new Date()); | ||||
| wxCouponChannelMapper.updateById(ccUpd); | wxCouponChannelMapper.updateById(ccUpd); | ||||
| syncCouponChannelPoi(ccUpd); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| private void syncCouponChannelPoi(WxCouponChannel ccUpd){ | |||||
| TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(ccUpd.getId()); | |||||
| if(ttCouponChannelPoi != null){ | |||||
| ttCouponChannelPoi.setLastStatus(EnumSpuSyncStatus.sync_auditing.getCode()); | |||||
| ttCouponChannelPoi.setLastStatusDesc(""); | |||||
| ttCouponChannelPoi.setUpdateDate(ccUpd.getUpdateDate()); | |||||
| ttCouponChannelPoiMapper.updateById(ttCouponChannelPoi); | |||||
| }else{ | |||||
| ttCouponChannelPoi = new TtCouponChannelPoi(); | |||||
| ttCouponChannelPoi.setId(ccUpd.getId()); | |||||
| ttCouponChannelPoi.updateTenantInfo(ccUpd); | |||||
| ttCouponChannelPoi.setSpuId(ccUpd.getTtSpuId()); | |||||
| ttCouponChannelPoi.setStatus(EnumSpuSyncStatus.sync_auditing.getCode()); | |||||
| ttCouponChannelPoi.setLastStatus(EnumSpuSyncStatus.sync_auditing.getCode()); | |||||
| ttCouponChannelPoi.setCreateDate(ccUpd.getUpdateDate()); | |||||
| ttCouponChannelPoi.setUpdateDate(ccUpd.getUpdateDate()); | |||||
| ttCouponChannelPoiMapper.insert(ttCouponChannelPoi); | |||||
| } | |||||
| } | |||||
| private String spuSync(WxCoupon coupon,WxCouponChannel couponChannel, List<Long> merchantIds){ | private String spuSync(WxCoupon coupon,WxCouponChannel couponChannel, List<Long> merchantIds){ | ||||
| TtSpuSync spuSync = new TtSpuSync(); | TtSpuSync spuSync = new TtSpuSync(); | ||||
| spuSync.setEntryInfo(getEntryInfo(couponChannel)); | spuSync.setEntryInfo(getEntryInfo(couponChannel)); | ||||
| @@ -759,6 +783,7 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { | |||||
| spuGet.setSpuDraftcount(3); | spuGet.setSpuDraftcount(3); | ||||
| try { | try { | ||||
| TtSpuGetResult spuGetResult = getTtWebService(tenantInfo).getProductService().spuGet(spuGet); | TtSpuGetResult spuGetResult = getTtWebService(tenantInfo).getProductService().spuGet(spuGet); | ||||
| handSyncCouponChannelPoi(tenantInfo,spuGetResult); | |||||
| //处理一下数据 | //处理一下数据 | ||||
| Map<String,Object> map = new HashMap<>(); | Map<String,Object> map = new HashMap<>(); | ||||
| if(spuGetResult.getSpuDetail() != null){//线上数据 | if(spuGetResult.getSpuDetail() != null){//线上数据 | ||||
| @@ -776,6 +801,60 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { | |||||
| } | } | ||||
| } | } | ||||
| private void handSyncCouponChannelPoi(TenantEntity tenantInfo,TtSpuGetResult spuGetResult){ | |||||
| Date now = new Date(); | |||||
| TtSpuSync spuDetail = spuGetResult.getSpuDetail(); | |||||
| if(spuDetail != null && StringUtils.isNotBlank(spuDetail.getSpuId()) && StringUtils.isNotBlank(spuDetail.getSpuExtId()) | |||||
| && spuDetail.getStatus() != null){ | |||||
| TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(Long.parseLong(spuDetail.getSpuExtId())); | |||||
| if(ttCouponChannelPoi != null && !spuDetail.getStatus().equals(ttCouponChannelPoi.getStatus())){ | |||||
| TtCouponChannelPoi ccPoi = new TtCouponChannelPoi(); | |||||
| ccPoi.setId(ttCouponChannelPoi.getId()); | |||||
| ccPoi.setStatus(spuDetail.getStatus()); | |||||
| ccPoi.setStatusDesc(spuDetail.getStatusDesc()); | |||||
| ccPoi.setUpdateDate(now); | |||||
| ttCouponChannelPoiMapper.updateById(ccPoi); | |||||
| }else if(ttCouponChannelPoi == null){ | |||||
| ttCouponChannelPoi = new TtCouponChannelPoi(); | |||||
| ttCouponChannelPoi.setId(Long.parseLong(spuDetail.getSpuExtId())); | |||||
| ttCouponChannelPoi.updateTenantInfo(tenantInfo); | |||||
| ttCouponChannelPoi.setSpuId(spuDetail.getSpuId()); | |||||
| ttCouponChannelPoi.setStatus(spuDetail.getStatus()); | |||||
| ttCouponChannelPoi.setStatusDesc(spuDetail.getStatusDesc()); | |||||
| ttCouponChannelPoi.setCreateDate(now); | |||||
| ttCouponChannelPoi.setUpdateDate(now); | |||||
| ttCouponChannelPoiMapper.insert(ttCouponChannelPoi); | |||||
| } | |||||
| } | |||||
| List<TtSpuSync> spuDraftList = spuGetResult.getSpuDraft(); | |||||
| if(spuDraftList != null && spuDraftList.size() > 0){ | |||||
| TtSpuSync spuDraft = spuDraftList.get(0); | |||||
| if(spuDraft != null && StringUtils.isNotBlank(spuDraft.getSpuId()) && StringUtils.isNotBlank(spuDraft.getSpuExtId()) | |||||
| && spuDraft.getStatus() != null){ | |||||
| TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(Long.parseLong(spuDraft.getSpuExtId())); | |||||
| if(ttCouponChannelPoi != null && !spuDraft.getStatus().equals(ttCouponChannelPoi.getStatus())){ | |||||
| TtCouponChannelPoi ccPoi = new TtCouponChannelPoi(); | |||||
| ccPoi.setId(ttCouponChannelPoi.getId()); | |||||
| ccPoi.setLastStatus(spuDraft.getStatus()); | |||||
| ccPoi.setLastStatusDesc(spuDraft.getStatusDesc()); | |||||
| ccPoi.setUpdateDate(now); | |||||
| ttCouponChannelPoiMapper.updateById(ccPoi); | |||||
| }else if(ttCouponChannelPoi == null){ | |||||
| ttCouponChannelPoi = new TtCouponChannelPoi(); | |||||
| ttCouponChannelPoi.setId(Long.parseLong(spuDetail.getSpuExtId())); | |||||
| ttCouponChannelPoi.updateTenantInfo(tenantInfo); | |||||
| ttCouponChannelPoi.setSpuId(spuDraft.getSpuId()); | |||||
| ttCouponChannelPoi.setStatus(EnumSpuSyncStatus.sync_auditing.getCode()); | |||||
| ttCouponChannelPoi.setLastStatus(spuDraft.getStatus()); | |||||
| ttCouponChannelPoi.setLastStatusDesc(spuDraft.getStatusDesc()); | |||||
| ttCouponChannelPoi.setCreateDate(now); | |||||
| ttCouponChannelPoi.setUpdateDate(now); | |||||
| ttCouponChannelPoiMapper.insert(ttCouponChannelPoi); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| private Map<String,Object> handSpuSync(TtSpuSync spuSync){ | private Map<String,Object> handSpuSync(TtSpuSync spuSync){ | ||||
| Map<String,Object> map = new HashMap<>(); | Map<String,Object> map = new HashMap<>(); | ||||
| map.put("id",spuSync.getSpuExtId()); | map.put("id",spuSync.getSpuExtId()); | ||||
| @@ -6,6 +6,7 @@ import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.TtCouponChannelPoi; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.domain.po.WxCouponChannel; | import com.iformall.domain.po.WxCouponChannel; | ||||
| @@ -56,6 +57,9 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| WxMerchantMapper wxMerchantMapper; | WxMerchantMapper wxMerchantMapper; | ||||
| @Autowired | @Autowired | ||||
| WxCouponMerchantMapper wxCouponMerchantMapper; | WxCouponMerchantMapper wxCouponMerchantMapper; | ||||
| @Autowired | |||||
| TtCouponChannelPoiMapper ttCouponChannelPoiMapper; | |||||
| @Lazy | @Lazy | ||||
| @Autowired | @Autowired | ||||
| @@ -727,5 +731,14 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| wxCouponChannelMapper.setChannelPrice(record.getId(), record.getTenantId(), record.getChannelPrice()); | wxCouponChannelMapper.setChannelPrice(record.getId(), record.getTenantId(), record.getChannelPrice()); | ||||
| } | } | ||||
| @Override | |||||
| public ResultData getCouponChannelPoi(TenantEntity tenantInfo, Long id) { | |||||
| TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(id); | |||||
| if(ttCouponChannelPoi != null && ttCouponChannelPoi.getStatus() != null && ttCouponChannelPoi.getStatus().intValue() > 0){ | |||||
| return new ResultData(ttCouponChannelPoi); | |||||
| } | |||||
| return new ResultData(ErrorCode.SYS_NULLPOINTER_ERROR.getCode(),"未找到可用的数据"); | |||||
| } | |||||
| } | } | ||||
| @@ -1326,7 +1326,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| }else if(list != null && list.size() > 1){ | }else if(list != null && list.size() > 1){ | ||||
| throw new MallinkException(ErrorCode.PAY_ORDER_ERROR); | throw new MallinkException(ErrorCode.PAY_ORDER_ERROR); | ||||
| } | } | ||||
| return null; | |||||
| throw new MallinkException(ErrorCode.PAY_ORDER_NOT_FOUND); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -0,0 +1,80 @@ | |||||
| <?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.TtCouponChannelPoiMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.TtCouponChannelPoi"> | |||||
| <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="spu_id" jdbcType="VARCHAR" property="spuId"/> | |||||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||||
| <result column="status_desc" jdbcType="VARCHAR" property="statusDesc"/> | |||||
| <result column="last_status" jdbcType="INTEGER" property="lastStatus"/> | |||||
| <result column="last_status_desc" jdbcType="VARCHAR" property="lastStatusDesc"/> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`spu_id`, | |||||
| `status`,`status_desc`,`last_status`,`last_status_desc`, | |||||
| `create_date`,`update_date` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where is_del = 0 | |||||
| <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 != spuId and '' != spuId"> | |||||
| and `spu_id` = #{spuId} | |||||
| </if> | |||||
| <if test=" null != status"> | |||||
| and `status` = #{status} | |||||
| </if> | |||||
| <if test=" null != lastStatus"> | |||||
| and `last_status` = #{lastStatus} | |||||
| </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.iformall.domain.po.TtCouponChannelPoi" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from tt_coupon_channel_poi | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| <select id="findIdList" parameterType="com.iformall.domain.po.TtCouponChannelPoi" resultType="Long"> | |||||
| select id | |||||
| from tt_coupon_channel_poi | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| <update id="deleteByUpdate" parameterType="Long"> | |||||
| update tt_coupon_channel_poi set is_del = 1 | |||||
| where id = #{id} | |||||
| </update> | |||||
| </mapper> | |||||