初始化提交

This commit is contained in:
USER-20221017CE\Administrator
2022-11-01 12:14:54 +08:00
commit d31fad2aa9
1733 changed files with 370203 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
package com.tuling.tulingmall;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ApplicationContext;
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, DruidDataSourceAutoConfigure.class})
public class TulingmallOrderHistoryApplication {
private static ApplicationContext applicationContext;
public static void main(String[] args) {
applicationContext = SpringApplication.run(TulingmallOrderHistoryApplication.class, args);
}
public static <T> T getBean(String beanName) {
return applicationContext != null ? (T) applicationContext.getBean(beanName) : null;
}
}

View File

@@ -0,0 +1,33 @@
package com.tuling.tulingmall.history.config;
import com.mongodb.ReadConcern;
import com.mongodb.ReadPreference;
import com.mongodb.TransactionOptions;
import com.mongodb.WriteConcern;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.MongoDatabaseFactory;
import org.springframework.data.mongodb.MongoTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@EnableTransactionManagement
public class MongoDbConfig {
// @Bean("mongoTransactionManager")
// MongoTransactionManager transactionManager(MongoDatabaseFactory factory){
// return new MongoTransactionManager(factory);
// }
@Bean
MongoTransactionManager transactionManager(MongoDatabaseFactory factory){
//事务操作配置
TransactionOptions txnOptions = TransactionOptions.builder()
.readPreference(ReadPreference.primary())
.readConcern(ReadConcern.MAJORITY)
.writeConcern(WriteConcern.MAJORITY)
.build();
return new MongoTransactionManager(factory,txnOptions);
}
}

View File

@@ -0,0 +1,14 @@
package com.tuling.tulingmall.history.config;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Configuration;
/**
* MyBatis配置类
*/
@Configuration
@MapperScan({"com.tuling.tulingmall.history.mapper","com.tuling.tulingmall.history.dao"})
public class MyBatisConfig {
}

View File

@@ -0,0 +1,80 @@
package com.tuling.tulingmall.history.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.ApiKey;
import springfox.documentation.service.AuthorizationScope;
import springfox.documentation.service.SecurityReference;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.ArrayList;
import java.util.List;
/**
* Swagger2API文档的配置
*/
@Configuration
@EnableSwagger2
public class Swagger2Config {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("com.tuling.tulingmall.history.controller"))
.paths(PathSelectors.any())
.build()
.securitySchemes(securitySchemes())
.securityContexts(securityContexts());
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("tuling-mall历史订单系统")
.description("tuling-mall历史订单系统")
.contact("tuling")
.version("1.0")
.build();
}
private List<ApiKey> securitySchemes() {
//设置请求头信息
List<ApiKey> result = new ArrayList<>();
ApiKey apiKey = new ApiKey("Authorization", "Authorization", "header");
result.add(apiKey);
return result;
}
private List<SecurityContext> securityContexts() {
//设置需要登录认证的路径
List<SecurityContext> result = new ArrayList<>();
result.add(getContextByPath("/member/.*"));
result.add(getContextByPath("/cart/.*"));
result.add(getContextByPath("/order/.*"));
result.add(getContextByPath("/returnApply/.*"));
return result;
}
private SecurityContext getContextByPath(String pathRegex) {
return SecurityContext.builder()
.securityReferences(defaultAuth())
.forPaths(PathSelectors.regex(pathRegex))
.build();
}
private List<SecurityReference> defaultAuth() {
List<SecurityReference> result = new ArrayList<>();
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope;
result.add(new SecurityReference("Authorization", authorizationScopes));
return result;
}
}

View File

@@ -0,0 +1,28 @@
package com.tuling.tulingmall.history.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.sql.DataSource;
/**
* @author :楼兰
* @description: 分布式事务配置
**/
@Configuration
@EnableTransactionManagement
public class TransactionConfig {
@Bean("dbTransactionManager")
public PlatformTransactionManager txManager(final DataSource dataSource){
return new DataSourceTransactionManager(dataSource);
}
@Bean
public JdbcTemplate jdbcTemplate(final DataSource dataSource) {
return new JdbcTemplate(dataSource);
}
}

View File

@@ -0,0 +1,48 @@
package com.tuling.tulingmall.history.controller;
import com.tuling.tulingmall.history.service.MigrateCentreService;
import com.tuling.tulingmall.history.service.impl.OrderConstant;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 订单迁移管理Controller
*/
@Slf4j
@RestController
@Api(tags = "OrderMigrateController",description = "订单迁移管理")
@RequestMapping("/order/migrate")
public class OrderMigrateController {
@Autowired
private MigrateCentreService migrateCentreService;
@ApiOperation("指定数据表执行数据迁移")
@RequestMapping(value = "/specificTableMigrate",method = {RequestMethod.POST,RequestMethod.GET})
public String migrateSpecificTable(@RequestParam int tableNo){
return migrateCentreService.migrateSingleTableOrders(tableNo);
}
@ApiOperation("全部数据表进行迁移")
@RequestMapping(value = "/migrateTables",method = {RequestMethod.POST,RequestMethod.GET})
public String migrateTables(){
return migrateCentreService.migrateTablesOrders();
}
@ApiOperation("停止迁移")
@RequestMapping(value = "/stopMigrate",method = {RequestMethod.POST,RequestMethod.GET})
public String stopRoundMigrate(){
migrateCentreService.stopMigrate();
return OrderConstant.MIGRATE_SUCCESS;
}
@ApiOperation("恢复迁移")
@RequestMapping(value = "/recoverMigrate",method = {RequestMethod.POST,RequestMethod.GET})
public String recoverMigrate(){
migrateCentreService.recoverMigrate();
return OrderConstant.MIGRATE_SUCCESS;
}
}

View File

@@ -0,0 +1,24 @@
package com.tuling.tulingmall.history.controller;
import com.tuling.tulingmall.history.service.MigrateCentreService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
/**
* 查询历史订单Controller
*/
@Slf4j
@Controller
@Api(tags = "QueryOrderHistoryController",description = "查询历史订单")
@RequestMapping("/order/history")
public class QueryOrderHistoryController {
// TODO fox 实现对历史订单的查询
}

View File

@@ -0,0 +1,32 @@
package com.tuling.tulingmall.history.dao;
import com.tuling.tulingmall.history.domain.OmsOrderDetail;
import com.tuling.tulingmall.history.model.OmsOrderItem;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* 订单迁移自定义Dao
*/
@Mapper
public interface PortalOrderDao {
List<OmsOrderDetail> getRangeOrders(
@Param("orderTableName") String orderTableName,
@Param("orderItemTableName") String orderItemTableName,
@Param("orderId") Long maxOrderId,
@Param("gmtCreate") Date gmtCreate,
@Param("fetchRecordNumbers") int fetchRecordNumbers);
int deleteMigrateOrdersItems(@Param("orderItemTableName") String orderItemTableName,
@Param("minOrderId") Long minOrderId,
@Param("maxOrderId") Long maxOrderId);
int deleteMigrateOrders(@Param("orderTableName") String orderTableName,
@Param("minOrderId") Long minOrderId,
@Param("maxOrderId") Long maxOrderId);
}

View File

@@ -0,0 +1,14 @@
package com.tuling.tulingmall.history.domain;
import lombok.Data;
import org.springframework.data.mongodb.core.mapping.Document;
@Document("table-order-id")
@Data
public class MongoOrderId {
private String tableName;
private Long maxOrderId;
}

View File

@@ -0,0 +1,24 @@
package com.tuling.tulingmall.history.domain;
import com.tuling.tulingmall.history.model.OmsOrder;
import com.tuling.tulingmall.history.model.OmsOrderItem;
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.List;
/**
* 包含订单商品信息的订单详情
*/
@Document("orderhistory")
public class OmsOrderDetail extends OmsOrder {
private List<OmsOrderItem> orderItemList;
public List<OmsOrderItem> getOrderItemList() {
return orderItemList;
}
public void setOrderItemList(List<OmsOrderItem> orderItemList) {
this.orderItemList = orderItemList;
}
}

View File

@@ -0,0 +1,31 @@
package com.tuling.tulingmall.history.mapper;
import com.tuling.tulingmall.history.model.OmsOrderItem;
import com.tuling.tulingmall.history.model.OmsOrderItemExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface OmsOrderItemMapper {
long countByExample(OmsOrderItemExample example);
int deleteByExample(OmsOrderItemExample example);
int deleteByPrimaryKey(Long id);
int insert(OmsOrderItem record);
int insertSelective(OmsOrderItem record);
List<OmsOrderItem> selectByExample(OmsOrderItemExample example);
OmsOrderItem selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") OmsOrderItem record, @Param("example") OmsOrderItemExample example);
int updateByExample(@Param("record") OmsOrderItem record, @Param("example") OmsOrderItemExample example);
int updateByPrimaryKeySelective(OmsOrderItem record);
int updateByPrimaryKey(OmsOrderItem record);
}

View File

@@ -0,0 +1,33 @@
package com.tuling.tulingmall.history.mapper;
import com.tuling.tulingmall.history.model.OmsOrder;
import com.tuling.tulingmall.history.model.OmsOrderExample;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
public interface OmsOrderMapper{
long countByExample(OmsOrderExample example);
int deleteByExample(OmsOrderExample example);
int deleteByPrimaryKey(Long id);
int insert(OmsOrder record);
int insertSelective(OmsOrder record);
List<OmsOrder> selectByExample(OmsOrderExample example);
OmsOrder selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") OmsOrder record, @Param("example") OmsOrderExample example);
int updateByExample(@Param("record") OmsOrder record, @Param("example") OmsOrderExample example);
int updateByPrimaryKeySelective(OmsOrder record);
int updateByPrimaryKey(OmsOrder record);
}

View File

@@ -0,0 +1,593 @@
package com.tuling.tulingmall.history.model;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
public class OmsOrder implements Serializable {
@ApiModelProperty(value = "订单id")
private Long id;
private Long memberId;
private Long couponId;
@ApiModelProperty(value = "订单编号")
private String orderSn;
@ApiModelProperty(value = "提交时间")
private Date createTime;
@ApiModelProperty(value = "用户帐号")
private String memberUsername;
@ApiModelProperty(value = "订单总金额")
private BigDecimal totalAmount;
@ApiModelProperty(value = "应付金额(实际支付金额)")
private BigDecimal payAmount;
@ApiModelProperty(value = "运费金额")
private BigDecimal freightAmount;
@ApiModelProperty(value = "促销优化金额(促销价、满减、阶梯价)")
private BigDecimal promotionAmount;
@ApiModelProperty(value = "积分抵扣金额")
private BigDecimal integrationAmount;
@ApiModelProperty(value = "优惠券抵扣金额")
private BigDecimal couponAmount;
@ApiModelProperty(value = "管理员后台调整订单使用的折扣金额")
private BigDecimal discountAmount;
@ApiModelProperty(value = "支付方式0->未支付1->支付宝2->微信")
private Integer payType;
@ApiModelProperty(value = "订单来源0->PC订单1->app订单")
private Integer sourceType;
@ApiModelProperty(value = "订单状态0->待付款1->待发货2->已发货3->已完成4->已关闭5->无效订单")
private Integer status;
@ApiModelProperty(value = "订单类型0->正常订单1->秒杀订单")
private Integer orderType;
@ApiModelProperty(value = "物流公司(配送方式)")
private String deliveryCompany;
@ApiModelProperty(value = "物流单号")
private String deliverySn;
@ApiModelProperty(value = "自动确认时间(天)")
private Integer autoConfirmDay;
@ApiModelProperty(value = "可以获得的积分")
private Integer integration;
@ApiModelProperty(value = "可以活动的成长值")
private Integer growth;
@ApiModelProperty(value = "活动信息")
private String promotionInfo;
@ApiModelProperty(value = "发票类型0->不开发票1->电子发票2->纸质发票")
private Integer billType;
@ApiModelProperty(value = "发票抬头")
private String billHeader;
@ApiModelProperty(value = "发票内容")
private String billContent;
@ApiModelProperty(value = "收票人电话")
private String billReceiverPhone;
@ApiModelProperty(value = "收票人邮箱")
private String billReceiverEmail;
@ApiModelProperty(value = "收货人姓名")
private String receiverName;
@ApiModelProperty(value = "收货人电话")
private String receiverPhone;
@ApiModelProperty(value = "收货人邮编")
private String receiverPostCode;
@ApiModelProperty(value = "省份/直辖市")
private String receiverProvince;
@ApiModelProperty(value = "城市")
private String receiverCity;
@ApiModelProperty(value = "")
private String receiverRegion;
@ApiModelProperty(value = "详细地址")
private String receiverDetailAddress;
@ApiModelProperty(value = "订单备注")
private String note;
@ApiModelProperty(value = "确认收货状态0->未确认1->已确认")
private Integer confirmStatus;
@ApiModelProperty(value = "删除状态0->未删除1->已删除")
private Integer deleteStatus;
@ApiModelProperty(value = "下单时使用的积分")
private Integer useIntegration;
@ApiModelProperty(value = "支付时间")
private Date paymentTime;
@ApiModelProperty(value = "发货时间")
private Date deliveryTime;
@ApiModelProperty(value = "确认收货时间")
private Date receiveTime;
@ApiModelProperty(value = "评价时间")
private Date commentTime;
@ApiModelProperty(value = "修改时间")
private Date modifyTime;
@ApiModelProperty(value = "支付二维码地址")
private String qrcode;
private Date gmtCreate;
private Date gmtModified;
private Integer version;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getMemberId() {
return memberId;
}
public void setMemberId(Long memberId) {
this.memberId = memberId;
}
public Long getCouponId() {
return couponId;
}
public void setCouponId(Long couponId) {
this.couponId = couponId;
}
public String getOrderSn() {
return orderSn;
}
public void setOrderSn(String orderSn) {
this.orderSn = orderSn;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getMemberUsername() {
return memberUsername;
}
public void setMemberUsername(String memberUsername) {
this.memberUsername = memberUsername;
}
public BigDecimal getTotalAmount() {
return totalAmount;
}
public void setTotalAmount(BigDecimal totalAmount) {
this.totalAmount = totalAmount;
}
public BigDecimal getPayAmount() {
return payAmount;
}
public void setPayAmount(BigDecimal payAmount) {
this.payAmount = payAmount;
}
public BigDecimal getFreightAmount() {
return freightAmount;
}
public void setFreightAmount(BigDecimal freightAmount) {
this.freightAmount = freightAmount;
}
public BigDecimal getPromotionAmount() {
return promotionAmount;
}
public void setPromotionAmount(BigDecimal promotionAmount) {
this.promotionAmount = promotionAmount;
}
public BigDecimal getIntegrationAmount() {
return integrationAmount;
}
public void setIntegrationAmount(BigDecimal integrationAmount) {
this.integrationAmount = integrationAmount;
}
public BigDecimal getCouponAmount() {
return couponAmount;
}
public void setCouponAmount(BigDecimal couponAmount) {
this.couponAmount = couponAmount;
}
public BigDecimal getDiscountAmount() {
return discountAmount;
}
public void setDiscountAmount(BigDecimal discountAmount) {
this.discountAmount = discountAmount;
}
public Integer getPayType() {
return payType;
}
public void setPayType(Integer payType) {
this.payType = payType;
}
public Integer getSourceType() {
return sourceType;
}
public void setSourceType(Integer sourceType) {
this.sourceType = sourceType;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getOrderType() {
return orderType;
}
public void setOrderType(Integer orderType) {
this.orderType = orderType;
}
public String getDeliveryCompany() {
return deliveryCompany;
}
public void setDeliveryCompany(String deliveryCompany) {
this.deliveryCompany = deliveryCompany;
}
public String getDeliverySn() {
return deliverySn;
}
public void setDeliverySn(String deliverySn) {
this.deliverySn = deliverySn;
}
public Integer getAutoConfirmDay() {
return autoConfirmDay;
}
public void setAutoConfirmDay(Integer autoConfirmDay) {
this.autoConfirmDay = autoConfirmDay;
}
public Integer getIntegration() {
return integration;
}
public void setIntegration(Integer integration) {
this.integration = integration;
}
public Integer getGrowth() {
return growth;
}
public void setGrowth(Integer growth) {
this.growth = growth;
}
public String getPromotionInfo() {
return promotionInfo;
}
public void setPromotionInfo(String promotionInfo) {
this.promotionInfo = promotionInfo;
}
public Integer getBillType() {
return billType;
}
public void setBillType(Integer billType) {
this.billType = billType;
}
public String getBillHeader() {
return billHeader;
}
public void setBillHeader(String billHeader) {
this.billHeader = billHeader;
}
public String getBillContent() {
return billContent;
}
public void setBillContent(String billContent) {
this.billContent = billContent;
}
public String getBillReceiverPhone() {
return billReceiverPhone;
}
public void setBillReceiverPhone(String billReceiverPhone) {
this.billReceiverPhone = billReceiverPhone;
}
public String getBillReceiverEmail() {
return billReceiverEmail;
}
public void setBillReceiverEmail(String billReceiverEmail) {
this.billReceiverEmail = billReceiverEmail;
}
public String getReceiverName() {
return receiverName;
}
public void setReceiverName(String receiverName) {
this.receiverName = receiverName;
}
public String getReceiverPhone() {
return receiverPhone;
}
public void setReceiverPhone(String receiverPhone) {
this.receiverPhone = receiverPhone;
}
public String getReceiverPostCode() {
return receiverPostCode;
}
public void setReceiverPostCode(String receiverPostCode) {
this.receiverPostCode = receiverPostCode;
}
public String getReceiverProvince() {
return receiverProvince;
}
public void setReceiverProvince(String receiverProvince) {
this.receiverProvince = receiverProvince;
}
public String getReceiverCity() {
return receiverCity;
}
public void setReceiverCity(String receiverCity) {
this.receiverCity = receiverCity;
}
public String getReceiverRegion() {
return receiverRegion;
}
public void setReceiverRegion(String receiverRegion) {
this.receiverRegion = receiverRegion;
}
public String getReceiverDetailAddress() {
return receiverDetailAddress;
}
public void setReceiverDetailAddress(String receiverDetailAddress) {
this.receiverDetailAddress = receiverDetailAddress;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public Integer getConfirmStatus() {
return confirmStatus;
}
public void setConfirmStatus(Integer confirmStatus) {
this.confirmStatus = confirmStatus;
}
public Integer getDeleteStatus() {
return deleteStatus;
}
public void setDeleteStatus(Integer deleteStatus) {
this.deleteStatus = deleteStatus;
}
public Integer getUseIntegration() {
return useIntegration;
}
public void setUseIntegration(Integer useIntegration) {
this.useIntegration = useIntegration;
}
public Date getPaymentTime() {
return paymentTime;
}
public void setPaymentTime(Date paymentTime) {
this.paymentTime = paymentTime;
}
public Date getDeliveryTime() {
return deliveryTime;
}
public void setDeliveryTime(Date deliveryTime) {
this.deliveryTime = deliveryTime;
}
public Date getReceiveTime() {
return receiveTime;
}
public void setReceiveTime(Date receiveTime) {
this.receiveTime = receiveTime;
}
public Date getCommentTime() {
return commentTime;
}
public void setCommentTime(Date commentTime) {
this.commentTime = commentTime;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public String getQrcode() {
return qrcode;
}
public void setQrcode(String qrcode) {
this.qrcode = qrcode;
}
public Date getGmtCreate() {
return gmtCreate;
}
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
public Date getGmtModified() {
return gmtModified;
}
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", memberId=").append(memberId);
sb.append(", couponId=").append(couponId);
sb.append(", orderSn=").append(orderSn);
sb.append(", createTime=").append(createTime);
sb.append(", memberUsername=").append(memberUsername);
sb.append(", totalAmount=").append(totalAmount);
sb.append(", payAmount=").append(payAmount);
sb.append(", freightAmount=").append(freightAmount);
sb.append(", promotionAmount=").append(promotionAmount);
sb.append(", integrationAmount=").append(integrationAmount);
sb.append(", couponAmount=").append(couponAmount);
sb.append(", discountAmount=").append(discountAmount);
sb.append(", payType=").append(payType);
sb.append(", sourceType=").append(sourceType);
sb.append(", status=").append(status);
sb.append(", orderType=").append(orderType);
sb.append(", deliveryCompany=").append(deliveryCompany);
sb.append(", deliverySn=").append(deliverySn);
sb.append(", autoConfirmDay=").append(autoConfirmDay);
sb.append(", integration=").append(integration);
sb.append(", growth=").append(growth);
sb.append(", promotionInfo=").append(promotionInfo);
sb.append(", billType=").append(billType);
sb.append(", billHeader=").append(billHeader);
sb.append(", billContent=").append(billContent);
sb.append(", billReceiverPhone=").append(billReceiverPhone);
sb.append(", billReceiverEmail=").append(billReceiverEmail);
sb.append(", receiverName=").append(receiverName);
sb.append(", receiverPhone=").append(receiverPhone);
sb.append(", receiverPostCode=").append(receiverPostCode);
sb.append(", receiverProvince=").append(receiverProvince);
sb.append(", receiverCity=").append(receiverCity);
sb.append(", receiverRegion=").append(receiverRegion);
sb.append(", receiverDetailAddress=").append(receiverDetailAddress);
sb.append(", note=").append(note);
sb.append(", confirmStatus=").append(confirmStatus);
sb.append(", deleteStatus=").append(deleteStatus);
sb.append(", useIntegration=").append(useIntegration);
sb.append(", paymentTime=").append(paymentTime);
sb.append(", deliveryTime=").append(deliveryTime);
sb.append(", receiveTime=").append(receiveTime);
sb.append(", commentTime=").append(commentTime);
sb.append(", modifyTime=").append(modifyTime);
sb.append(", qrcode=").append(qrcode);
sb.append(", gmtCreate=").append(gmtCreate);
sb.append(", gmtModified=").append(gmtModified);
sb.append(", version=").append(version);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@@ -0,0 +1,322 @@
package com.tuling.tulingmall.history.model;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
public class OmsOrderItem implements Serializable {
private Long id;
@ApiModelProperty(value = "订单id")
private Long orderId;
@ApiModelProperty(value = "订单编号")
private String orderSn;
private Long productId;
private String productPic;
private String productName;
private String productBrand;
private String productSn;
@ApiModelProperty(value = "销售价格")
private BigDecimal productPrice;
@ApiModelProperty(value = "购买数量")
private Integer productQuantity;
@ApiModelProperty(value = "商品sku编号")
private Long productSkuId;
@ApiModelProperty(value = "商品sku条码")
private String productSkuCode;
@ApiModelProperty(value = "商品分类id")
private Long productCategoryId;
@ApiModelProperty(value = "商品的销售属性")
private String sp1;
private String sp2;
private String sp3;
@ApiModelProperty(value = "商品促销名称")
private String promotionName;
@ApiModelProperty(value = "商品促销分解金额")
private BigDecimal promotionAmount;
@ApiModelProperty(value = "优惠券优惠分解金额")
private BigDecimal couponAmount;
@ApiModelProperty(value = "积分优惠分解金额")
private BigDecimal integrationAmount;
@ApiModelProperty(value = "该商品经过优惠后的分解金额")
private BigDecimal realAmount;
private Integer giftIntegration;
private Integer giftGrowth;
@ApiModelProperty(value = "商品销售属性:[{'key':'颜色','value':'颜色'},{'key':'容量','value':'4G'}]")
private String productAttr;
private Date gmtCreate;
private Date gmtModified;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getOrderId() {
return orderId;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
public String getOrderSn() {
return orderSn;
}
public void setOrderSn(String orderSn) {
this.orderSn = orderSn;
}
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public String getProductPic() {
return productPic;
}
public void setProductPic(String productPic) {
this.productPic = productPic;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductBrand() {
return productBrand;
}
public void setProductBrand(String productBrand) {
this.productBrand = productBrand;
}
public String getProductSn() {
return productSn;
}
public void setProductSn(String productSn) {
this.productSn = productSn;
}
public BigDecimal getProductPrice() {
return productPrice;
}
public void setProductPrice(BigDecimal productPrice) {
this.productPrice = productPrice;
}
public Integer getProductQuantity() {
return productQuantity;
}
public void setProductQuantity(Integer productQuantity) {
this.productQuantity = productQuantity;
}
public Long getProductSkuId() {
return productSkuId;
}
public void setProductSkuId(Long productSkuId) {
this.productSkuId = productSkuId;
}
public String getProductSkuCode() {
return productSkuCode;
}
public void setProductSkuCode(String productSkuCode) {
this.productSkuCode = productSkuCode;
}
public Long getProductCategoryId() {
return productCategoryId;
}
public void setProductCategoryId(Long productCategoryId) {
this.productCategoryId = productCategoryId;
}
public String getSp1() {
return sp1;
}
public void setSp1(String sp1) {
this.sp1 = sp1;
}
public String getSp2() {
return sp2;
}
public void setSp2(String sp2) {
this.sp2 = sp2;
}
public String getSp3() {
return sp3;
}
public void setSp3(String sp3) {
this.sp3 = sp3;
}
public String getPromotionName() {
return promotionName;
}
public void setPromotionName(String promotionName) {
this.promotionName = promotionName;
}
public BigDecimal getPromotionAmount() {
return promotionAmount;
}
public void setPromotionAmount(BigDecimal promotionAmount) {
this.promotionAmount = promotionAmount;
}
public BigDecimal getCouponAmount() {
return couponAmount;
}
public void setCouponAmount(BigDecimal couponAmount) {
this.couponAmount = couponAmount;
}
public BigDecimal getIntegrationAmount() {
return integrationAmount;
}
public void setIntegrationAmount(BigDecimal integrationAmount) {
this.integrationAmount = integrationAmount;
}
public BigDecimal getRealAmount() {
return realAmount;
}
public void setRealAmount(BigDecimal realAmount) {
this.realAmount = realAmount;
}
public Integer getGiftIntegration() {
return giftIntegration;
}
public void setGiftIntegration(Integer giftIntegration) {
this.giftIntegration = giftIntegration;
}
public Integer getGiftGrowth() {
return giftGrowth;
}
public void setGiftGrowth(Integer giftGrowth) {
this.giftGrowth = giftGrowth;
}
public String getProductAttr() {
return productAttr;
}
public void setProductAttr(String productAttr) {
this.productAttr = productAttr;
}
public Date getGmtCreate() {
return gmtCreate;
}
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
public Date getGmtModified() {
return gmtModified;
}
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", orderId=").append(orderId);
sb.append(", orderSn=").append(orderSn);
sb.append(", productId=").append(productId);
sb.append(", productPic=").append(productPic);
sb.append(", productName=").append(productName);
sb.append(", productBrand=").append(productBrand);
sb.append(", productSn=").append(productSn);
sb.append(", productPrice=").append(productPrice);
sb.append(", productQuantity=").append(productQuantity);
sb.append(", productSkuId=").append(productSkuId);
sb.append(", productSkuCode=").append(productSkuCode);
sb.append(", productCategoryId=").append(productCategoryId);
sb.append(", sp1=").append(sp1);
sb.append(", sp2=").append(sp2);
sb.append(", sp3=").append(sp3);
sb.append(", promotionName=").append(promotionName);
sb.append(", promotionAmount=").append(promotionAmount);
sb.append(", couponAmount=").append(couponAmount);
sb.append(", integrationAmount=").append(integrationAmount);
sb.append(", realAmount=").append(realAmount);
sb.append(", giftIntegration=").append(giftIntegration);
sb.append(", giftGrowth=").append(giftGrowth);
sb.append(", productAttr=").append(productAttr);
sb.append(", gmtCreate=").append(gmtCreate);
sb.append(", gmtModified=").append(gmtModified);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@@ -0,0 +1,18 @@
package com.tuling.tulingmall.history.service;
/**
* 订单迁移调度中心
*/
public interface MigrateCentreService {
/*单表迁移*/
String migrateSingleTableOrders(int tableNo);
/*全部迁移*/
String migrateTablesOrders();
/*停止迁移*/
public void stopMigrate();
/*恢复迁移*/
public void recoverMigrate();
}

View File

@@ -0,0 +1,20 @@
package com.tuling.tulingmall.history.service;
import com.tuling.tulingmall.common.api.CommonResult;
import com.tuling.tulingmall.history.domain.OmsOrderDetail;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/**
* 订单迁移MySQL数据库管理Service接口
*/
public interface OperateDbService {
List<OmsOrderDetail> getOrders(long maxOrderId, int tableCount, Date endDate, int fetchRecordNumbers);
@Transactional(value = "dbTransactionManager",rollbackFor = Throwable.class)
void deleteOrders(int tableCount,long minOrderId,long maxOrderId);
}

View File

@@ -0,0 +1,18 @@
package com.tuling.tulingmall.history.service;
import com.tuling.tulingmall.history.domain.OmsOrderDetail;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 订单迁移mongodb数据库管理Service接口
*/
public interface OperateMgDbService {
@Transactional(value = "mongoTransactionManager",rollbackFor = Throwable.class)
void saveToMgDb(List<OmsOrderDetail> orders,long curMaxOrderId,String tableName);
long getMaxOrderId(String tableName);
}

View File

@@ -0,0 +1,116 @@
package com.tuling.tulingmall.history.service.impl;
import com.tuling.tulingmall.history.domain.OmsOrderDetail;
import com.tuling.tulingmall.history.service.MigrateCentreService;
import com.tuling.tulingmall.history.service.OperateDbService;
import com.tuling.tulingmall.history.service.OperateMgDbService;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
@Service
@Slf4j
public class MigrateCentreServiceImpl implements MigrateCentreService {
private static final int TABLE_NO = 31;
private static final int FETCH_RECORD_NUMBERS = 2000;
private static final int DB_SLEEP_RND = 5;
private static BlockingQueue<Runnable> tableQueue= new ArrayBlockingQueue<>(TABLE_NO + 1);
private ThreadPoolExecutor executor = new ThreadPoolExecutor(0,Runtime.getRuntime().availableProcessors(),
10,TimeUnit.SECONDS,tableQueue);
private AtomicBoolean roundOnOff = new AtomicBoolean(true);
@Autowired
private OperateMgDbService operateMgDbService;
@Autowired
private OperateDbService operateDbService;
public void stopMigrate(){
roundOnOff.set(false);
tableQueue.clear();
}
@Override
public void recoverMigrate() {
roundOnOff.set(true);
}
public String migrateTablesOrders(){
try {
for(int i = 0; i <= TABLE_NO; i++){
final int tableCount = i;
executor.execute(()->migrateSingleTableOrders(tableCount));
}
return OrderConstant.MIGRATE_SUCCESS;
} catch (Exception e) {
log.error("执行任务失败:",e);
return OrderConstant.MIGRATE_FAILURE;
}
}
/*完成单表从MySQL到MongoDB的一轮(Round)数据迁移,依然需要分次进行,
每次的数据条数由FETCH_RECORD_NUMBERS控制
该控制阈值可以写入配置中心动态调整建议不要超过10000*/
@Override
public String migrateSingleTableOrders(int tableNo) {
try {
/*获得3个月前的时间*/
Calendar calendar = Calendar.getInstance();
//calendar.add(Calendar.MONTH, -3);
calendar.add(Calendar.DATE, -1);
Date maxDate = calendar.getTime();
String factTableName = OrderConstant.OMS_ORDER_NAME_PREFIX + tableNo;
/*本轮处理数据的最小ID和最大ID*/
long roundMinOrderId = operateMgDbService.getMaxOrderId(factTableName);
long roundMaxOrderId = roundMinOrderId;
log.info("本轮表[{}]数据迁移查询记录起始ID = {}",factTableName,roundMinOrderId);
/*开始迁移*/
while(roundOnOff.get()){
/*获得上次处理的最大OrderId作为本次迁移的起始ID*/
long currMaxOrderId = operateMgDbService.getMaxOrderId(factTableName);
log.info("本次表[{}]数据迁移查询记录起始ID = {}",factTableName,currMaxOrderId);
List<OmsOrderDetail> fetchRecords = operateDbService.getOrders(currMaxOrderId,
tableNo,maxDate,FETCH_RECORD_NUMBERS);
if(!CollectionUtils.isEmpty(fetchRecords)){
int fetchSize = fetchRecords.size();
/*更新最大OrderId记录本次迁移的最小ID*/
currMaxOrderId = fetchRecords.get(fetchRecords.size()-1).getId();
long curMinOrderId = fetchRecords.get(0).getId();
log.info("开始进行表[{}]数据迁移,应该迁移记录截止时间={},记录条数={}min={},max={}",
factTableName,maxDate,fetchSize,curMinOrderId,currMaxOrderId);
operateMgDbService.saveToMgDb(fetchRecords,currMaxOrderId,factTableName);
/*更新本轮处理数据的最大ID*/
roundMaxOrderId = currMaxOrderId;
log.info("表[{}]本次数据迁移已完成,准备删除记录",factTableName);
operateDbService.deleteOrders(tableNo,curMinOrderId,currMaxOrderId);
/*考虑到数据库的负载,每次迁移后休眠随机数时间*/
int rnd = ThreadLocalRandom.current().nextInt(DB_SLEEP_RND);
log.info("表[{}]本次数据删除已完成,休眠[{}]S",factTableName,rnd);
TimeUnit.SECONDS.sleep(rnd);
}else{
log.info("表[{}]本轮数据迁移已完成,数据截止时间={}min={},max={}",
factTableName,maxDate,roundMinOrderId,roundMaxOrderId);
break;
}
}
return OrderConstant.MIGRATE_SUCCESS;
} catch (Exception e) {
log.error("表[{}]本次数据迁移异常,已终止,请检查并手工修复:",
OrderConstant.OMS_ORDER_NAME_PREFIX + tableNo,e);
return OrderConstant.MIGRATE_FAILURE;
}
}
}

View File

@@ -0,0 +1,42 @@
package com.tuling.tulingmall.history.service.impl;
import com.tuling.tulingmall.history.dao.PortalOrderDao;
import com.tuling.tulingmall.history.domain.*;
import com.tuling.tulingmall.history.service.OperateDbService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* 订单迁移管理Service实现
*/
@Service
@Slf4j
public class OperateDbServiceImpl implements OperateDbService {
@Autowired
private PortalOrderDao portalOrderDao;
@Override
public List<OmsOrderDetail> getOrders(long maxOrderId,int tableCount,Date endDate,int fetchRecordNumbers) {
String omsOrderTableName = OrderConstant.OMS_ORDER_NAME_PREFIX + tableCount;
String omsOrderItemTableName = OrderConstant.OMS_ORDER_ITEM_NAME_PREFIX + tableCount;
return portalOrderDao.getRangeOrders(omsOrderTableName,omsOrderItemTableName,maxOrderId,
endDate,fetchRecordNumbers);
}
@Override
public void deleteOrders(int tableCount,long minOrderId,long maxOrderId) {
String omsOrderTableName = OrderConstant.OMS_ORDER_NAME_PREFIX + tableCount;
String omsOrderItemTableName = OrderConstant.OMS_ORDER_ITEM_NAME_PREFIX + tableCount;
int deleteCount = portalOrderDao.deleteMigrateOrdersItems(omsOrderItemTableName,minOrderId,maxOrderId);
log.info("已删除表{}中{}条数据minOrderId={},maxOrderId={}",
omsOrderItemTableName,deleteCount,minOrderId,maxOrderId);
deleteCount = portalOrderDao.deleteMigrateOrders(omsOrderTableName,minOrderId,maxOrderId);
log.info("已删除表{}中{}条数据minOrderId={},maxOrderId={}",
omsOrderTableName,deleteCount,minOrderId,maxOrderId);
}
}

View File

@@ -0,0 +1,48 @@
package com.tuling.tulingmall.history.service.impl;
import com.mongodb.client.result.UpdateResult;
import com.tuling.tulingmall.history.domain.MongoOrderId;
import com.tuling.tulingmall.history.domain.OmsOrderDetail;
import com.tuling.tulingmall.history.service.OperateMgDbService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
@Slf4j
public class OperateMgDbServiceImpl implements OperateMgDbService {
private static final String ORDER_MAX_ID_KEY = "tableName";
@Autowired
private MongoTemplate mongoTemplate;
@Override
@Transactional
public void saveToMgDb(List<OmsOrderDetail> orders, long curMaxOrderId,String tableName) {
log.info("准备将表{}数据迁移入MongoDB参数curMaxOrderId = {}",tableName,curMaxOrderId);
mongoTemplate.insert(orders,OmsOrderDetail.class);
/*记录本次迁移的最大订单ID下次迁移时需要使用*/
Query query = new Query(Criteria.where(ORDER_MAX_ID_KEY).is(tableName));
Update update = new Update();
update.set(ORDER_MAX_ID_KEY,curMaxOrderId);
UpdateResult updateResult = mongoTemplate.upsert(query,update,MongoOrderId.class);
log.info("已记录表{}本次迁移最大订单ID = {}",tableName,curMaxOrderId);
}
@Override
public long getMaxOrderId(String tableName) {
Query query = new Query(Criteria.where(ORDER_MAX_ID_KEY).is(tableName));
MongoOrderId mongoOrderId = mongoTemplate.findOne(query,MongoOrderId.class);
long result = mongoOrderId == null ? 0 : mongoOrderId.getMaxOrderId();
log.info("表{}本次迁移起始订单ID = {}",tableName,result);
return result;
}
}

View File

@@ -0,0 +1,39 @@
package com.tuling.tulingmall.history.service.impl;
public class OrderConstant {
public static final String OMS_ORDER_NAME_PREFIX = "oms_order_";
public static final String OMS_ORDER_ITEM_NAME_PREFIX = "oms_order_item_";
public static final String MIGRATE_SUCCESS = "成功";
public static final String MIGRATE_FAILURE = "失败";
public static final String LEAF_ORDER_ID_KEY = "order_id";
public static final String LEAF_ORDER_ITEM_ID_KEY = "order_item_id";
/*订单确认*/
public static final int CONFIRM_STATUS_NO = 0;
public static final int CONFIRM_STATUS_YES = 1;
/*订单删除状态*/
public static final int DELETE_STATUS_NO = 0;
public static final int DELETE_STATUS_YES = 1;
/*订单来源0->PC订单1->app订单*/
public static final int SOURCE_TYPE_PC = 0;
public static final int SOURCE_TYPE_APP = 1;
/*订单状态0->待付款1->待发货2->已发货3->已完成4->已关闭5->无效订单*/
public static final int ORDER_STATUS_UNPAY = 0;
public static final int ORDER_STATUS_UNDELIVERY = 1;
public static final int ORDER_STATUS_DELIVERYED = 2;
public static final int ORDER_STATUS_COMPLETE = 3;
public static final int ORDER_STATUS_CLOSE = 4;
public static final int ORDER_STATUS_INVALID = 5;
/*订单类型0->正常订单1->秒杀订单*/
public static final int ORDER_TYPE_NORMAL = 0;
public static final int ORDER_TYPE_SECKILL = 1;
}

View File

@@ -0,0 +1,43 @@
logging:
level:
com:
tuling:
tulingmall:
history:
dao: debug
spring:
#读写分离配置
shardingsphere:
#数据源配置
datasource:
names: ds-master,ds-slave
ds-master:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.65.223:3306/tl_mall_order?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=true
initialSize: 5
minIdle: 10
maxActive: 30
validationQuery: SELECT 1 FROM DUAL
username: tlmall
password: tlmall123
ds-slave:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.65.137:3306/tl_mall_order?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=true
initialSize: 5
minIdle: 10
maxActive: 30
validationQuery: SELECT 1 FROM DUAL
username: tlmall
password: tlmall123
#读写分离配置
masterslave:
name: ds_ms
master-data-sourceName: ds-master
slave-data-sourceNames:
- ds-slave
load-balance-algorithmType: ROUND_ROBIN
props:
sql:
show: true

View File

@@ -0,0 +1,18 @@
spring:
cloud:
nacos:
config:
server-addr: 127.0.0.1:8848 #配置中心的地址
file-extension: yml #配置文件结尾的配置
#shared-dataids: tulingmall-portal.yml #图灵商城公共配置
shared-configs[0]:
data-id: tulingmall-nacos.yml
group: DEFAULT_GROUP
refresh: true
discovery:
server-addr: 127.0.0.1:8848
application:
name: tulingmall-order-history
profiles:
active: dev

View File

@@ -0,0 +1,105 @@
<?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.tuling.tulingmall.history.dao.PortalOrderDao">
<resultMap id="orderDetailMap" type="com.tuling.tulingmall.history.domain.OmsOrderDetail"
extends="com.tuling.tulingmall.history.mapper.OmsOrderMapper.BaseResultMap">
<collection property="orderItemList" columnPrefix="ot_"
resultMap="com.tuling.tulingmall.history.mapper.OmsOrderItemMapper.BaseResultMap">
</collection>
</resultMap>
<select id="getRangeOrders" resultMap="orderDetailMap">
SELECT
o.id,
o.member_id,
o.coupon_id,
o.order_sn,
o.create_time,
o.member_username,
o.total_amount,
o.pay_amount,
o.freight_amount,
o.promotion_amount,
o.integration_amount,
o.coupon_amount,
o.discount_amount,
o.pay_type,
o.source_type,
o.status,
o.order_type,
o.delivery_company,
o.delivery_sn,
o.auto_confirm_day,
o.integration,
o.growth,
o.promotion_info,
o.bill_type,
o.bill_header,
o.bill_content,
o.bill_receiver_phone,
o.bill_receiver_email,
o.receiver_name,
o.receiver_phone,
o.receiver_post_code,
o.receiver_province,
o.receiver_city,
o.receiver_region,
o.receiver_detail_address,
o.note,
o.confirm_status,
o.delete_status,
o.use_integration,
o.payment_time,
o.delivery_time,
o.receive_time,
o.comment_time,
o.modify_time,
o.qrcode,
o.gmt_create,
o.gmt_modified,
o.version,
ot.id ot_id,
ot.order_id ot_order_id,
ot.order_sn ot_order_sn,
ot.product_id ot_product_id,
ot.product_pic ot_product_pic,
ot.product_name ot_product_name,
ot.product_brand ot_product_brand,
ot.product_sn ot_product_sn,
ot.product_price ot_product_price,
ot.product_quantity ot_product_quantity,
ot.product_sku_id ot_product_sku_id,
ot.product_sku_code ot_product_sku_code,
ot.product_category_id ot_product_category_id,
ot.sp1 ot_sp1,
ot.sp2 ot_sp2,
ot.sp3 ot_sp3,
ot.promotion_name ot_promotion_name,
ot.promotion_amount ot_promotion_amount,
ot.coupon_amount ot_coupon_amount,
ot.integration_amount ot_integration_amount,
ot.real_amount ot_real_amount,
ot.gift_integration ot_gift_integration,
ot.gift_growth ot_gift_growth,
ot.product_attr ot_ot_product_attr,
ot.gmt_create ot_gmt_create,
ot.gmt_modified ot_gmt_modified
FROM
${orderTableName} o
LEFT JOIN
${orderItemTableName} ot
ON o.id = ot.order_id
WHERE o.id >= #{orderId} and o.gmt_create &lt; #{gmtCreate}
order by o.id limit #{fetchRecordNumbers}
</select>
<delete id="deleteMigrateOrdersItems">
delete from ${orderItemTableName} ot
WHERE ot.order_id >= #{minOrderId} and ot.order_id &lt;= #{maxOrderId}
</delete>
<delete id="deleteMigrateOrders">
delete from ${orderTableName} o
WHERE o.id >= #{minOrderId} and o.id &lt;= #{maxOrderId}
</delete>
</mapper>

View File

@@ -0,0 +1,192 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL如果设置为WARN则低于WARN的信息都不会输出 -->
<!-- scan:当此属性设置为true时配置文件如果发生改变将会被重新加载默认值为true -->
<!-- scanPeriod:设置监测配置文件是否有修改的时间间隔如果没有给出时间单位默认单位是毫秒。当scan为true时此属性生效。默认的时间间隔为1分钟。 -->
<!-- debug:当此属性设置为true时将打印出logback内部日志信息实时查看logback运行状态。默认值为false。 -->
<configuration scan="true" scanPeriod="10 seconds">
<!--<include resource="org/springframework/boot/logging/logback/base.xml" />-->
<contextName>logback</contextName>
<!-- name的值是变量的名称value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后可以使“${}”来使用变量。 -->
<property name="log.path" value="D:/nmyslog/nmys" />
<!-- 彩色日志(IDE下载插件才可以生效) -->
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!--输出到控制台-->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!--此日志appender是为开发使用只配置最底级别控制台输出的日志级别是大于或等于此级别的日志信息-->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>debug</level>
</filter>
<encoder>
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
<!-- 设置字符集 -->
<charset>UTF-8</charset>
</encoder>
</appender>
<!--输出到文件-->
<!-- 时间滚动输出 level为 DEBUG 日志 -->
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_debug.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志归档 -->
<fileNamePattern>${log.path}/debug/log-debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录debug级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>debug</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 INFO 日志 -->
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_info.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 每天日志归档路径以及格式 -->
<fileNamePattern>${log.path}/info/log-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录info级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>info</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 WARN 日志 -->
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_warn.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录warn级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>warn</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 ERROR 日志 -->
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_error.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/error/log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录ERROR级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!--
<logger>用来设置某一个包或者具体的某一个类的日志打印级别、
以及指定<appender>。<logger>仅有一个name属性
一个可选的level和一个可选的addtivity属性。
name:用来指定受此logger约束的某一个包或者具体的某一个类。
level:用来设置打印级别大小写无关TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF
还有一个特俗值INHERITED或者同义词NULL代表强制执行上级的级别。
如果未设置此属性那么当前logger将会继承上级的级别。
addtivity:是否向上级logger传递打印信息。默认是true。
-->
<!--<logger name="org.springframework.web" level="info"/>-->
<!--<logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/>-->
<!--
使用mybatis的时候sql语句是debug下才会打印而这里我们只配置了info所以想要查看sql语句的话有以下两种操作
第一种把<root level="info">改成<root level="DEBUG">这样就会打印sql不过这样日志那边会出现很多其他消息
第二种就是单独给dao下目录配置debug模式代码如下这样配置sql语句会打印其他还是正常info级别
-->
<!--
root节点是必选节点用来指定最基础的日志输出级别只有一个level属性
level:用来设置打印级别大小写无关TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF
不能设置为INHERITED或者同义词NULL。默认是DEBUG
可以包含零个或多个元素标识这个appender将会添加到这个logger。
-->
<!--开发环境:打印控制台
<springProfile name="local">
<logger name="com.tuling.tulingmall.ordercurr" level="debug"/>
</springProfile>
-->
<root level="info">
<appender-ref ref="CONSOLE" />
</root>
<!--生产环境:输出到文件-->
<!--<springProfile name="cluster">-->
<!--<root level="info">-->
<!--<appender-ref ref="CONSOLE" />-->
<!--<appender-ref ref="DEBUG_FILE" />-->
<!--<appender-ref ref="INFO_FILE" />-->
<!--<appender-ref ref="ERROR_FILE" />-->
<!--<appender-ref ref="WARN_FILE" />-->
<!--</root>-->
<!--</springProfile>-->
</configuration>

View File

@@ -0,0 +1,544 @@
<?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.tuling.tulingmall.history.mapper.OmsOrderItemMapper">
<resultMap id="BaseResultMap" type="com.tuling.tulingmall.history.model.OmsOrderItem">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="order_id" jdbcType="BIGINT" property="orderId" />
<result column="order_sn" jdbcType="VARCHAR" property="orderSn" />
<result column="product_id" jdbcType="BIGINT" property="productId" />
<result column="product_pic" jdbcType="VARCHAR" property="productPic" />
<result column="product_name" jdbcType="VARCHAR" property="productName" />
<result column="product_brand" jdbcType="VARCHAR" property="productBrand" />
<result column="product_sn" jdbcType="VARCHAR" property="productSn" />
<result column="product_price" jdbcType="DECIMAL" property="productPrice" />
<result column="product_quantity" jdbcType="INTEGER" property="productQuantity" />
<result column="product_sku_id" jdbcType="BIGINT" property="productSkuId" />
<result column="product_sku_code" jdbcType="VARCHAR" property="productSkuCode" />
<result column="product_category_id" jdbcType="BIGINT" property="productCategoryId" />
<result column="sp1" jdbcType="VARCHAR" property="sp1" />
<result column="sp2" jdbcType="VARCHAR" property="sp2" />
<result column="sp3" jdbcType="VARCHAR" property="sp3" />
<result column="promotion_name" jdbcType="VARCHAR" property="promotionName" />
<result column="promotion_amount" jdbcType="DECIMAL" property="promotionAmount" />
<result column="coupon_amount" jdbcType="DECIMAL" property="couponAmount" />
<result column="integration_amount" jdbcType="DECIMAL" property="integrationAmount" />
<result column="real_amount" jdbcType="DECIMAL" property="realAmount" />
<result column="gift_integration" jdbcType="INTEGER" property="giftIntegration" />
<result column="gift_growth" jdbcType="INTEGER" property="giftGrowth" />
<result column="product_attr" jdbcType="VARCHAR" property="productAttr" />
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, order_id, order_sn, product_id, product_pic, product_name, product_brand, product_sn,
product_price, product_quantity, product_sku_id, product_sku_code, product_category_id,
sp1, sp2, sp3, promotion_name, promotion_amount, coupon_amount, integration_amount,
real_amount, gift_integration, gift_growth, product_attr, gmt_create, gmt_modified
</sql>
<select id="selectByExample" parameterType="com.tuling.tulingmall.history.model.OmsOrderItemExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
'true' as QUERYID,
<include refid="Base_Column_List" />
from oms_order_item
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from oms_order_item
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from oms_order_item
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.tuling.tulingmall.history.model.OmsOrderItemExample">
delete from oms_order_item
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.tuling.tulingmall.history.model.OmsOrderItem">
insert into oms_order_item (id, order_id, order_sn,
product_id, product_pic, product_name,
product_brand, product_sn, product_price,
product_quantity, product_sku_id, product_sku_code,
product_category_id, sp1, sp2,
sp3, promotion_name, promotion_amount,
coupon_amount, integration_amount, real_amount,
gift_integration, gift_growth, product_attr,
gmt_create, gmt_modified)
values (#{id,jdbcType=BIGINT}, #{orderId,jdbcType=BIGINT}, #{orderSn,jdbcType=VARCHAR},
#{productId,jdbcType=BIGINT}, #{productPic,jdbcType=VARCHAR}, #{productName,jdbcType=VARCHAR},
#{productBrand,jdbcType=VARCHAR}, #{productSn,jdbcType=VARCHAR}, #{productPrice,jdbcType=DECIMAL},
#{productQuantity,jdbcType=INTEGER}, #{productSkuId,jdbcType=BIGINT}, #{productSkuCode,jdbcType=VARCHAR},
#{productCategoryId,jdbcType=BIGINT}, #{sp1,jdbcType=VARCHAR}, #{sp2,jdbcType=VARCHAR},
#{sp3,jdbcType=VARCHAR}, #{promotionName,jdbcType=VARCHAR}, #{promotionAmount,jdbcType=DECIMAL},
#{couponAmount,jdbcType=DECIMAL}, #{integrationAmount,jdbcType=DECIMAL}, #{realAmount,jdbcType=DECIMAL},
#{giftIntegration,jdbcType=INTEGER}, #{giftGrowth,jdbcType=INTEGER}, #{productAttr,jdbcType=VARCHAR},
#{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.tuling.tulingmall.history.model.OmsOrderItem">
insert into oms_order_item
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="orderId != null">
order_id,
</if>
<if test="orderSn != null">
order_sn,
</if>
<if test="productId != null">
product_id,
</if>
<if test="productPic != null">
product_pic,
</if>
<if test="productName != null">
product_name,
</if>
<if test="productBrand != null">
product_brand,
</if>
<if test="productSn != null">
product_sn,
</if>
<if test="productPrice != null">
product_price,
</if>
<if test="productQuantity != null">
product_quantity,
</if>
<if test="productSkuId != null">
product_sku_id,
</if>
<if test="productSkuCode != null">
product_sku_code,
</if>
<if test="productCategoryId != null">
product_category_id,
</if>
<if test="sp1 != null">
sp1,
</if>
<if test="sp2 != null">
sp2,
</if>
<if test="sp3 != null">
sp3,
</if>
<if test="promotionName != null">
promotion_name,
</if>
<if test="promotionAmount != null">
promotion_amount,
</if>
<if test="couponAmount != null">
coupon_amount,
</if>
<if test="integrationAmount != null">
integration_amount,
</if>
<if test="realAmount != null">
real_amount,
</if>
<if test="giftIntegration != null">
gift_integration,
</if>
<if test="giftGrowth != null">
gift_growth,
</if>
<if test="productAttr != null">
product_attr,
</if>
<if test="gmtCreate != null">
gmt_create,
</if>
<if test="gmtModified != null">
gmt_modified,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="orderId != null">
#{orderId,jdbcType=BIGINT},
</if>
<if test="orderSn != null">
#{orderSn,jdbcType=VARCHAR},
</if>
<if test="productId != null">
#{productId,jdbcType=BIGINT},
</if>
<if test="productPic != null">
#{productPic,jdbcType=VARCHAR},
</if>
<if test="productName != null">
#{productName,jdbcType=VARCHAR},
</if>
<if test="productBrand != null">
#{productBrand,jdbcType=VARCHAR},
</if>
<if test="productSn != null">
#{productSn,jdbcType=VARCHAR},
</if>
<if test="productPrice != null">
#{productPrice,jdbcType=DECIMAL},
</if>
<if test="productQuantity != null">
#{productQuantity,jdbcType=INTEGER},
</if>
<if test="productSkuId != null">
#{productSkuId,jdbcType=BIGINT},
</if>
<if test="productSkuCode != null">
#{productSkuCode,jdbcType=VARCHAR},
</if>
<if test="productCategoryId != null">
#{productCategoryId,jdbcType=BIGINT},
</if>
<if test="sp1 != null">
#{sp1,jdbcType=VARCHAR},
</if>
<if test="sp2 != null">
#{sp2,jdbcType=VARCHAR},
</if>
<if test="sp3 != null">
#{sp3,jdbcType=VARCHAR},
</if>
<if test="promotionName != null">
#{promotionName,jdbcType=VARCHAR},
</if>
<if test="promotionAmount != null">
#{promotionAmount,jdbcType=DECIMAL},
</if>
<if test="couponAmount != null">
#{couponAmount,jdbcType=DECIMAL},
</if>
<if test="integrationAmount != null">
#{integrationAmount,jdbcType=DECIMAL},
</if>
<if test="realAmount != null">
#{realAmount,jdbcType=DECIMAL},
</if>
<if test="giftIntegration != null">
#{giftIntegration,jdbcType=INTEGER},
</if>
<if test="giftGrowth != null">
#{giftGrowth,jdbcType=INTEGER},
</if>
<if test="productAttr != null">
#{productAttr,jdbcType=VARCHAR},
</if>
<if test="gmtCreate != null">
#{gmtCreate,jdbcType=TIMESTAMP},
</if>
<if test="gmtModified != null">
#{gmtModified,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.tuling.tulingmall.history.model.OmsOrderItemExample" resultType="java.lang.Long">
select count(*) from oms_order_item
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update oms_order_item
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.orderId != null">
order_id = #{record.orderId,jdbcType=BIGINT},
</if>
<if test="record.orderSn != null">
order_sn = #{record.orderSn,jdbcType=VARCHAR},
</if>
<if test="record.productId != null">
product_id = #{record.productId,jdbcType=BIGINT},
</if>
<if test="record.productPic != null">
product_pic = #{record.productPic,jdbcType=VARCHAR},
</if>
<if test="record.productName != null">
product_name = #{record.productName,jdbcType=VARCHAR},
</if>
<if test="record.productBrand != null">
product_brand = #{record.productBrand,jdbcType=VARCHAR},
</if>
<if test="record.productSn != null">
product_sn = #{record.productSn,jdbcType=VARCHAR},
</if>
<if test="record.productPrice != null">
product_price = #{record.productPrice,jdbcType=DECIMAL},
</if>
<if test="record.productQuantity != null">
product_quantity = #{record.productQuantity,jdbcType=INTEGER},
</if>
<if test="record.productSkuId != null">
product_sku_id = #{record.productSkuId,jdbcType=BIGINT},
</if>
<if test="record.productSkuCode != null">
product_sku_code = #{record.productSkuCode,jdbcType=VARCHAR},
</if>
<if test="record.productCategoryId != null">
product_category_id = #{record.productCategoryId,jdbcType=BIGINT},
</if>
<if test="record.sp1 != null">
sp1 = #{record.sp1,jdbcType=VARCHAR},
</if>
<if test="record.sp2 != null">
sp2 = #{record.sp2,jdbcType=VARCHAR},
</if>
<if test="record.sp3 != null">
sp3 = #{record.sp3,jdbcType=VARCHAR},
</if>
<if test="record.promotionName != null">
promotion_name = #{record.promotionName,jdbcType=VARCHAR},
</if>
<if test="record.promotionAmount != null">
promotion_amount = #{record.promotionAmount,jdbcType=DECIMAL},
</if>
<if test="record.couponAmount != null">
coupon_amount = #{record.couponAmount,jdbcType=DECIMAL},
</if>
<if test="record.integrationAmount != null">
integration_amount = #{record.integrationAmount,jdbcType=DECIMAL},
</if>
<if test="record.realAmount != null">
real_amount = #{record.realAmount,jdbcType=DECIMAL},
</if>
<if test="record.giftIntegration != null">
gift_integration = #{record.giftIntegration,jdbcType=INTEGER},
</if>
<if test="record.giftGrowth != null">
gift_growth = #{record.giftGrowth,jdbcType=INTEGER},
</if>
<if test="record.productAttr != null">
product_attr = #{record.productAttr,jdbcType=VARCHAR},
</if>
<if test="record.gmtCreate != null">
gmt_create = #{record.gmtCreate,jdbcType=TIMESTAMP},
</if>
<if test="record.gmtModified != null">
gmt_modified = #{record.gmtModified,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update oms_order_item
set id = #{record.id,jdbcType=BIGINT},
order_id = #{record.orderId,jdbcType=BIGINT},
order_sn = #{record.orderSn,jdbcType=VARCHAR},
product_id = #{record.productId,jdbcType=BIGINT},
product_pic = #{record.productPic,jdbcType=VARCHAR},
product_name = #{record.productName,jdbcType=VARCHAR},
product_brand = #{record.productBrand,jdbcType=VARCHAR},
product_sn = #{record.productSn,jdbcType=VARCHAR},
product_price = #{record.productPrice,jdbcType=DECIMAL},
product_quantity = #{record.productQuantity,jdbcType=INTEGER},
product_sku_id = #{record.productSkuId,jdbcType=BIGINT},
product_sku_code = #{record.productSkuCode,jdbcType=VARCHAR},
product_category_id = #{record.productCategoryId,jdbcType=BIGINT},
sp1 = #{record.sp1,jdbcType=VARCHAR},
sp2 = #{record.sp2,jdbcType=VARCHAR},
sp3 = #{record.sp3,jdbcType=VARCHAR},
promotion_name = #{record.promotionName,jdbcType=VARCHAR},
promotion_amount = #{record.promotionAmount,jdbcType=DECIMAL},
coupon_amount = #{record.couponAmount,jdbcType=DECIMAL},
integration_amount = #{record.integrationAmount,jdbcType=DECIMAL},
real_amount = #{record.realAmount,jdbcType=DECIMAL},
gift_integration = #{record.giftIntegration,jdbcType=INTEGER},
gift_growth = #{record.giftGrowth,jdbcType=INTEGER},
product_attr = #{record.productAttr,jdbcType=VARCHAR},
gmt_create = #{record.gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{record.gmtModified,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.tuling.tulingmall.history.model.OmsOrderItem">
update oms_order_item
<set>
<if test="orderId != null">
order_id = #{orderId,jdbcType=BIGINT},
</if>
<if test="orderSn != null">
order_sn = #{orderSn,jdbcType=VARCHAR},
</if>
<if test="productId != null">
product_id = #{productId,jdbcType=BIGINT},
</if>
<if test="productPic != null">
product_pic = #{productPic,jdbcType=VARCHAR},
</if>
<if test="productName != null">
product_name = #{productName,jdbcType=VARCHAR},
</if>
<if test="productBrand != null">
product_brand = #{productBrand,jdbcType=VARCHAR},
</if>
<if test="productSn != null">
product_sn = #{productSn,jdbcType=VARCHAR},
</if>
<if test="productPrice != null">
product_price = #{productPrice,jdbcType=DECIMAL},
</if>
<if test="productQuantity != null">
product_quantity = #{productQuantity,jdbcType=INTEGER},
</if>
<if test="productSkuId != null">
product_sku_id = #{productSkuId,jdbcType=BIGINT},
</if>
<if test="productSkuCode != null">
product_sku_code = #{productSkuCode,jdbcType=VARCHAR},
</if>
<if test="productCategoryId != null">
product_category_id = #{productCategoryId,jdbcType=BIGINT},
</if>
<if test="sp1 != null">
sp1 = #{sp1,jdbcType=VARCHAR},
</if>
<if test="sp2 != null">
sp2 = #{sp2,jdbcType=VARCHAR},
</if>
<if test="sp3 != null">
sp3 = #{sp3,jdbcType=VARCHAR},
</if>
<if test="promotionName != null">
promotion_name = #{promotionName,jdbcType=VARCHAR},
</if>
<if test="promotionAmount != null">
promotion_amount = #{promotionAmount,jdbcType=DECIMAL},
</if>
<if test="couponAmount != null">
coupon_amount = #{couponAmount,jdbcType=DECIMAL},
</if>
<if test="integrationAmount != null">
integration_amount = #{integrationAmount,jdbcType=DECIMAL},
</if>
<if test="realAmount != null">
real_amount = #{realAmount,jdbcType=DECIMAL},
</if>
<if test="giftIntegration != null">
gift_integration = #{giftIntegration,jdbcType=INTEGER},
</if>
<if test="giftGrowth != null">
gift_growth = #{giftGrowth,jdbcType=INTEGER},
</if>
<if test="productAttr != null">
product_attr = #{productAttr,jdbcType=VARCHAR},
</if>
<if test="gmtCreate != null">
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
</if>
<if test="gmtModified != null">
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.tuling.tulingmall.history.model.OmsOrderItem">
update oms_order_item
set order_id = #{orderId,jdbcType=BIGINT},
order_sn = #{orderSn,jdbcType=VARCHAR},
product_id = #{productId,jdbcType=BIGINT},
product_pic = #{productPic,jdbcType=VARCHAR},
product_name = #{productName,jdbcType=VARCHAR},
product_brand = #{productBrand,jdbcType=VARCHAR},
product_sn = #{productSn,jdbcType=VARCHAR},
product_price = #{productPrice,jdbcType=DECIMAL},
product_quantity = #{productQuantity,jdbcType=INTEGER},
product_sku_id = #{productSkuId,jdbcType=BIGINT},
product_sku_code = #{productSkuCode,jdbcType=VARCHAR},
product_category_id = #{productCategoryId,jdbcType=BIGINT},
sp1 = #{sp1,jdbcType=VARCHAR},
sp2 = #{sp2,jdbcType=VARCHAR},
sp3 = #{sp3,jdbcType=VARCHAR},
promotion_name = #{promotionName,jdbcType=VARCHAR},
promotion_amount = #{promotionAmount,jdbcType=DECIMAL},
coupon_amount = #{couponAmount,jdbcType=DECIMAL},
integration_amount = #{integrationAmount,jdbcType=DECIMAL},
real_amount = #{realAmount,jdbcType=DECIMAL},
gift_integration = #{giftIntegration,jdbcType=INTEGER},
gift_growth = #{giftGrowth,jdbcType=INTEGER},
product_attr = #{productAttr,jdbcType=VARCHAR},
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -0,0 +1,903 @@
<?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.tuling.tulingmall.history.mapper.OmsOrderMapper">
<resultMap id="BaseResultMap" type="com.tuling.tulingmall.history.model.OmsOrder">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="member_id" jdbcType="BIGINT" property="memberId"/>
<result column="coupon_id" jdbcType="BIGINT" property="couponId"/>
<result column="order_sn" jdbcType="VARCHAR" property="orderSn"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="member_username" jdbcType="VARCHAR" property="memberUsername"/>
<result column="total_amount" jdbcType="DECIMAL" property="totalAmount"/>
<result column="pay_amount" jdbcType="DECIMAL" property="payAmount"/>
<result column="freight_amount" jdbcType="DECIMAL" property="freightAmount"/>
<result column="promotion_amount" jdbcType="DECIMAL" property="promotionAmount"/>
<result column="integration_amount" jdbcType="DECIMAL" property="integrationAmount"/>
<result column="coupon_amount" jdbcType="DECIMAL" property="couponAmount"/>
<result column="discount_amount" jdbcType="DECIMAL" property="discountAmount"/>
<result column="pay_type" jdbcType="INTEGER" property="payType"/>
<result column="source_type" jdbcType="INTEGER" property="sourceType"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="order_type" jdbcType="INTEGER" property="orderType"/>
<result column="delivery_company" jdbcType="VARCHAR" property="deliveryCompany"/>
<result column="delivery_sn" jdbcType="VARCHAR" property="deliverySn"/>
<result column="auto_confirm_day" jdbcType="INTEGER" property="autoConfirmDay"/>
<result column="integration" jdbcType="INTEGER" property="integration"/>
<result column="growth" jdbcType="INTEGER" property="growth"/>
<result column="promotion_info" jdbcType="VARCHAR" property="promotionInfo"/>
<result column="bill_type" jdbcType="INTEGER" property="billType"/>
<result column="bill_header" jdbcType="VARCHAR" property="billHeader"/>
<result column="bill_content" jdbcType="VARCHAR" property="billContent"/>
<result column="bill_receiver_phone" jdbcType="VARCHAR" property="billReceiverPhone"/>
<result column="bill_receiver_email" jdbcType="VARCHAR" property="billReceiverEmail"/>
<result column="receiver_name" jdbcType="VARCHAR" property="receiverName"/>
<result column="receiver_phone" jdbcType="VARCHAR" property="receiverPhone"/>
<result column="receiver_post_code" jdbcType="VARCHAR" property="receiverPostCode"/>
<result column="receiver_province" jdbcType="VARCHAR" property="receiverProvince"/>
<result column="receiver_city" jdbcType="VARCHAR" property="receiverCity"/>
<result column="receiver_region" jdbcType="VARCHAR" property="receiverRegion"/>
<result column="receiver_detail_address" jdbcType="VARCHAR" property="receiverDetailAddress"/>
<result column="note" jdbcType="VARCHAR" property="note"/>
<result column="confirm_status" jdbcType="INTEGER" property="confirmStatus"/>
<result column="delete_status" jdbcType="INTEGER" property="deleteStatus"/>
<result column="use_integration" jdbcType="INTEGER" property="useIntegration"/>
<result column="payment_time" jdbcType="TIMESTAMP" property="paymentTime"/>
<result column="delivery_time" jdbcType="TIMESTAMP" property="deliveryTime"/>
<result column="receive_time" jdbcType="TIMESTAMP" property="receiveTime"/>
<result column="comment_time" jdbcType="TIMESTAMP" property="commentTime"/>
<result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime"/>
<result column="qrcode" jdbcType="VARCHAR" property="qrcode"/>
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate"/>
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified"/>
<result column="version" jdbcType="INTEGER" property="version"/>
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, member_id, coupon_id, order_sn, create_time, member_username, total_amount, pay_amount,
freight_amount, promotion_amount, integration_amount, coupon_amount, discount_amount,
pay_type, source_type, status, order_type, delivery_company, delivery_sn, auto_confirm_day,
integration, growth, promotion_info, bill_type, bill_header, bill_content, bill_receiver_phone,
bill_receiver_email, receiver_name, receiver_phone, receiver_post_code, receiver_province,
receiver_city, receiver_region, receiver_detail_address, note, confirm_status, delete_status,
use_integration, payment_time, delivery_time, receive_time, comment_time, modify_time,
qrcode, gmt_create, gmt_modified, version
</sql>
<select id="selectByExample" parameterType="com.tuling.tulingmall.history.model.OmsOrderExample"
resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
'true' as QUERYID,
<include refid="Base_Column_List"/>
from oms_order
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from oms_order
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete
from oms_order
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.tuling.tulingmall.history.model.OmsOrderExample">
delete from oms_order
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="com.tuling.tulingmall.history.model.OmsOrder">
insert into oms_order (id, member_id, coupon_id,
order_sn, create_time, member_username,
total_amount, pay_amount, freight_amount,
promotion_amount, integration_amount, coupon_amount,
discount_amount, pay_type, source_type,
status, order_type, delivery_company,
delivery_sn, auto_confirm_day, integration,
growth, promotion_info, bill_type,
bill_header, bill_content, bill_receiver_phone,
bill_receiver_email, receiver_name, receiver_phone,
receiver_post_code, receiver_province, receiver_city,
receiver_region, receiver_detail_address,
note, confirm_status, delete_status,
use_integration, payment_time, delivery_time,
receive_time, comment_time, modify_time,
qrcode, gmt_create, gmt_modified,
version)
values (#{id,jdbcType=BIGINT}, #{memberId,jdbcType=BIGINT}, #{couponId,jdbcType=BIGINT},
#{orderSn,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{memberUsername,jdbcType=VARCHAR},
#{totalAmount,jdbcType=DECIMAL}, #{payAmount,jdbcType=DECIMAL}, #{freightAmount,jdbcType=DECIMAL},
#{promotionAmount,jdbcType=DECIMAL}, #{integrationAmount,jdbcType=DECIMAL},
#{couponAmount,jdbcType=DECIMAL},
#{discountAmount,jdbcType=DECIMAL}, #{payType,jdbcType=INTEGER}, #{sourceType,jdbcType=INTEGER},
#{status,jdbcType=INTEGER}, #{orderType,jdbcType=INTEGER}, #{deliveryCompany,jdbcType=VARCHAR},
#{deliverySn,jdbcType=VARCHAR}, #{autoConfirmDay,jdbcType=INTEGER}, #{integration,jdbcType=INTEGER},
#{growth,jdbcType=INTEGER}, #{promotionInfo,jdbcType=VARCHAR}, #{billType,jdbcType=INTEGER},
#{billHeader,jdbcType=VARCHAR}, #{billContent,jdbcType=VARCHAR}, #{billReceiverPhone,jdbcType=VARCHAR},
#{billReceiverEmail,jdbcType=VARCHAR}, #{receiverName,jdbcType=VARCHAR},
#{receiverPhone,jdbcType=VARCHAR},
#{receiverPostCode,jdbcType=VARCHAR}, #{receiverProvince,jdbcType=VARCHAR},
#{receiverCity,jdbcType=VARCHAR},
#{receiverRegion,jdbcType=VARCHAR}, #{receiverDetailAddress,jdbcType=VARCHAR},
#{note,jdbcType=VARCHAR}, #{confirmStatus,jdbcType=INTEGER}, #{deleteStatus,jdbcType=INTEGER},
#{useIntegration,jdbcType=INTEGER}, #{paymentTime,jdbcType=TIMESTAMP},
#{deliveryTime,jdbcType=TIMESTAMP},
#{receiveTime,jdbcType=TIMESTAMP}, #{commentTime,jdbcType=TIMESTAMP}, #{modifyTime,jdbcType=TIMESTAMP},
#{qrcode,jdbcType=VARCHAR}, #{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP},
#{version,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.tuling.tulingmall.history.model.OmsOrder">
insert into oms_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="memberId != null">
member_id,
</if>
<if test="couponId != null">
coupon_id,
</if>
<if test="orderSn != null">
order_sn,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="memberUsername != null">
member_username,
</if>
<if test="totalAmount != null">
total_amount,
</if>
<if test="payAmount != null">
pay_amount,
</if>
<if test="freightAmount != null">
freight_amount,
</if>
<if test="promotionAmount != null">
promotion_amount,
</if>
<if test="integrationAmount != null">
integration_amount,
</if>
<if test="couponAmount != null">
coupon_amount,
</if>
<if test="discountAmount != null">
discount_amount,
</if>
<if test="payType != null">
pay_type,
</if>
<if test="sourceType != null">
source_type,
</if>
<if test="status != null">
status,
</if>
<if test="orderType != null">
order_type,
</if>
<if test="deliveryCompany != null">
delivery_company,
</if>
<if test="deliverySn != null">
delivery_sn,
</if>
<if test="autoConfirmDay != null">
auto_confirm_day,
</if>
<if test="integration != null">
integration,
</if>
<if test="growth != null">
growth,
</if>
<if test="promotionInfo != null">
promotion_info,
</if>
<if test="billType != null">
bill_type,
</if>
<if test="billHeader != null">
bill_header,
</if>
<if test="billContent != null">
bill_content,
</if>
<if test="billReceiverPhone != null">
bill_receiver_phone,
</if>
<if test="billReceiverEmail != null">
bill_receiver_email,
</if>
<if test="receiverName != null">
receiver_name,
</if>
<if test="receiverPhone != null">
receiver_phone,
</if>
<if test="receiverPostCode != null">
receiver_post_code,
</if>
<if test="receiverProvince != null">
receiver_province,
</if>
<if test="receiverCity != null">
receiver_city,
</if>
<if test="receiverRegion != null">
receiver_region,
</if>
<if test="receiverDetailAddress != null">
receiver_detail_address,
</if>
<if test="note != null">
note,
</if>
<if test="confirmStatus != null">
confirm_status,
</if>
<if test="deleteStatus != null">
delete_status,
</if>
<if test="useIntegration != null">
use_integration,
</if>
<if test="paymentTime != null">
payment_time,
</if>
<if test="deliveryTime != null">
delivery_time,
</if>
<if test="receiveTime != null">
receive_time,
</if>
<if test="commentTime != null">
comment_time,
</if>
<if test="modifyTime != null">
modify_time,
</if>
<if test="qrcode != null">
qrcode,
</if>
<if test="gmtCreate != null">
gmt_create,
</if>
<if test="gmtModified != null">
gmt_modified,
</if>
<if test="version != null">
version,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="memberId != null">
#{memberId,jdbcType=BIGINT},
</if>
<if test="couponId != null">
#{couponId,jdbcType=BIGINT},
</if>
<if test="orderSn != null">
#{orderSn,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="memberUsername != null">
#{memberUsername,jdbcType=VARCHAR},
</if>
<if test="totalAmount != null">
#{totalAmount,jdbcType=DECIMAL},
</if>
<if test="payAmount != null">
#{payAmount,jdbcType=DECIMAL},
</if>
<if test="freightAmount != null">
#{freightAmount,jdbcType=DECIMAL},
</if>
<if test="promotionAmount != null">
#{promotionAmount,jdbcType=DECIMAL},
</if>
<if test="integrationAmount != null">
#{integrationAmount,jdbcType=DECIMAL},
</if>
<if test="couponAmount != null">
#{couponAmount,jdbcType=DECIMAL},
</if>
<if test="discountAmount != null">
#{discountAmount,jdbcType=DECIMAL},
</if>
<if test="payType != null">
#{payType,jdbcType=INTEGER},
</if>
<if test="sourceType != null">
#{sourceType,jdbcType=INTEGER},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="orderType != null">
#{orderType,jdbcType=INTEGER},
</if>
<if test="deliveryCompany != null">
#{deliveryCompany,jdbcType=VARCHAR},
</if>
<if test="deliverySn != null">
#{deliverySn,jdbcType=VARCHAR},
</if>
<if test="autoConfirmDay != null">
#{autoConfirmDay,jdbcType=INTEGER},
</if>
<if test="integration != null">
#{integration,jdbcType=INTEGER},
</if>
<if test="growth != null">
#{growth,jdbcType=INTEGER},
</if>
<if test="promotionInfo != null">
#{promotionInfo,jdbcType=VARCHAR},
</if>
<if test="billType != null">
#{billType,jdbcType=INTEGER},
</if>
<if test="billHeader != null">
#{billHeader,jdbcType=VARCHAR},
</if>
<if test="billContent != null">
#{billContent,jdbcType=VARCHAR},
</if>
<if test="billReceiverPhone != null">
#{billReceiverPhone,jdbcType=VARCHAR},
</if>
<if test="billReceiverEmail != null">
#{billReceiverEmail,jdbcType=VARCHAR},
</if>
<if test="receiverName != null">
#{receiverName,jdbcType=VARCHAR},
</if>
<if test="receiverPhone != null">
#{receiverPhone,jdbcType=VARCHAR},
</if>
<if test="receiverPostCode != null">
#{receiverPostCode,jdbcType=VARCHAR},
</if>
<if test="receiverProvince != null">
#{receiverProvince,jdbcType=VARCHAR},
</if>
<if test="receiverCity != null">
#{receiverCity,jdbcType=VARCHAR},
</if>
<if test="receiverRegion != null">
#{receiverRegion,jdbcType=VARCHAR},
</if>
<if test="receiverDetailAddress != null">
#{receiverDetailAddress,jdbcType=VARCHAR},
</if>
<if test="note != null">
#{note,jdbcType=VARCHAR},
</if>
<if test="confirmStatus != null">
#{confirmStatus,jdbcType=INTEGER},
</if>
<if test="deleteStatus != null">
#{deleteStatus,jdbcType=INTEGER},
</if>
<if test="useIntegration != null">
#{useIntegration,jdbcType=INTEGER},
</if>
<if test="paymentTime != null">
#{paymentTime,jdbcType=TIMESTAMP},
</if>
<if test="deliveryTime != null">
#{deliveryTime,jdbcType=TIMESTAMP},
</if>
<if test="receiveTime != null">
#{receiveTime,jdbcType=TIMESTAMP},
</if>
<if test="commentTime != null">
#{commentTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyTime != null">
#{modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="qrcode != null">
#{qrcode,jdbcType=VARCHAR},
</if>
<if test="gmtCreate != null">
#{gmtCreate,jdbcType=TIMESTAMP},
</if>
<if test="gmtModified != null">
#{gmtModified,jdbcType=TIMESTAMP},
</if>
<if test="version != null">
#{version,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.tuling.tulingmall.history.model.OmsOrderExample"
resultType="java.lang.Long">
select count(*) from oms_order
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update oms_order
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.memberId != null">
member_id = #{record.memberId,jdbcType=BIGINT},
</if>
<if test="record.couponId != null">
coupon_id = #{record.couponId,jdbcType=BIGINT},
</if>
<if test="record.orderSn != null">
order_sn = #{record.orderSn,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.memberUsername != null">
member_username = #{record.memberUsername,jdbcType=VARCHAR},
</if>
<if test="record.totalAmount != null">
total_amount = #{record.totalAmount,jdbcType=DECIMAL},
</if>
<if test="record.payAmount != null">
pay_amount = #{record.payAmount,jdbcType=DECIMAL},
</if>
<if test="record.freightAmount != null">
freight_amount = #{record.freightAmount,jdbcType=DECIMAL},
</if>
<if test="record.promotionAmount != null">
promotion_amount = #{record.promotionAmount,jdbcType=DECIMAL},
</if>
<if test="record.integrationAmount != null">
integration_amount = #{record.integrationAmount,jdbcType=DECIMAL},
</if>
<if test="record.couponAmount != null">
coupon_amount = #{record.couponAmount,jdbcType=DECIMAL},
</if>
<if test="record.discountAmount != null">
discount_amount = #{record.discountAmount,jdbcType=DECIMAL},
</if>
<if test="record.payType != null">
pay_type = #{record.payType,jdbcType=INTEGER},
</if>
<if test="record.sourceType != null">
source_type = #{record.sourceType,jdbcType=INTEGER},
</if>
<if test="record.status != null">
status = #{record.status,jdbcType=INTEGER},
</if>
<if test="record.orderType != null">
order_type = #{record.orderType,jdbcType=INTEGER},
</if>
<if test="record.deliveryCompany != null">
delivery_company = #{record.deliveryCompany,jdbcType=VARCHAR},
</if>
<if test="record.deliverySn != null">
delivery_sn = #{record.deliverySn,jdbcType=VARCHAR},
</if>
<if test="record.autoConfirmDay != null">
auto_confirm_day = #{record.autoConfirmDay,jdbcType=INTEGER},
</if>
<if test="record.integration != null">
integration = #{record.integration,jdbcType=INTEGER},
</if>
<if test="record.growth != null">
growth = #{record.growth,jdbcType=INTEGER},
</if>
<if test="record.promotionInfo != null">
promotion_info = #{record.promotionInfo,jdbcType=VARCHAR},
</if>
<if test="record.billType != null">
bill_type = #{record.billType,jdbcType=INTEGER},
</if>
<if test="record.billHeader != null">
bill_header = #{record.billHeader,jdbcType=VARCHAR},
</if>
<if test="record.billContent != null">
bill_content = #{record.billContent,jdbcType=VARCHAR},
</if>
<if test="record.billReceiverPhone != null">
bill_receiver_phone = #{record.billReceiverPhone,jdbcType=VARCHAR},
</if>
<if test="record.billReceiverEmail != null">
bill_receiver_email = #{record.billReceiverEmail,jdbcType=VARCHAR},
</if>
<if test="record.receiverName != null">
receiver_name = #{record.receiverName,jdbcType=VARCHAR},
</if>
<if test="record.receiverPhone != null">
receiver_phone = #{record.receiverPhone,jdbcType=VARCHAR},
</if>
<if test="record.receiverPostCode != null">
receiver_post_code = #{record.receiverPostCode,jdbcType=VARCHAR},
</if>
<if test="record.receiverProvince != null">
receiver_province = #{record.receiverProvince,jdbcType=VARCHAR},
</if>
<if test="record.receiverCity != null">
receiver_city = #{record.receiverCity,jdbcType=VARCHAR},
</if>
<if test="record.receiverRegion != null">
receiver_region = #{record.receiverRegion,jdbcType=VARCHAR},
</if>
<if test="record.receiverDetailAddress != null">
receiver_detail_address = #{record.receiverDetailAddress,jdbcType=VARCHAR},
</if>
<if test="record.note != null">
note = #{record.note,jdbcType=VARCHAR},
</if>
<if test="record.confirmStatus != null">
confirm_status = #{record.confirmStatus,jdbcType=INTEGER},
</if>
<if test="record.deleteStatus != null">
delete_status = #{record.deleteStatus,jdbcType=INTEGER},
</if>
<if test="record.useIntegration != null">
use_integration = #{record.useIntegration,jdbcType=INTEGER},
</if>
<if test="record.paymentTime != null">
payment_time = #{record.paymentTime,jdbcType=TIMESTAMP},
</if>
<if test="record.deliveryTime != null">
delivery_time = #{record.deliveryTime,jdbcType=TIMESTAMP},
</if>
<if test="record.receiveTime != null">
receive_time = #{record.receiveTime,jdbcType=TIMESTAMP},
</if>
<if test="record.commentTime != null">
comment_time = #{record.commentTime,jdbcType=TIMESTAMP},
</if>
<if test="record.modifyTime != null">
modify_time = #{record.modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="record.qrcode != null">
qrcode = #{record.qrcode,jdbcType=VARCHAR},
</if>
<if test="record.gmtCreate != null">
gmt_create = #{record.gmtCreate,jdbcType=TIMESTAMP},
</if>
<if test="record.gmtModified != null">
gmt_modified = #{record.gmtModified,jdbcType=TIMESTAMP},
</if>
<if test="record.version != null">
version = #{record.version,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
update oms_order
set id = #{record.id,jdbcType=BIGINT},
member_id = #{record.memberId,jdbcType=BIGINT},
coupon_id = #{record.couponId,jdbcType=BIGINT},
order_sn = #{record.orderSn,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
member_username = #{record.memberUsername,jdbcType=VARCHAR},
total_amount = #{record.totalAmount,jdbcType=DECIMAL},
pay_amount = #{record.payAmount,jdbcType=DECIMAL},
freight_amount = #{record.freightAmount,jdbcType=DECIMAL},
promotion_amount = #{record.promotionAmount,jdbcType=DECIMAL},
integration_amount = #{record.integrationAmount,jdbcType=DECIMAL},
coupon_amount = #{record.couponAmount,jdbcType=DECIMAL},
discount_amount = #{record.discountAmount,jdbcType=DECIMAL},
pay_type = #{record.payType,jdbcType=INTEGER},
source_type = #{record.sourceType,jdbcType=INTEGER},
status = #{record.status,jdbcType=INTEGER},
order_type = #{record.orderType,jdbcType=INTEGER},
delivery_company = #{record.deliveryCompany,jdbcType=VARCHAR},
delivery_sn = #{record.deliverySn,jdbcType=VARCHAR},
auto_confirm_day = #{record.autoConfirmDay,jdbcType=INTEGER},
integration = #{record.integration,jdbcType=INTEGER},
growth = #{record.growth,jdbcType=INTEGER},
promotion_info = #{record.promotionInfo,jdbcType=VARCHAR},
bill_type = #{record.billType,jdbcType=INTEGER},
bill_header = #{record.billHeader,jdbcType=VARCHAR},
bill_content = #{record.billContent,jdbcType=VARCHAR},
bill_receiver_phone = #{record.billReceiverPhone,jdbcType=VARCHAR},
bill_receiver_email = #{record.billReceiverEmail,jdbcType=VARCHAR},
receiver_name = #{record.receiverName,jdbcType=VARCHAR},
receiver_phone = #{record.receiverPhone,jdbcType=VARCHAR},
receiver_post_code = #{record.receiverPostCode,jdbcType=VARCHAR},
receiver_province = #{record.receiverProvince,jdbcType=VARCHAR},
receiver_city = #{record.receiverCity,jdbcType=VARCHAR},
receiver_region = #{record.receiverRegion,jdbcType=VARCHAR},
receiver_detail_address = #{record.receiverDetailAddress,jdbcType=VARCHAR},
note = #{record.note,jdbcType=VARCHAR},
confirm_status = #{record.confirmStatus,jdbcType=INTEGER},
delete_status = #{record.deleteStatus,jdbcType=INTEGER},
use_integration = #{record.useIntegration,jdbcType=INTEGER},
payment_time = #{record.paymentTime,jdbcType=TIMESTAMP},
delivery_time = #{record.deliveryTime,jdbcType=TIMESTAMP},
receive_time = #{record.receiveTime,jdbcType=TIMESTAMP},
comment_time = #{record.commentTime,jdbcType=TIMESTAMP},
modify_time = #{record.modifyTime,jdbcType=TIMESTAMP},
qrcode = #{record.qrcode,jdbcType=VARCHAR},
gmt_create = #{record.gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{record.gmtModified,jdbcType=TIMESTAMP},
version = #{record.version,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.tuling.tulingmall.history.model.OmsOrder">
update oms_order
<set>
<if test="memberId != null">
member_id = #{memberId,jdbcType=BIGINT},
</if>
<if test="couponId != null">
coupon_id = #{couponId,jdbcType=BIGINT},
</if>
<if test="orderSn != null">
order_sn = #{orderSn,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="memberUsername != null">
member_username = #{memberUsername,jdbcType=VARCHAR},
</if>
<if test="totalAmount != null">
total_amount = #{totalAmount,jdbcType=DECIMAL},
</if>
<if test="payAmount != null">
pay_amount = #{payAmount,jdbcType=DECIMAL},
</if>
<if test="freightAmount != null">
freight_amount = #{freightAmount,jdbcType=DECIMAL},
</if>
<if test="promotionAmount != null">
promotion_amount = #{promotionAmount,jdbcType=DECIMAL},
</if>
<if test="integrationAmount != null">
integration_amount = #{integrationAmount,jdbcType=DECIMAL},
</if>
<if test="couponAmount != null">
coupon_amount = #{couponAmount,jdbcType=DECIMAL},
</if>
<if test="discountAmount != null">
discount_amount = #{discountAmount,jdbcType=DECIMAL},
</if>
<if test="payType != null">
pay_type = #{payType,jdbcType=INTEGER},
</if>
<if test="sourceType != null">
source_type = #{sourceType,jdbcType=INTEGER},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="orderType != null">
order_type = #{orderType,jdbcType=INTEGER},
</if>
<if test="deliveryCompany != null">
delivery_company = #{deliveryCompany,jdbcType=VARCHAR},
</if>
<if test="deliverySn != null">
delivery_sn = #{deliverySn,jdbcType=VARCHAR},
</if>
<if test="autoConfirmDay != null">
auto_confirm_day = #{autoConfirmDay,jdbcType=INTEGER},
</if>
<if test="integration != null">
integration = #{integration,jdbcType=INTEGER},
</if>
<if test="growth != null">
growth = #{growth,jdbcType=INTEGER},
</if>
<if test="promotionInfo != null">
promotion_info = #{promotionInfo,jdbcType=VARCHAR},
</if>
<if test="billType != null">
bill_type = #{billType,jdbcType=INTEGER},
</if>
<if test="billHeader != null">
bill_header = #{billHeader,jdbcType=VARCHAR},
</if>
<if test="billContent != null">
bill_content = #{billContent,jdbcType=VARCHAR},
</if>
<if test="billReceiverPhone != null">
bill_receiver_phone = #{billReceiverPhone,jdbcType=VARCHAR},
</if>
<if test="billReceiverEmail != null">
bill_receiver_email = #{billReceiverEmail,jdbcType=VARCHAR},
</if>
<if test="receiverName != null">
receiver_name = #{receiverName,jdbcType=VARCHAR},
</if>
<if test="receiverPhone != null">
receiver_phone = #{receiverPhone,jdbcType=VARCHAR},
</if>
<if test="receiverPostCode != null">
receiver_post_code = #{receiverPostCode,jdbcType=VARCHAR},
</if>
<if test="receiverProvince != null">
receiver_province = #{receiverProvince,jdbcType=VARCHAR},
</if>
<if test="receiverCity != null">
receiver_city = #{receiverCity,jdbcType=VARCHAR},
</if>
<if test="receiverRegion != null">
receiver_region = #{receiverRegion,jdbcType=VARCHAR},
</if>
<if test="receiverDetailAddress != null">
receiver_detail_address = #{receiverDetailAddress,jdbcType=VARCHAR},
</if>
<if test="note != null">
note = #{note,jdbcType=VARCHAR},
</if>
<if test="confirmStatus != null">
confirm_status = #{confirmStatus,jdbcType=INTEGER},
</if>
<if test="deleteStatus != null">
delete_status = #{deleteStatus,jdbcType=INTEGER},
</if>
<if test="useIntegration != null">
use_integration = #{useIntegration,jdbcType=INTEGER},
</if>
<if test="paymentTime != null">
payment_time = #{paymentTime,jdbcType=TIMESTAMP},
</if>
<if test="deliveryTime != null">
delivery_time = #{deliveryTime,jdbcType=TIMESTAMP},
</if>
<if test="receiveTime != null">
receive_time = #{receiveTime,jdbcType=TIMESTAMP},
</if>
<if test="commentTime != null">
comment_time = #{commentTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyTime != null">
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
</if>
<if test="qrcode != null">
qrcode = #{qrcode,jdbcType=VARCHAR},
</if>
<if test="gmtCreate != null">
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
</if>
<if test="gmtModified != null">
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
</if>
<if test="version != null">
version = #{version,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.tuling.tulingmall.history.model.OmsOrder">
update oms_order
set member_id = #{memberId,jdbcType=BIGINT},
coupon_id = #{couponId,jdbcType=BIGINT},
order_sn = #{orderSn,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
member_username = #{memberUsername,jdbcType=VARCHAR},
total_amount = #{totalAmount,jdbcType=DECIMAL},
pay_amount = #{payAmount,jdbcType=DECIMAL},
freight_amount = #{freightAmount,jdbcType=DECIMAL},
promotion_amount = #{promotionAmount,jdbcType=DECIMAL},
integration_amount = #{integrationAmount,jdbcType=DECIMAL},
coupon_amount = #{couponAmount,jdbcType=DECIMAL},
discount_amount = #{discountAmount,jdbcType=DECIMAL},
pay_type = #{payType,jdbcType=INTEGER},
source_type = #{sourceType,jdbcType=INTEGER},
status = #{status,jdbcType=INTEGER},
order_type = #{orderType,jdbcType=INTEGER},
delivery_company = #{deliveryCompany,jdbcType=VARCHAR},
delivery_sn = #{deliverySn,jdbcType=VARCHAR},
auto_confirm_day = #{autoConfirmDay,jdbcType=INTEGER},
integration = #{integration,jdbcType=INTEGER},
growth = #{growth,jdbcType=INTEGER},
promotion_info = #{promotionInfo,jdbcType=VARCHAR},
bill_type = #{billType,jdbcType=INTEGER},
bill_header = #{billHeader,jdbcType=VARCHAR},
bill_content = #{billContent,jdbcType=VARCHAR},
bill_receiver_phone = #{billReceiverPhone,jdbcType=VARCHAR},
bill_receiver_email = #{billReceiverEmail,jdbcType=VARCHAR},
receiver_name = #{receiverName,jdbcType=VARCHAR},
receiver_phone = #{receiverPhone,jdbcType=VARCHAR},
receiver_post_code = #{receiverPostCode,jdbcType=VARCHAR},
receiver_province = #{receiverProvince,jdbcType=VARCHAR},
receiver_city = #{receiverCity,jdbcType=VARCHAR},
receiver_region = #{receiverRegion,jdbcType=VARCHAR},
receiver_detail_address = #{receiverDetailAddress,jdbcType=VARCHAR},
note = #{note,jdbcType=VARCHAR},
confirm_status = #{confirmStatus,jdbcType=INTEGER},
delete_status = #{deleteStatus,jdbcType=INTEGER},
use_integration = #{useIntegration,jdbcType=INTEGER},
payment_time = #{paymentTime,jdbcType=TIMESTAMP},
delivery_time = #{deliveryTime,jdbcType=TIMESTAMP},
receive_time = #{receiveTime,jdbcType=TIMESTAMP},
comment_time = #{commentTime,jdbcType=TIMESTAMP},
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
qrcode = #{qrcode,jdbcType=VARCHAR},
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
version = #{version,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -0,0 +1,55 @@
import org.apache.shardingsphere.core.strategy.keygen.SnowflakeShardingKeyGenerator;
import java.util.Properties;
/**
* @author :楼兰
* @description:
**/
//@SpringBootTest
//@RunWith(SpringRunner.class)
public class CalTest {
// @Autowired
// private OmsPortalOrderService portalOrderService;
//
// @Test
// public void generateOrder() throws BusinessException {
// OrderParam orderParam = new OrderParam();
// orderParam.setMemberReceiveAddressId(5L);
// orderParam.setPayType(1);
// orderParam.setItemIds(Arrays.asList(55L));
// Long memberId=8L;
// System.out.println(portalOrderService.generateOrder(orderParam, memberId));
// }
public static void main(String[] args) {
Long[] ids = new Long[]{593116103984001025L,593116341633265664L,
593116410474377217L,593116541198249984L,593116602653192193L,
593116676980453377L,593116734727630848L,593116802474029057L,
593116905846845440L,593116968098705409L};
Properties properties = new Properties();
properties.setProperty("worker.id","123");
SnowflakeShardingKeyGenerator generator = new SnowflakeShardingKeyGenerator();
generator.setProperties(properties);
for(int i = 0; i < 10 ; i ++){
// System.out.println("db = " + (i % 2));
// System.out.println("oms_order_" + (i+1) % 4 / 2);
Long id= (Long)generator.generateKey();
System.out.println(id);
System.out.println("db = " + (id % 2));
System.out.println("oms_order_" + (id+1) % 4 / 2);
// System.out.println("===========================");
id = ids[i];
System.out.println(id);
System.out.println("db = " + (id % 2));
System.out.println("oms_order_" + (id+1) % 4 / 2);
System.out.println("===========================");
}
}
}

View File

@@ -0,0 +1,66 @@
package com.tuling;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
/**
* @author :楼兰
* @date Created in 2021/4/19
* @description:
**/
@SpringBootTest
@RunWith(SpringRunner.class)
public class BusiTest {
// @Autowired
// private OmsPortalOrderService portalOrderService;
//
// @Test
// public void generateOrder() throws BusinessException {
// OrderParam orderParam = new OrderParam();
// orderParam.setMemberReceiveAddressId(5L);
// orderParam.setPayType(1);
// orderParam.setItemIds(Arrays.asList(55L));
// Long memberId=8L;
// System.out.println(portalOrderService.generateOrder(orderParam, memberId));
// }
// @Autowired
// private SeataATOrderService orderService;
//
// @Test
// public void executeOrderService() {
// orderService.init();
// orderService.insert(10);
// System.out.println("1 == "+orderService.selectAll());
// orderService.insertFailed(20);
// System.out.println("2 == "+orderService.selectAll());
// orderService.cleanup();
// }
//
// @Autowired
// private DataSource dataSource;
//
// @Test
// public void rawSeataTest() throws SQLException {
// TransactionTypeHolder.set(TransactionType.BASE);
// try (Connection connection = dataSource.getConnection()) {
// connection.setAutoCommit(false);
// PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO t_order (user_id, status) VALUES (?, ?)");
// doInsert(preparedStatement);
// connection.commit();
// } finally {
// TransactionTypeHolder.clear();
// }
// }
//
// private void doInsert(final PreparedStatement preparedStatement) throws SQLException {
// for (int i = 0; i < 10; i++) {
// preparedStatement.setObject(1, i);
// preparedStatement.setObject(2, "init");
// preparedStatement.executeUpdate();
// }
// }
}