Browse Source

颜选商城V1.0.3

kaick 1 năm trước cách đây
mục cha
commit
0182e44f45
23 tập tin đã thay đổi với 2762 bổ sung447 xóa
  1. 2 0
      src/main/java/com/caimei/modules/bulkpurchase/web/CmRefundsProductController.java
  2. 112 108
      src/main/java/com/caimei/modules/hehe/service/HeHeNewOrderService.java
  3. 88 0
      src/main/java/com/caimei/modules/order/dao/NewOrderDao.java
  4. 87 0
      src/main/java/com/caimei/modules/order/dao/NewShopOrderDao.java
  5. 52 1
      src/main/java/com/caimei/modules/order/entity/NewOrder.java
  6. 64 0
      src/main/java/com/caimei/modules/order/entity/NewShopOrder.java
  7. 31 31
      src/main/java/com/caimei/modules/order/service/NewOrderService.java
  8. 149 0
      src/main/java/com/caimei/modules/order/service/NewShopOrderService.java
  9. 2 1
      src/main/resources/mappings/modules/cmpage/CmPageCentreMapper.xml
  10. 6 1
      src/main/resources/mappings/modules/hehe/CmHeheProductMapper.xml
  11. 30 20
      src/main/resources/mappings/modules/hehe/CmHeheUserMapper.xml
  12. 807 0
      src/main/resources/mappings/modules/order/OrderMapper.xml
  13. 1018 0
      src/main/resources/mappings/modules/order/ShopOrderMapper.xml
  14. 4 1
      src/main/resources/mappings/modules/product/ProductMapper.xml
  15. 1 1
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/refundRecord.jsp
  16. 5 4
      src/main/webapp/WEB-INF/views/modules/hehe/cmHeheProductForm.jsp
  17. 4 4
      src/main/webapp/WEB-INF/views/modules/hehe/cmHeheProductList.jsp
  18. 230 205
      src/main/webapp/WEB-INF/views/modules/hehe/heheNewOrderDetail.jsp
  19. 44 44
      src/main/webapp/WEB-INF/views/modules/hehe/heheNewOrderList.jsp
  20. 1 1
      src/main/webapp/WEB-INF/views/modules/hehe/userActivityProductList.jsp
  21. 1 1
      src/main/webapp/WEB-INF/views/modules/order/cmOrderRemarksFormNew.jsp
  22. 1 1
      src/main/webapp/WEB-INF/views/modules/order/cmReturnedPurchaseList.jsp
  23. 23 23
      src/main/webapp/WEB-INF/views/modules/order/orderDetail.jsp

+ 2 - 0
src/main/java/com/caimei/modules/bulkpurchase/web/CmRefundsProductController.java

@@ -601,6 +601,7 @@ public class CmRefundsProductController extends BaseController {
             model.addAttribute("bpClauses", bpClauses);
             model.addAttribute("cmReturnedPurchaseList", dataList);
             model.addAttribute("order", newOrder);
+            model.addAttribute("orderType", cmReturnedPurchase.getOrderType());
             model.addAttribute("returnedPurchaseFee", returnedPurchaseFee);
             model.addAttribute("refundFee", refundFee);
         } catch (Exception e) {
@@ -753,6 +754,7 @@ public class CmRefundsProductController extends BaseController {
         model.addAttribute("refundFee", refundFee);
         model.addAttribute("from", from);
         model.addAttribute("orderID", cmReturnedPurchase.getOrderID().toString());
+        model.addAttribute("orderType", cmReturnedPurchase.getOrderType());
 
         return "modules/bulkpurchase/refundRecord";
     }

+ 112 - 108
src/main/java/com/caimei/modules/hehe/service/HeHeNewOrderService.java

@@ -5,6 +5,8 @@ import com.caimei.modules.hehe.entity.CmHeheCouponOrderRecord;
 import com.caimei.modules.order.dao.*;
 import com.caimei.modules.order.entity.*;
 import com.caimei.modules.order.service.CmReceiptOrderRelationService;
+import com.caimei.modules.order.service.NewOrderService;
+import com.caimei.modules.order.service.NewShopOrderService;
 import com.caimei.modules.order.service.OrderUserInfoService;
 import com.caimei.modules.order.utils.NewOrderStatus;
 import com.caimei.modules.product.dao.CmPromotionDao;
@@ -52,6 +54,8 @@ public class HeHeNewOrderService extends CrudService<HeHeNewOrderDao, NewOrder>
     @Resource
     private NewShopOrderDao newShopOrderDao;
     @Resource
+    private NewOrderService newOrderService;
+    @Resource
     private CmUserDao cmUserDao;
     @Resource
     private CmDiscernReceiptDao cmDiscernReceiptDao;
@@ -68,114 +72,114 @@ public class HeHeNewOrderService extends CrudService<HeHeNewOrderDao, NewOrder>
 
     @Override
     public NewOrder get(String id) {
-        NewOrder newOrder = super.get(id);
-        CmUser user = cmUserDao.get(newOrder.getUserID().toString());
-        if (user != null) {
-            //查询用户余额,机构名
-            newOrder.setBuyer(user.getName());
-            Double ableUserMoney = user.getAbleUserMoney() == null ? 0d : user.getAbleUserMoney();
-            newOrder.setAbleUserMoney(ableUserMoney);
-        }
-        List<Integer> l = new ArrayList<>();
-        l.add(newOrder.getOrderID());
-        List<Integer> orderIds = cmDiscernReceiptDao.findRebateOrderID(l);
-        if (orderIds.contains(newOrder.getOrderID()))
-            newOrder.setRebateOrder("1");
-        else
-            newOrder.setRebateOrder("0");
-        if (null != newOrder) {
-            // 获取订单优惠券使用记录
-            if (newOrder.getCouponAmount() != null && newOrder.getCouponAmount() > 0) {
-                CmHeheCouponOrderRecord couponRecord = heHeNewOrderDao.findOrderCouponRecord(newOrder.getOrderID());
-                if (couponRecord != null) {
-                    newOrder.setReceiveCouponId(couponRecord.getReceiveCouponId());
-                    newOrder.setHeheCouponRecord(couponRecord);
-                }
-            }
-            // 获取订单分享减免记录
-            if (newOrder.getReductionAmount() != null && newOrder.getReductionAmount() > 0) {
-                Double reductionTouchPrice = heHeNewOrderDao.findReductionTouchPrice(newOrder.getOrderID());
-                newOrder.setReductionTouchPrice(reductionTouchPrice);
-            }
-            //获取订单客户
-            OrderUserInfo orderUserInfo = orderUserInfoService.findByOrderID(newOrder.getOrderID());
-            if (null != orderUserInfo) {
-                newOrder.setBpOrderUserinfo(orderUserInfo);
-            }
-            //获取订单商品
-            List<NewOrderProduct> list = new ArrayList<>();
-            List<NewShopOrder> shopOrders = newShopOrderDao.findListByOrderID(newOrder.getOrderID());
-            if (CollectionUtils.isNotEmpty(shopOrders)) {
-                for (NewShopOrder shopOrder : shopOrders) {
-                    List<NewOrderProduct> pList = newOrderProductDao.findListByShopOrderID(shopOrder.getShopOrderID());
-                    pList.forEach(orderProduct -> {
-                        if (orderProduct.getLadderPriceFlag() == 1) {
-                            // 查询订单商品阶梯价格
-                            List<OrderProductLadderPrice> ladderPriceList = newOrderProductDao.findladderPriceList(orderProduct.getOrderProductID());
-                            if (null != ladderPriceList && ladderPriceList.size() > 0) {
-                                IntStream.range(0, ladderPriceList.size()).forEach(i -> {
-                                    if (i == ladderPriceList.size() - 1) {
-                                        ladderPriceList.get(i).setBuyNumRangeShow("≥" + ladderPriceList.get(i).getBuyNum());
-                                    } else {
-                                        String buyNumRangeShow = ladderPriceList.get(i).getBuyNum() + "~" + (ladderPriceList.get(i + 1).getBuyNum() - 1);
-                                        ladderPriceList.get(i).setBuyNumRangeShow(buyNumRangeShow);
-                                    }
-                                });
-                                orderProduct.setOrderProductLadderPriceList(ladderPriceList);
-                            }
-                        }
-                        //分销者名称
-                        if (orderProduct.getHeUserId() != null && orderProduct.getHeUserId() > 0) {
-                            String name = heHeNewOrderDao.findHeUser(orderProduct.getHeUserId());
-                            orderProduct.setHeUserName(name);
-                        }
-                    });
-                    list.addAll(pList);
-                    shopOrder.setNewOrderProducts(pList);
-                    if (pList.stream().anyMatch(p -> p.getProductID() == 999))
-                        shopOrder.setPostFeeCos("1");
-                    pList.forEach(item -> {
-                        if (NewOrderStatus.hasReturn(newOrder.getStatus())) {
-                            Integer returningNum = newOrderProductDao.getReturningNum(item.getOrderProductID());
-                            Integer returnedNum = newOrderProductDao.getReturnedNum(item.getOrderProductID());
-                            item.setReturningNum(returningNum);
-                            item.setReturnedNum(returnedNum);
-                        }
-                        /**确认收货信息*/
-                        if (NewOrderStatus.hasReceived(newOrder.getStatus())) {
-                            Integer receivedNum = newOrderProductDao.getReceivedNum(item.getOrderProductID());
-                            item.setReceivedNum(receivedNum);
-                        }
-                        String domain = SysConfig.getStringConfig("crm.server.domain");
-                        item.setProductImage(AppUtils.getProductImageURL(item.getProductImage(), AppKeys.ORIGINAL_PICTURE, domain));
-                        if (item != null && item.getOrderPromotionsId() != null && item.getOrderPromotionsId() > 0) {
-                            item.setProductPromotion(cmPromotionDao.findOrderPromotions(item.getOrderPromotionsId()));
-                        }
-                    });
-                    Double payed = cmPayShopRecordDao.sumByShopOrderID(shopOrder.getShopOrderID());
-                    shopOrder.setPayed(payed);
-                }
-                newOrder.setNewShopOrders(shopOrders);
-            }
-            if (CollectionUtils.isNotEmpty(list)) {
-                newOrder.setOrderProduct(list);
-                double freight = 0D;
-                double totalAddedValueTax = 0D;
-                for (NewOrderProduct op : list) {
-                    if (op.getProductID().intValue() == 999) { //邮费商品
-                        freight += op.getPrice();
-                    }
-                    totalAddedValueTax += op.getTotalAddedValueTax();
-                }
-                if ("1".equals(newOrder.getFreePostFlag())) newOrder.setFreight(freight);
-                newOrder.setTotalAddedValueTax(totalAddedValueTax);
-            }
-            shopOrders.sort((so1, so2) -> {
-                //给子订单排序  邮费排在最后  其余的按shopOrderID  asc
-                if ("1".equals(so1.getPostFeeCos())) return 1;
-                return so1.getShopOrderID() - so2.getShopOrderID();
-            });
-        }
+        NewOrder newOrder = newOrderService.get(id);
+//        CmUser user = cmUserDao.get(newOrder.getUserID().toString());
+//        if (user != null) {
+//            //查询用户余额,机构名
+//            newOrder.setBuyer(user.getName());
+//            Double ableUserMoney = user.getAbleUserMoney() == null ? 0d : user.getAbleUserMoney();
+//            newOrder.setAbleUserMoney(ableUserMoney);
+//        }
+//        List<Integer> l = new ArrayList<>();
+//        l.add(newOrder.getOrderID());
+//        List<Integer> orderIds = cmDiscernReceiptDao.findRebateOrderID(l);
+//        if (orderIds.contains(newOrder.getOrderID()))
+//            newOrder.setRebateOrder("1");
+//        else
+//            newOrder.setRebateOrder("0");
+//        if (null != newOrder) {
+//            // 获取订单优惠券使用记录
+//            if (newOrder.getCouponAmount() != null && newOrder.getCouponAmount() > 0) {
+//                CmHeheCouponOrderRecord couponRecord = heHeNewOrderDao.findOrderCouponRecord(newOrder.getOrderID());
+//                if (couponRecord != null) {
+//                    newOrder.setReceiveCouponId(couponRecord.getReceiveCouponId());
+//                    newOrder.setHeheCouponRecord(couponRecord);
+//                }
+//            }
+//            // 获取订单分享减免记录
+//            if (newOrder.getReductionAmount() != null && newOrder.getReductionAmount() > 0) {
+//                Double reductionTouchPrice = heHeNewOrderDao.findReductionTouchPrice(newOrder.getOrderID());
+//                newOrder.setReductionTouchPrice(reductionTouchPrice);
+//            }
+//            //获取订单客户
+//            OrderUserInfo orderUserInfo = orderUserInfoService.findByOrderID(newOrder.getOrderID());
+//            if (null != orderUserInfo) {
+//                newOrder.setBpOrderUserinfo(orderUserInfo);
+//            }
+//            //获取订单商品
+//            List<NewOrderProduct> list = new ArrayList<>();
+//            List<NewShopOrder> shopOrders = newShopOrderDao.findListByOrderID(newOrder.getOrderID());
+//            if (CollectionUtils.isNotEmpty(shopOrders)) {
+//                for (NewShopOrder shopOrder : shopOrders) {
+//                    List<NewOrderProduct> pList = newOrderProductDao.findListByShopOrderID(shopOrder.getShopOrderID());
+//                    pList.forEach(orderProduct -> {
+//                        if (orderProduct.getLadderPriceFlag() == 1) {
+//                            // 查询订单商品阶梯价格
+//                            List<OrderProductLadderPrice> ladderPriceList = newOrderProductDao.findladderPriceList(orderProduct.getOrderProductID());
+//                            if (null != ladderPriceList && ladderPriceList.size() > 0) {
+//                                IntStream.range(0, ladderPriceList.size()).forEach(i -> {
+//                                    if (i == ladderPriceList.size() - 1) {
+//                                        ladderPriceList.get(i).setBuyNumRangeShow("≥" + ladderPriceList.get(i).getBuyNum());
+//                                    } else {
+//                                        String buyNumRangeShow = ladderPriceList.get(i).getBuyNum() + "~" + (ladderPriceList.get(i + 1).getBuyNum() - 1);
+//                                        ladderPriceList.get(i).setBuyNumRangeShow(buyNumRangeShow);
+//                                    }
+//                                });
+//                                orderProduct.setOrderProductLadderPriceList(ladderPriceList);
+//                            }
+//                        }
+//                        //分销者名称
+//                        if (orderProduct.getHeUserId() != null && orderProduct.getHeUserId() > 0) {
+//                            String name = heHeNewOrderDao.findHeUser(orderProduct.getHeUserId());
+//                            orderProduct.setHeUserName(name);
+//                        }
+//                    });
+//                    list.addAll(pList);
+//                    shopOrder.setNewOrderProducts(pList);
+//                    if (pList.stream().anyMatch(p -> p.getProductID() == 999))
+//                        shopOrder.setPostFeeCos("1");
+//                    pList.forEach(item -> {
+//                        if (NewOrderStatus.hasReturn(newOrder.getStatus())) {
+//                            Integer returningNum = newOrderProductDao.getReturningNum(item.getOrderProductID());
+//                            Integer returnedNum = newOrderProductDao.getReturnedNum(item.getOrderProductID());
+//                            item.setReturningNum(returningNum);
+//                            item.setReturnedNum(returnedNum);
+//                        }
+//                        /**确认收货信息*/
+//                        if (NewOrderStatus.hasReceived(newOrder.getStatus())) {
+//                            Integer receivedNum = newOrderProductDao.getReceivedNum(item.getOrderProductID());
+//                            item.setReceivedNum(receivedNum);
+//                        }
+//                        String domain = SysConfig.getStringConfig("crm.server.domain");
+//                        item.setProductImage(AppUtils.getProductImageURL(item.getProductImage(), AppKeys.ORIGINAL_PICTURE, domain));
+//                        if (item != null && item.getOrderPromotionsId() != null && item.getOrderPromotionsId() > 0) {
+//                            item.setProductPromotion(cmPromotionDao.findOrderPromotions(item.getOrderPromotionsId()));
+//                        }
+//                    });
+//                    Double payed = cmPayShopRecordDao.sumByShopOrderID(shopOrder.getShopOrderID());
+//                    shopOrder.setPayed(payed);
+//                }
+//                newOrder.setNewShopOrders(shopOrders);
+//            }
+//            if (CollectionUtils.isNotEmpty(list)) {
+//                newOrder.setOrderProduct(list);
+//                double freight = 0D;
+//                double totalAddedValueTax = 0D;
+//                for (NewOrderProduct op : list) {
+//                    if (op.getProductID().intValue() == 999) { //邮费商品
+//                        freight += op.getPrice();
+//                    }
+//                    totalAddedValueTax += op.getTotalAddedValueTax();
+//                }
+//                if ("1".equals(newOrder.getFreePostFlag())) newOrder.setFreight(freight);
+//                newOrder.setTotalAddedValueTax(totalAddedValueTax);
+//            }
+//            shopOrders.sort((so1, so2) -> {
+//                //给子订单排序  邮费排在最后  其余的按shopOrderID  asc
+//                if ("1".equals(so1.getPostFeeCos())) return 1;
+//                return so1.getShopOrderID() - so2.getShopOrderID();
+//            });
+//        }
         return newOrder;
     }
 

+ 88 - 0
src/main/java/com/caimei/modules/order/dao/NewOrderDao.java

@@ -5,6 +5,7 @@ import com.caimei.modules.coupon.entity.CmCouponOrderRecord;
 import com.caimei.modules.order.entity.*;
 import com.caimei.modules.product.entity.CmPromotion;
 import com.caimei.modules.user.entity.NewCmSp;
+import com.caimei.po.neworder.CmOrder;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import org.apache.ibatis.annotations.Param;
@@ -268,4 +269,91 @@ public interface NewOrderDao extends CrudDao<NewOrder> {
     List<SplitAccountPo> getSplitRecord(Integer orderID);
 
     Integer getSplitTime(Integer shopOrderId);
+
+    /**
+     * 查询用户模块重构-主订单
+     *
+     * @param orderID 用户模块重构-主订单主键
+     * @return 用户模块重构-主订单
+     */
+    public NewOrder getCmOrderByOrderID(String orderID);
+
+    /**
+     * 查询用户模块重构-主订单Id
+     *
+     * @param cmOrder 用户模块重构-主订单
+     * @return String
+     */
+    public String getById(NewOrder cmOrder);
+
+    /**
+     * 查询用户模块重构-主订单Ids
+     *
+     * @param cmOrder 用户模块重构-主订单
+     * @return List<String>
+     */
+    public List<String> getByIds(NewOrder cmOrder);
+
+    /**
+     * 查询用户模块重构-主订单
+     *
+     * @param cmOrder 用户模块重构-主订单
+     * @return 用户模块重构-主订单集合
+     */
+    public NewOrder getByCmOrder(NewOrder cmOrder);
+
+    /**
+     * 查询用户模块重构-主订单列表
+     *
+     * @param cmOrder 用户模块重构-主订单
+     * @return 用户模块重构-主订单集合
+     */
+    public List<NewOrder> getCmOrderList(NewOrder cmOrder);
+    /**
+     * 查询用户模块重构-主订单记录总数
+     *
+     * @param cmOrder 用户模块重构-主订单
+     * @return 用户模块重构-主订单Integer
+     */
+    public int getCmOrderCount(NewOrder cmOrder);
+
+    /**
+     * 新增用户模块重构-主订单
+     *
+     * @param cmOrder 用户模块重构-主订单
+     * @return 结果
+     */
+    public int addCmOrder(NewOrder cmOrder);
+
+    /**
+     * 修改用户模块重构-主订单
+     *
+     * @param cmOrder 用户模块重构-主订单
+     * @return 结果
+     */
+    public int updateCmOrder(NewOrder cmOrder);
+
+    /**
+     * 删除用户模块重构-主订单
+     *
+     * @param orderID 用户模块重构-主订单主键
+     * @return 结果
+     */
+    public int delCmOrderByOrderID(String orderID);
+
+    /**
+     * 批量删除用户模块重构-主订单
+     *
+     * @param orderIDs 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int delCmOrderByOrderIDs(@Param("orderIDs") String[] orderIDs);
+
+    /**
+     * 修改批量删除用户模块重构-主订单
+     *
+     * @param orderIDs 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int updateDelCmOrderByOrderIDs(@Param("orderIDs") String[] orderIDs,@Param("delFlag") Integer delFlag);
 }

+ 87 - 0
src/main/java/com/caimei/modules/order/dao/NewShopOrderDao.java

@@ -2,6 +2,7 @@ package com.caimei.modules.order.dao;
 
 import com.caimei.modules.order.entity.NewShopOrder;
 import com.caimei.modules.order.entity.SettleRecord;
+import com.caimei.po.neworder.CmShopOrder;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import org.apache.ibatis.annotations.Param;
@@ -85,4 +86,90 @@ public interface NewShopOrderDao extends CrudDao<NewShopOrder> {
 
     //查询子订单是 线上 还是 线上
     List<Integer> payWay(Integer shopOrderID);
+    /**
+     * 查询子订单
+     *
+     * @param shopOrderID 子订单主键
+     * @return 子订单
+     */
+    public NewShopOrder getCmShopOrderByShopOrderID(String shopOrderID);
+
+    /**
+     * 查询子订单Id
+     *
+     * @param cmShopOrder 子订单
+     * @return String
+     */
+    public String getById(NewShopOrder cmShopOrder);
+
+    /**
+     * 查询子订单Ids
+     *
+     * @param cmShopOrder 子订单
+     * @return List<String>
+     */
+    public List<String> getByIds(NewShopOrder cmShopOrder);
+
+    /**
+     * 查询子订单
+     *
+     * @param cmShopOrder 子订单
+     * @return 子订单集合
+     */
+    public NewShopOrder getByCmShopOrder(NewShopOrder cmShopOrder);
+
+    /**
+     * 查询子订单列表
+     *
+     * @param cmShopOrder 子订单
+     * @return 子订单集合
+     */
+    public List<NewShopOrder> getCmShopOrderList(NewShopOrder cmShopOrder);
+    /**
+     * 查询子订单记录总数
+     *
+     * @param cmShopOrder 子订单
+     * @return 子订单Integer
+     */
+    public int getCmShopOrderCount(NewShopOrder cmShopOrder);
+
+    /**
+     * 新增子订单
+     *
+     * @param cmShopOrder 子订单
+     * @return 结果
+     */
+    public int addCmShopOrder(NewShopOrder cmShopOrder);
+
+    /**
+     * 修改子订单
+     *
+     * @param cmShopOrder 子订单
+     * @return 结果
+     */
+    public int updateCmShopOrder(NewShopOrder cmShopOrder);
+
+    /**
+     * 删除子订单
+     *
+     * @param shopOrderID 子订单主键
+     * @return 结果
+     */
+    public int delCmShopOrderByShopOrderID(String shopOrderID);
+
+    /**
+     * 批量删除子订单
+     *
+     * @param shopOrderIDs 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int delCmShopOrderByShopOrderIDs(@Param("shopOrderIDs") String[] shopOrderIDs);
+
+    /**
+     * 修改批量删除子订单
+     *
+     * @param shopOrderIDs 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int updateDelCmShopOrderByShopOrderIDs(@Param("shopOrderIDs") String[] shopOrderIDs,@Param("delFlag") Integer delFlag);
 }

+ 52 - 1
src/main/java/com/caimei/modules/order/entity/NewOrder.java

@@ -165,12 +165,63 @@ public class NewOrder extends DataEntity<NewOrder> {
     private Integer numbers;    // 总数
     private Double totalMoney;  // 总金额
 
-
+    /** 已支付成功次数统计(适用线上多笔付款用来确认当前是哪一笔) */
+    private Integer paySuccessCounter;
+    /** 包邮券ID  保留字段 */
+    private Integer freePostageTicketID;
+    /** 第三方订单编号(绑定第三方订单关系),适用第三方发起订单 */
+    private String thirdPartyOrderNo;
+    /** 订单是否同步发货物流给第三方,0未同步,1已同步 */
+    private String synchronizeFlag;
+
+    /** 消息推送用户ID */
+    private String unionID;
     /**
      * 呵呵商城优惠券
      */
     private Integer receiveCouponId;
     private CmHeheCouponOrderRecord heheCouponRecord;   //优惠券信息
+
+    public Integer getPaySuccessCounter() {
+        return paySuccessCounter;
+    }
+
+    public void setPaySuccessCounter(Integer paySuccessCounter) {
+        this.paySuccessCounter = paySuccessCounter;
+    }
+
+    public Integer getFreePostageTicketID() {
+        return freePostageTicketID;
+    }
+
+    public void setFreePostageTicketID(Integer freePostageTicketID) {
+        this.freePostageTicketID = freePostageTicketID;
+    }
+
+    public String getThirdPartyOrderNo() {
+        return thirdPartyOrderNo;
+    }
+
+    public void setThirdPartyOrderNo(String thirdPartyOrderNo) {
+        this.thirdPartyOrderNo = thirdPartyOrderNo;
+    }
+
+    public String getSynchronizeFlag() {
+        return synchronizeFlag;
+    }
+
+    public void setSynchronizeFlag(String synchronizeFlag) {
+        this.synchronizeFlag = synchronizeFlag;
+    }
+
+    public String getUnionID() {
+        return unionID;
+    }
+
+    public void setUnionID(String unionID) {
+        this.unionID = unionID;
+    }
+
     public Integer getShopOrderID() {
         return shopOrderID;
     }

+ 64 - 0
src/main/java/com/caimei/modules/order/entity/NewShopOrder.java

@@ -147,6 +147,21 @@ public class NewShopOrder extends DataEntity<NewShopOrder> {
     private String shopPostFlag; //免邮标志 运费:-1到付,0包邮,1需要运费,-2仪器到付其它包邮
     private String postageInfo; //运费字符串
 
+    /**  */
+    private Integer returnGoodsStatus;
+
+    /** 二手商品订单标识  0非二手商品订单、 1二手商品订单 */
+    private String secondHandOrderFlag;
+    /** 外部商城付采美佣金 */
+    private BigDecimal payCmAmount;
+    /**  */
+    private String receiptedFlag;
+
+    /**  */
+    private String receiptedType;
+    /** 子订单已支付成功次数统计 */
+    private Integer paySuccessCounter;
+
 
 
     private List<CmOrderPaymentVoucherVo> voucherVo; //支付凭证
@@ -163,6 +178,55 @@ public class NewShopOrder extends DataEntity<NewShopOrder> {
     private String remarkImage9;
     private String remarkImage10;
 
+    public Integer getReturnGoodsStatus() {
+        return returnGoodsStatus;
+    }
+
+    public void setReturnGoodsStatus(Integer returnGoodsStatus) {
+        this.returnGoodsStatus = returnGoodsStatus;
+    }
+
+    public String getSecondHandOrderFlag() {
+        return secondHandOrderFlag;
+    }
+
+    public void setSecondHandOrderFlag(String secondHandOrderFlag) {
+        this.secondHandOrderFlag = secondHandOrderFlag;
+    }
+
+    public BigDecimal getPayCmAmount() {
+        return payCmAmount;
+    }
+
+    public void setPayCmAmount(BigDecimal payCmAmount) {
+        this.payCmAmount = payCmAmount;
+    }
+
+    public String getReceiptedFlag() {
+        return receiptedFlag;
+    }
+
+    public void setReceiptedFlag(String receiptedFlag) {
+        this.receiptedFlag = receiptedFlag;
+    }
+
+    public String getReceiptedType() {
+        return receiptedType;
+    }
+
+    public void setReceiptedType(String receiptedType) {
+        this.receiptedType = receiptedType;
+    }
+
+    public Integer getPaySuccessCounter() {
+        return paySuccessCounter;
+    }
+
+    public void setPaySuccessCounter(Integer paySuccessCounter) {
+        this.paySuccessCounter = paySuccessCounter;
+    }
+
+
     public String getShopPostFlag() {
         return shopPostFlag;
     }

+ 31 - 31
src/main/java/com/caimei/modules/order/service/NewOrderService.java

@@ -1246,7 +1246,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
     }
 
     @Override
-    public NewOrder get(String id) {
+    public NewOrder get(String id) { //采美和颜选商城使用同一逻辑
         NewOrder newOrder = super.get(id);
         CmUser user = cmUserDao.get(newOrder.getUserID().toString());
         if (user != null) {
@@ -1579,36 +1579,38 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
     @Transactional(readOnly = false)
     public void confirmOrder(Integer orderID, Integer shopOrderID) {
         NewOrder order = get(orderID.toString());
-        order.setConfirmFlag("1");//确认订单标识 后台确认 1
-        if (order.getNewShopOrders().stream().filter(newShopOrder -> newShopOrder.getStatus().equals(0)).collect(Collectors.toList()).size()==1) {
+        List<NewShopOrder> newShopOrders=order.getNewShopOrders();
+
+        if (newShopOrders.stream().filter(newShopOrder -> newShopOrder.getStatus().equals(0)).collect(Collectors.toList()).size()==1) {
+            order.setConfirmFlag("1");//确认订单标识 后台确认 1
             order.setStatus("11");//订单状态变成 ==> 待收款待付款 11
         }
-        //过滤子订单
-        List<NewShopOrder> newShopOrders = order.getNewShopOrders().stream().filter(newShopOrder -> newShopOrder.getShopOrderID().equals(shopOrderID)).collect(Collectors.toList());
-        order.setNewShopOrders(newShopOrders);
-
-        order.getNewShopOrders().get(0).setStatus(1);//已确认
-
+        if(null!=shopOrderID){
+            //过滤子订单
+            newShopOrders = newShopOrders.stream().filter(newShopOrder -> newShopOrder.getShopOrderID().equals(shopOrderID)).collect(Collectors.toList());
+            order.setNewShopOrders(newShopOrders);
+        }
+        newShopOrders.get(0).setStatus(1);//已确认
 
-//        //修改订单状态(余额抵扣)
-//        if (order.getPayableAmount() != null) {
-//            if (order.getPayableAmount() == 0 && order.getBalancePayFee() != null && order.getBalancePayFee() > 0) {
-//                order.setStatus(NewOrderStatus.YISHOU_DAIFA.getCode());
-//                order.setReceiptStatus("3");
-//            } else if (order.getPayableAmount() != 0 && order.getBalancePayFee() != null && order.getBalancePayFee() > 0) {
-//                order.setStatus(NewOrderStatus.BUSHOU_DAIFA.getCode());
-//                order.setReceiptStatus("2");
-//            }
-//        }
+        //修改订单状态(余额抵扣)
+        if (order.getPayableAmount() != null) {
+            if (order.getPayableAmount() == 0 && order.getBalancePayFee() != null && order.getBalancePayFee() > 0) {
+                order.setStatus(NewOrderStatus.YISHOU_DAIFA.getCode());
+                order.setReceiptStatus("3");
+            } else if (order.getPayableAmount() != 0 && order.getBalancePayFee() != null && order.getBalancePayFee() > 0) {
+                order.setStatus(NewOrderStatus.BUSHOU_DAIFA.getCode());
+                order.setReceiptStatus("2");
+            }
+        }
 
         //        order.getBalancePayFee()
-        Double balancePayFee = order.getNewShopOrders().get(0).getAccountAmount();
+        Double balancePayFee = newShopOrders.get(0).getAccountAmount();
         //修改子订单状态(余额抵扣)
-        if (order.getNewShopOrders().get(0).getUseBalanceFlag() !=null&&order.getNewShopOrders().get(0).getUseBalanceFlag() == 1) {
-            if ( balancePayFee != null && balancePayFee ==order.getNewShopOrders().get(0).getRealPay()) {
-                order.getNewShopOrders().get(0).setReceiptStatus("3");
-            } else if ( balancePayFee != null && balancePayFee <order.getNewShopOrders().get(0).getRealPay()) {
-                order.getNewShopOrders().get(0).setReceiptStatus("2");
+        if (newShopOrders.get(0).getUseBalanceFlag() !=null&&newShopOrders.get(0).getUseBalanceFlag() == 1) {
+            if ( balancePayFee != null && balancePayFee ==newShopOrders.get(0).getRealPay()) {
+                newShopOrders.get(0).setReceiptStatus("3");
+            } else if ( balancePayFee != null && balancePayFee <newShopOrders.get(0).getRealPay()) {
+                newShopOrders.get(0).setReceiptStatus("2");
           }
         }
         Date date = new Date();
@@ -1616,15 +1618,13 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
         String curDateStr = sdf.format(date);
         order.setConfirmTime(curDateStr);
 
-//        if (order.getBalancePayFee() != null && order.getBalancePayFee() > 0) {
         if (balancePayFee != null && balancePayFee > 0) {
             //已付金额
-            double v = balancePayFee + order.getNewShopOrders().get(0).getReceiptAmount();
-            order.getNewShopOrders().get(0).setReceiptAmount(v);
+            double v = balancePayFee + newShopOrders.get(0).getReceiptAmount();
+            newShopOrders.get(0).setReceiptAmount(v);
             saveDiscernReceipt(balancePayFee, orderID);
             //针对商品productId:6898,做兑换券操作(couponId:15)
-//            if ("3".equals(order.getReceiptStatus())) {
-            if ("3".equals(order.getNewShopOrders().get(0).getReceiptStatus())) {
+            if ("3".equals(newShopOrders.get(0).getReceiptStatus())) {
 //                List<NewOrderProduct> orderProducts = newOrderProductDao.findListByOrderID(orderID);
                 List<NewOrderProduct> orderProducts = newShopOrders.get(0).getNewOrderProducts();
                 for (NewOrderProduct orderProduct : orderProducts) {
@@ -1650,7 +1650,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
             }
         }
         newOrderDao.update(order);
-        newShopOrderDao.update(order.getNewShopOrders().get(0));
+        newShopOrderDao.update(newShopOrders.get(0));
     }
 
     /**

+ 149 - 0
src/main/java/com/caimei/modules/order/service/NewShopOrderService.java

@@ -8,6 +8,7 @@ import com.caimei.modules.order.entity.*;
 import com.caimei.modules.product.dao.CmPromotionDao;
 import com.caimei.modules.product.dao.ProductDao;
 import com.caimei.modules.product.entity.CmPromotion;
+import com.caimei.po.neworder.CmShopOrder;
 import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.service.CrudService;
 import com.thinkgem.jeesite.common.utils.StringUtils;
@@ -169,6 +170,7 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
         //查询这个子订单所有的发货批次记录
         List<LogisticsBatch> lbs = logisticsBatchDao.findBatch(orderID, logisticsBatchID);
         if(null!=shopOrderID){
+            //过滤子订单
             lbs=lbs.stream().filter(s -> s.getShopOrderID().equals(shopOrderID)).collect(Collectors.toList());
         }
 
@@ -684,4 +686,151 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
     public List<Integer> payWay(Integer shoprderID) {
         return newShopOrderDao.payWay(shoprderID);
     }
+    /**
+     * 查询子订单
+     *
+     * @param shopOrderID 子订单主键
+     * @return 子订单
+     */
+
+    public NewShopOrder getCmShopOrderByShopOrderID(String shopOrderID)
+    {
+        return newShopOrderDao.getCmShopOrderByShopOrderID(shopOrderID);
+    }
+
+    /**
+     * 查询子订单Id
+     *
+     * @param cmShopOrder 子订单
+     * @return String
+     */
+
+    public String getById(NewShopOrder cmShopOrder)
+    {
+        return newShopOrderDao.getById(cmShopOrder);
+    }
+
+    /**
+     * 查询子订单Ids
+     *
+     * @param cmShopOrder 子订单
+     * @return List<String>
+     */
+
+    public List<String> getByIds(NewShopOrder cmShopOrder)
+    {
+        return newShopOrderDao.getByIds(cmShopOrder);
+    }
+
+    /**
+     * 查询子订单
+     *
+     * @param cmShopOrder 子订单
+     * @return 子订单
+     */
+    public NewShopOrder getByCmShopOrder(NewShopOrder cmShopOrder)
+    {
+        return newShopOrderDao.getByCmShopOrder(cmShopOrder);
+    }
+
+    /**
+     * 查询子订单列表
+     *
+     * @param cmShopOrder 子订单
+     * @return 子订单
+     */
+    public List<NewShopOrder> getCmShopOrderList(NewShopOrder cmShopOrder)
+    {
+        return newShopOrderDao.getCmShopOrderList(cmShopOrder);
+    }
+    /**
+     * 查询子订单记录总数
+     *
+     * @param cmShopOrder 子订单
+     * @return 子订单
+     */
+    public int getCmShopOrderCount(NewShopOrder cmShopOrder)
+    {
+        return newShopOrderDao.getCmShopOrderCount(cmShopOrder);
+    }
+
+    /**
+     * 新增子订单
+     *
+     * @param cmShopOrder 子订单
+     * @return 结果
+     */
+    public int addCmShopOrder(NewShopOrder cmShopOrder)
+    {
+        cmShopOrder.setCreateDate(new Date());
+        return newShopOrderDao.addCmShopOrder(cmShopOrder);
+    }
+
+    /**
+     * 修改子订单
+     *
+     * @param cmShopOrder 子订单
+     * @return 结果
+     */
+    public int updateCmShopOrder(NewShopOrder cmShopOrder)
+    {
+        cmShopOrder.setUpdateDate(new Date());
+        return newShopOrderDao.updateCmShopOrder(cmShopOrder);
+    }
+
+    /**
+     * 批量删除子订单
+     *
+     * @param shopOrderIDs 需要删除的子订单主键
+     * @return 结果
+     */
+    public int delCmShopOrderByShopOrderIDs(String[] shopOrderIDs)
+    {
+        return newShopOrderDao.updateDelCmShopOrderByShopOrderIDs(shopOrderIDs,1);
+        //return newShopOrderDao.delCmShopOrderByShopOrderIDs(shopOrderIDs);
+    }
+
+    /**
+     * 删除子订单信息
+     *
+     * @param shopOrderID 子订单主键
+     * @return 结果
+     */
+    public int delCmShopOrderByShopOrderID(Integer shopOrderID)
+    {
+        NewShopOrder newShopOrder = new NewShopOrder();
+        newShopOrder.setShopOrderID(shopOrderID);
+        newShopOrder.setDelFlag("1");
+        return newShopOrderDao.updateCmShopOrder(newShopOrder);
+        //return newShopOrderDao.delCmShopOrderByShopOrderID(shopOrderID);
+    }
+
+    /**
+     * 批量新增子订单
+     *
+     * @param cmShopOrderList 子订单列表
+     * @return 结果
+     */
+    public void batchAddCmShopOrder(List<NewShopOrder> cmShopOrderList)
+    {
+        for (NewShopOrder cmShopOrder : cmShopOrderList)
+        {
+            newShopOrderDao.addCmShopOrder(cmShopOrder);
+        }
+    }
+
+    /**
+     * 批量修改子订单
+     *
+     * @param cmShopOrderList 子订单列表
+     * @return 结果
+     */
+    public void batchUpdateCmShopOrder(List<NewShopOrder> cmShopOrderList)
+    {
+        for (NewShopOrder cmShopOrder : cmShopOrderList)
+        {
+            newShopOrderDao.updateCmShopOrder(cmShopOrder);
+        }
+    }
+
 }

+ 2 - 1
src/main/resources/mappings/modules/cmpage/CmPageCentreMapper.xml

@@ -198,11 +198,12 @@
 		FROM
 		  new_page_floor_image a
 		  LEFT JOIN product p ON a.productId = p.productID
-		left join cm_organize_product_info copi on copi.productId = p.productID and copi.productId = p.productID  and copi.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=p.productId)
+		left join cm_organize_product_info copi on  copi.productId = p.productID
 		  LEFT JOIN shop s on p.shopID = s.shopID
 		  left join cm_hehe_product chp on a.productId = chp.productId
 		WHERE
 		  a.centreId = #{centreId}
+		and copi.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=p.productId)
           <if test="type != null and type == '8'">
               and chp.id is not null
           </if>

+ 6 - 1
src/main/resources/mappings/modules/hehe/CmHeheProductMapper.xml

@@ -157,9 +157,12 @@
         SELECT
         a.*,s.name AS "shopName"
         FROM product a
+        left join cm_organize_product_info copi on copi.productId = a.productID
         LEFT JOIN shop s on s.shopID = a.shopID
         <where>
-            a.splitCode is not null and a.splitCode != ''
+            a.splitCode is not null and a.splitCode != '' and  copi.validFlag=2
+            and copi.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=a.productId)
+            and s.shopID in(SELECT shopID FROM shop  WHERE name ='深圳市采美奥泰贸易有限公司')
             <if test="productID != null">
                 AND a.productID = #{productID}
             </if>
@@ -297,6 +300,8 @@
     <select id="findProductElement" resultType="com.caimei.modules.hehe.entity.CmHeheProduct">
         select ifnull(chs.price, 0)           as price,
                ifnull(cs.shopPercent, 0) as shopPercent,
+               ifnull(cs.organizePercent, 0) as organizePercent,
+               ifnull(cs.cmPercent, 0) as cmPercent,
                ifnull(cs.costCheckFlag, 0)    as costType,
                ifnull(cs.costPrice, 0)        as costPrice
             ,cs.organizeId

+ 30 - 20
src/main/resources/mappings/modules/hehe/CmHeheUserMapper.xml

@@ -1,7 +1,7 @@
 <?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.caimei.modules.hehe.dao.CmHeheUserDao">
-    
+
 	<sql id="cmHeheUserColumns">
 		a.id AS "id",
 		a.userId AS "userId",
@@ -12,26 +12,26 @@
 		a.openId AS "openId",
 		a.addTime AS "addTime"
 	</sql>
-	
+
 
 	<delete id="deleteUserActivity">
 		delete from cm_hehe_user_activity where userId = #{userId} and productId = #{productId}
 	</delete>
 
 	<select id="get" resultType="CmHeheUser">
-		SELECT 
+		SELECT
 			<include refid="cmHeheUserColumns"/>
 		FROM cm_hehe_user a
 		WHERE a.id = #{id}
 	</select>
-	
+
 	<select id="findList" resultType="CmHeheUser">
-		SELECT 
+		SELECT
 			<include refid="cmHeheUserColumns"/>
 		FROM cm_hehe_user a
 		<where>
 			<if test="name != null and name != ''">
-				AND a.name LIKE 
+				AND a.name LIKE
 					<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
 					<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
 					<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
@@ -55,14 +55,14 @@
 			</otherwise>
 		</choose>
 	</select>
-	
+
 	<select id="findAllList" resultType="CmHeheUser">
-		SELECT 
+		SELECT
 			<include refid="cmHeheUserColumns"/>
 		FROM cm_hehe_user a
 		<where>
-			
-		</where>		
+
+		</where>
 		<choose>
 			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
 				ORDER BY ${page.orderBy}
@@ -71,7 +71,7 @@
 			</otherwise>
 		</choose>
 	</select>
-	
+
 	<insert id="insert" parameterType="CmHeheUser"  keyProperty="id" useGeneratedKeys="true">
 		INSERT INTO cm_hehe_user(
 			userId,
@@ -91,9 +91,9 @@
 			#{addTime}
 		)
 	</insert>
-	
+
 	<update id="update">
-		UPDATE cm_hehe_user SET 	
+		UPDATE cm_hehe_user SET
 			name = #{name},
 			mobile = #{mobile},
 			userIdentity = #{userIdentity},
@@ -147,24 +147,29 @@
 		a.activityId AS "activityId",
 		a.productId AS "productId",
 		a.sort AS "sort",
-		chp.price AS "price",
+		chs.price AS "price",
 		p.name AS "name",
 		p.mainImage AS "mainImage",
-		p.unit AS "unit",
+		cs.unit AS "unit",
 		s.name AS "shopName"
 		FROM
 		cm_hehe_user_activity a
 		LEFT JOIN cm_hehe_product chp ON chp.productId = a.productID
+		LEFT JOIN cm_hehe_sku chs ON chp.productId = chs.productID
+		LEFT JOIN cm_sku cs ON cs.skuId = chs.skuId
 		LEFT JOIN product p ON a.productId = p.productID
+		left join cm_organize_product_info copi on copi.productId = a.productID
 		LEFT JOIN shop s ON s.shopID = p.shopID
 		WHERE
 		a.userId = #{userId}
+		and copi.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=a.productId)
 		<if test="name != null and name != ''">
 			AND p.name LIKE CONCAT('%',#{name},'%')
 		</if>
 		<if test="shopName != null and shopName != ''">
 			AND s.name LIKE CONCAT('%',#{shopName},'%')
 		</if>
+		group by a.productID
 		ORDER BY
 		- a.sort DESC
 	</select>
@@ -172,22 +177,26 @@
 	<select id="findUserActivityProduct" resultType="integer">
 		SELECT productId FROM cm_hehe_user_activity  WHERE userId = #{userId}
 	</select>
-	
+
 	<select id="findAllActivityProduct" resultType="com.caimei.modules.hehe.entity.CmHeheProduct">
 		SELECT
 		  a.id AS "id",
 		  a.productId AS "productId",
-		  chp.price AS "price",
+		  chs.price AS "price",
 		  p.name AS "name",
 		  p.mainImage AS "mainImage",
 		  s.name AS "shopName"
 		FROM
 		  cm_hehe_activity_product a
 		  LEFT JOIN cm_hehe_product chp ON a.productId = chp.productId
+		LEFT JOIN cm_hehe_sku chs ON chp.productId = chs.productID
+		LEFT JOIN cm_sku cs ON cs.skuId = chs.skuId
 		  LEFT JOIN product p ON a.productId = p.productID
-		  LEFT JOIN shop s ON s.shopID = p.shopID
+		left join cm_organize_product_info copi on copi.productId = a.productID
+		LEFT JOIN shop s ON s.shopID = p.shopID
 		WHERE
 		  a.delFlag = 0
+		and copi.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=a.productId)
 		<if test="ids != null and ids.size() > 0 ">
 			AND a.productId NOT IN
 			<foreach collection="ids" open="(" close=")" item="id" separator=",">
@@ -203,6 +212,7 @@
 		<if test="shopName != null and shopName != ''">
 			AND s.name LIKE CONCAT('%',#{shopName},'%')
 		</if>
+		group by  a.productID
 		ORDER BY productId DESC
 	</select>
 
@@ -221,5 +231,5 @@
 	<update id="updateSortById">
 		UPDATE cm_hehe_user_activity SET sort = #{sort} WHERE id =#{id}
 	</update>
-	
-</mapper>
+
+</mapper>

+ 807 - 0
src/main/resources/mappings/modules/order/OrderMapper.xml

@@ -1491,4 +1491,811 @@
         WHERE shopOrderID = #{shopOrderID}
     </update>
 
+    <resultMap type="com.caimei.modules.order.entity.NewOrder" id="CmOrderResult">
+        <result property="orderID"    column="orderID"    />
+        <result property="orderNo"    column="orderNo"    />
+        <result property="organizeID"    column="organizeID"    />
+        <result property="userID"    column="userID"    />
+        <result property="buyUserID"    column="buyUserID"    />
+        <result property="organizeStoreId"    column="organizeStoreId"    />
+        <result property="shopOrderIDs"    column="shopOrderIDs"    />
+        <result property="orderSubmitType"    column="orderSubmitType"    />
+        <result property="orderType"    column="orderType"    />
+        <result property="hasActProduct"    column="hasActProduct"    />
+        <result property="status"    column="status"    />
+        <result property="receiptStatus"    column="receiptStatus"    />
+        <result property="payStatus"    column="payStatus"    />
+        <result property="sendOutStatus"    column="sendOutStatus"    />
+        <result property="refundType"    column="refundType"    />
+        <result property="paySuccessCounter"    column="paySuccessCounter"    />
+        <result property="payFlag"    column="payFlag"    />
+        <result property="onlinePayFlag"    column="onlinePayFlag"    />
+        <result property="productTotalFee"    column="productTotalFee"    />
+        <result property="orderTotalFee"    column="orderTotalFee"    />
+        <result property="payTotalFee"    column="payTotalFee"    />
+        <result property="payableAmount"    column="payableAmount"    />
+        <result property="balancePayFee"    column="balancePayFee"    />
+        <result property="preferential"    column="preferential"    />
+        <result property="discountFee"    column="discountFee"    />
+        <result property="promotionFullReduction"    column="promotionFullReduction"    />
+        <result property="spID"    column="spID"    />
+        <result property="mainSpID"    column="mainSpID"    />
+        <result property="note"    column="note"    />
+        <result property="clubID"    column="clubID"    />
+        <result property="clubScanTime"    column="clubScanTime"    />
+        <result property="orderSource"    column="orderSource"    />
+        <result property="closeTime"    column="closeTime"    />
+        <result property="confirmTime"    column="confirmTime"    />
+        <result property="payTime"    column="payTime"    />
+        <result property="orderTime"    column="orderTime"    />
+        <result property="productCount"    column="productCount"    />
+        <result property="presentCount"    column="presentCount"    />
+        <result property="promotionalGiftsCount"    column="promotionalGiftsCount"    />
+        <result property="invoiceFlag"    column="invoiceFlag"    />
+        <result property="confirmFlag"    column="confirmFlag"    />
+        <result property="clauseID"    column="clauseID"    />
+        <result property="clauseContent"    column="clauseContent"    />
+        <result property="clauseName"    column="clauseName"    />
+        <result property="updateDate"    column="updateDate"    />
+        <result property="freePostFlag"    column="freePostFlag"    />
+        <result property="freight"    column="freight"    />
+        <result property="userBeans"    column="userBeans"    />
+        <result property="delFlag"    column="delFlag"    />
+        <result property="freePostageTicketID"    column="freePostageTicketID"    />
+        <result property="splitFlag"    column="splitFlag"    />
+        <result property="closeReason"    column="closeReason"    />
+        <result property="postageOrderFlag"    column="postageOrderFlag"    />
+        <result property="thirdPartyOrderNo"    column="thirdPartyOrderNo"    />
+        <result property="synchronizeFlag"    column="synchronizeFlag"    />
+        <result property="secondHandOrderFlag"    column="secondHandOrderFlag"    />
+        <result property="affirmPaymentFlag"    column="affirmPaymentFlag"    />
+        <result property="rebateFlag"    column="rebateFlag"    />
+        <result property="rebateFee"    column="rebateFee"    />
+        <result property="zeroCostFlag"    column="zeroCostFlag"    />
+        <result property="couponAmount"    column="couponAmount"    />
+        <result property="svipFullReduction"    column="svipFullReduction"    />
+        <result property="orderSeen"    column="orderSeen"    />
+        <result property="reductionAmount"    column="reductionAmount"    />
+        <result property="unionID"    column="unionID"    />
+    </resultMap>
+
+    <sql id="selectCmOrderVo">
+        select
+            cm_order.orderID,
+            cm_order.orderNo,
+            cm_order.apiOrganizeOrderId,
+            cm_order.organizeID,
+            cm_order.userID,
+            cm_order.buyUserID,
+            cm_order.organizeStoreId,
+            cm_order.shopOrderIDs,
+            cm_order.orderSubmitType,
+            cm_order.orderType,
+            cm_order.hasActProduct,
+            cm_order.status,
+            cm_order.receiptStatus,
+            cm_order.payStatus,
+            cm_order.sendOutStatus,
+            cm_order.refundType,
+            cm_order.paySuccessCounter,
+            cm_order.payFlag,
+            cm_order.onlinePayFlag,
+            cm_order.productTotalFee,
+            cm_order.orderTotalFee,
+            cm_order.payTotalFee,
+            cm_order.payableAmount,
+            cm_order.balancePayFee,
+            cm_order.preferential,
+            cm_order.discountFee,
+            cm_order.promotionFullReduction,
+            cm_order.spID,
+            cm_order.mainSpID,
+            cm_order.note,
+            cm_order.clubID,
+            cm_order.clubScanTime,
+            cm_order.orderSource,
+            cm_order.closeTime,
+            cm_order.confirmTime,
+            cm_order.payTime,
+            cm_order.orderTime,
+            cm_order.productCount,
+            cm_order.presentCount,
+            cm_order.promotionalGiftsCount,
+            cm_order.invoiceFlag,
+            cm_order.confirmFlag,
+            cm_order.clauseID,
+            cm_order.clauseContent,
+            cm_order.clauseName,
+            cm_order.updateDate,
+            cm_order.freePostFlag,
+            cm_order.freight,
+            cm_order.userBeans,
+            cm_order.delFlag,
+            cm_order.freePostageTicketID,
+            cm_order.splitFlag,
+            cm_order.closeReason,
+            cm_order.postageOrderFlag,
+            cm_order.thirdPartyOrderNo,
+            cm_order.synchronizeFlag,
+            cm_order.secondHandOrderFlag,
+            cm_order.affirmPaymentFlag,
+            cm_order.rebateFlag,
+            cm_order.rebateFee,
+            cm_order.zeroCostFlag,
+            cm_order.couponAmount,
+            cm_order.svipFullReduction,
+            cm_order.orderSeen,
+            cm_order.reductionAmount,
+            cm_order.unionID
+    </sql>
+
+    <select id="getByCmOrder" parameterType="com.caimei.modules.order.entity.NewOrder" resultMap="CmOrderResult">
+        <include refid="selectCmOrderVo"/>
+        from cm_order AS cm_order
+        <where>  cm_order.delFlag = 0
+            <if test="orderID != null  and orderID != ''">
+                and cm_order.orderID
+                <if test="orderID.toUpperCase().indexOf('=')==-1">
+                    = #{orderID}
+                </if>
+                <if test="orderID.toUpperCase().indexOf('=')!=-1">
+                    <if test="orderID.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="orderID.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="orderIDIn" collection="orderID.substring(orderID.toUpperCase().indexOf('=')+1,orderID.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{orderIDIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="orderNo != null  and orderNo != ''"> and cm_order.orderNo = #{orderNo}</if>
+            <if test="apiOrganizeOrderId != null  and apiOrganizeOrderId != ''"> and cm_order.apiOrganizeOrderId = #{apiOrganizeOrderId}</if>
+            <if test="organizeID != null "> and cm_order.organizeID = #{organizeID}</if>
+            <if test="userID != null "> and cm_order.userID = #{userID}</if>
+            <if test="buyUserID != null "> and cm_order.buyUserID = #{buyUserID}</if>
+            <if test="organizeStoreId != null "> and cm_order.organizeStoreId = #{organizeStoreId}</if>
+            <if test="shopOrderIDs != null  and shopOrderIDs != ''"> and cm_order.shopOrderIDs = #{shopOrderIDs}</if>
+            <if test="orderSubmitType != null "> and cm_order.orderSubmitType = #{orderSubmitType}</if>
+            <if test="orderType != null "> and cm_order.orderType = #{orderType}</if>
+            <if test="hasActProduct != null  and hasActProduct != ''"> and cm_order.hasActProduct = #{hasActProduct}</if>
+            <if test="status != null  and status != ''"> and cm_order.status = #{status}</if>
+            <if test="receiptStatus != null  and receiptStatus != ''"> and cm_order.receiptStatus = #{receiptStatus}</if>
+            <if test="payStatus != null  and payStatus != ''"> and cm_order.payStatus = #{payStatus}</if>
+            <if test="sendOutStatus != null  and sendOutStatus != ''"> and cm_order.sendOutStatus = #{sendOutStatus}</if>
+            <if test="refundType != null  and refundType != ''"> and cm_order.refundType = #{refundType}</if>
+            <if test="paySuccessCounter != null "> and cm_order.paySuccessCounter = #{paySuccessCounter}</if>
+            <if test="payFlag != null  and payFlag != ''"> and cm_order.payFlag = #{payFlag}</if>
+            <if test="onlinePayFlag != null  and onlinePayFlag != ''"> and cm_order.onlinePayFlag = #{onlinePayFlag}</if>
+            <if test="productTotalFee != null "> and cm_order.productTotalFee = #{productTotalFee}</if>
+            <if test="orderTotalFee != null "> and cm_order.orderTotalFee = #{orderTotalFee}</if>
+            <if test="payTotalFee != null "> and cm_order.payTotalFee = #{payTotalFee}</if>
+            <if test="payableAmount != null "> and cm_order.payableAmount = #{payableAmount}</if>
+            <if test="balancePayFee != null "> and cm_order.balancePayFee = #{balancePayFee}</if>
+            <if test="preferential != null "> and cm_order.preferential = #{preferential}</if>
+            <if test="discountFee != null "> and cm_order.discountFee = #{discountFee}</if>
+            <if test="promotionFullReduction != null "> and cm_order.promotionFullReduction = #{promotionFullReduction}</if>
+            <if test="spID != null "> and cm_order.spID = #{spID}</if>
+            <if test="mainSpID != null "> and cm_order.mainSpID = #{mainSpID}</if>
+            <if test="note != null  and note != ''"> and cm_order.note = #{note}</if>
+            <if test="clubID != null "> and cm_order.clubID = #{clubID}</if>
+            <if test="clubScanTime != null  and clubScanTime != ''"> and cm_order.clubScanTime = #{clubScanTime}</if>
+            <if test="orderSource != null  and orderSource != ''"> and cm_order.orderSource = #{orderSource}</if>
+            <if test="closeTime != null  and closeTime != ''"> and cm_order.closeTime = #{closeTime}</if>
+            <if test="confirmTime != null  and confirmTime != ''"> and cm_order.confirmTime = #{confirmTime}</if>
+            <if test="payTime != null  and payTime != ''"> and cm_order.payTime = #{payTime}</if>
+            <if test="orderTime != null  and orderTime != ''"> and cm_order.orderTime = #{orderTime}</if>
+            <if test="productCount != null "> and cm_order.productCount = #{productCount}</if>
+            <if test="presentCount != null "> and cm_order.presentCount = #{presentCount}</if>
+            <if test="promotionalGiftsCount != null "> and cm_order.promotionalGiftsCount = #{promotionalGiftsCount}</if>
+            <if test="invoiceFlag != null  and invoiceFlag != ''"> and cm_order.invoiceFlag = #{invoiceFlag}</if>
+            <if test="confirmFlag != null  and confirmFlag != ''"> and cm_order.confirmFlag = #{confirmFlag}</if>
+            <if test="clauseID != null "> and cm_order.clauseID = #{clauseID}</if>
+            <if test="clauseContent != null  and clauseContent != ''"> and cm_order.clauseContent = #{clauseContent}</if>
+            <if test="clauseName != null  and clauseName != ''"> and cm_order.clauseName like concat('%', #{clauseName}, '%')</if>
+            <if test="updateDate != null  and updateDate != ''"> and cm_order.updateDate = #{updateDate}</if>
+            <if test="freePostFlag != null  and freePostFlag != ''"> and cm_order.freePostFlag = #{freePostFlag}</if>
+            <if test="freight != null "> and cm_order.freight = #{freight}</if>
+            <if test="userBeans != null "> and cm_order.userBeans = #{userBeans}</if>
+            <if test="delFlag != null  and delFlag != ''"> and cm_order.delFlag = #{delFlag}</if>
+            <if test="freePostageTicketID != null "> and cm_order.freePostageTicketID = #{freePostageTicketID}</if>
+            <if test="splitFlag != null  and splitFlag != ''"> and cm_order.splitFlag = #{splitFlag}</if>
+            <if test="closeReason != null  and closeReason != ''"> and cm_order.closeReason = #{closeReason}</if>
+            <if test="postageOrderFlag != null  and postageOrderFlag != ''"> and cm_order.postageOrderFlag = #{postageOrderFlag}</if>
+            <if test="thirdPartyOrderNo != null  and thirdPartyOrderNo != ''"> and cm_order.thirdPartyOrderNo = #{thirdPartyOrderNo}</if>
+            <if test="synchronizeFlag != null  and synchronizeFlag != ''"> and cm_order.synchronizeFlag = #{synchronizeFlag}</if>
+            <if test="secondHandOrderFlag != null  and secondHandOrderFlag != ''"> and cm_order.secondHandOrderFlag = #{secondHandOrderFlag}</if>
+            <if test="affirmPaymentFlag != null  and affirmPaymentFlag != ''"> and cm_order.affirmPaymentFlag = #{affirmPaymentFlag}</if>
+            <if test="rebateFlag != null  and rebateFlag != ''"> and cm_order.rebateFlag = #{rebateFlag}</if>
+            <if test="rebateFee != null  and rebateFee != ''"> and cm_order.rebateFee = #{rebateFee}</if>
+            <if test="zeroCostFlag != null "> and cm_order.zeroCostFlag = #{zeroCostFlag}</if>
+            <if test="couponAmount != null "> and cm_order.couponAmount = #{couponAmount}</if>
+            <if test="svipFullReduction != null "> and cm_order.svipFullReduction = #{svipFullReduction}</if>
+            <if test="orderSeen != null  and orderSeen != ''"> and cm_order.orderSeen = #{orderSeen}</if>
+            <if test="reductionAmount != null "> and cm_order.reductionAmount = #{reductionAmount}</if>
+            <if test="unionID != null  and unionID != ''"> and cm_order.unionID = #{unionID}</if>
+        </where>
+        group by cm_order.orderID
+        order by cm_order.createTime desc
+        limit 0,1
+    </select>
+
+    <select id="getCmOrderList" parameterType="com.caimei.modules.order.entity.NewOrder" resultMap="CmOrderResult">
+        <include refid="selectCmOrderVo"/>
+        from cm_order AS cm_order
+        <where>  cm_order.delFlag = 0
+            <if test="orderID != null  and orderID != ''">
+                and cm_order.orderID
+                <if test="orderID.toUpperCase().indexOf('=')==-1">
+                    = #{orderID}
+                </if>
+                <if test="orderID.toUpperCase().indexOf('=')!=-1">
+                    <if test="orderID.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="orderID.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="orderIDIn" collection="orderID.substring(orderID.toUpperCase().indexOf('=')+1,orderID.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{orderIDIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="orderNo != null  and orderNo != ''"> and cm_order.orderNo = #{orderNo}</if>
+            <if test="apiOrganizeOrderId != null  and apiOrganizeOrderId != ''"> and cm_order.apiOrganizeOrderId = #{apiOrganizeOrderId}</if>
+            <if test="organizeID != null "> and cm_order.organizeID = #{organizeID}</if>
+            <if test="userID != null "> and cm_order.userID = #{userID}</if>
+            <if test="buyUserID != null "> and cm_order.buyUserID = #{buyUserID}</if>
+            <if test="organizeStoreId != null "> and cm_order.organizeStoreId = #{organizeStoreId}</if>
+            <if test="shopOrderIDs != null  and shopOrderIDs != ''"> and cm_order.shopOrderIDs = #{shopOrderIDs}</if>
+            <if test="orderSubmitType != null "> and cm_order.orderSubmitType = #{orderSubmitType}</if>
+            <if test="orderType != null "> and cm_order.orderType = #{orderType}</if>
+            <if test="hasActProduct != null  and hasActProduct != ''"> and cm_order.hasActProduct = #{hasActProduct}</if>
+            <if test="status != null  and status != ''"> and cm_order.status = #{status}</if>
+            <if test="receiptStatus != null  and receiptStatus != ''"> and cm_order.receiptStatus = #{receiptStatus}</if>
+            <if test="payStatus != null  and payStatus != ''"> and cm_order.payStatus = #{payStatus}</if>
+            <if test="sendOutStatus != null  and sendOutStatus != ''"> and cm_order.sendOutStatus = #{sendOutStatus}</if>
+            <if test="refundType != null  and refundType != ''"> and cm_order.refundType = #{refundType}</if>
+            <if test="paySuccessCounter != null "> and cm_order.paySuccessCounter = #{paySuccessCounter}</if>
+            <if test="payFlag != null  and payFlag != ''"> and cm_order.payFlag = #{payFlag}</if>
+            <if test="onlinePayFlag != null  and onlinePayFlag != ''"> and cm_order.onlinePayFlag = #{onlinePayFlag}</if>
+            <if test="productTotalFee != null "> and cm_order.productTotalFee = #{productTotalFee}</if>
+            <if test="orderTotalFee != null "> and cm_order.orderTotalFee = #{orderTotalFee}</if>
+            <if test="payTotalFee != null "> and cm_order.payTotalFee = #{payTotalFee}</if>
+            <if test="payableAmount != null "> and cm_order.payableAmount = #{payableAmount}</if>
+            <if test="balancePayFee != null "> and cm_order.balancePayFee = #{balancePayFee}</if>
+            <if test="preferential != null "> and cm_order.preferential = #{preferential}</if>
+            <if test="discountFee != null "> and cm_order.discountFee = #{discountFee}</if>
+            <if test="promotionFullReduction != null "> and cm_order.promotionFullReduction = #{promotionFullReduction}</if>
+            <if test="spID != null "> and cm_order.spID = #{spID}</if>
+            <if test="mainSpID != null "> and cm_order.mainSpID = #{mainSpID}</if>
+            <if test="note != null  and note != ''"> and cm_order.note = #{note}</if>
+            <if test="clubID != null "> and cm_order.clubID = #{clubID}</if>
+            <if test="clubScanTime != null  and clubScanTime != ''"> and cm_order.clubScanTime = #{clubScanTime}</if>
+            <if test="orderSource != null  and orderSource != ''"> and cm_order.orderSource = #{orderSource}</if>
+            <if test="closeTime != null  and closeTime != ''"> and cm_order.closeTime = #{closeTime}</if>
+            <if test="confirmTime != null  and confirmTime != ''"> and cm_order.confirmTime = #{confirmTime}</if>
+            <if test="payTime != null  and payTime != ''"> and cm_order.payTime = #{payTime}</if>
+            <if test="orderTime != null  and orderTime != ''"> and cm_order.orderTime = #{orderTime}</if>
+            <if test="productCount != null "> and cm_order.productCount = #{productCount}</if>
+            <if test="presentCount != null "> and cm_order.presentCount = #{presentCount}</if>
+            <if test="promotionalGiftsCount != null "> and cm_order.promotionalGiftsCount = #{promotionalGiftsCount}</if>
+            <if test="invoiceFlag != null  and invoiceFlag != ''"> and cm_order.invoiceFlag = #{invoiceFlag}</if>
+            <if test="confirmFlag != null  and confirmFlag != ''"> and cm_order.confirmFlag = #{confirmFlag}</if>
+            <if test="clauseID != null "> and cm_order.clauseID = #{clauseID}</if>
+            <if test="clauseContent != null  and clauseContent != ''"> and cm_order.clauseContent = #{clauseContent}</if>
+            <if test="clauseName != null  and clauseName != ''"> and cm_order.clauseName like concat('%', #{clauseName}, '%')</if>
+            <if test="updateDate != null  and updateDate != ''"> and cm_order.updateDate = #{updateDate}</if>
+            <if test="freePostFlag != null  and freePostFlag != ''"> and cm_order.freePostFlag = #{freePostFlag}</if>
+            <if test="freight != null "> and cm_order.freight = #{freight}</if>
+            <if test="userBeans != null "> and cm_order.userBeans = #{userBeans}</if>
+            <if test="delFlag != null  and delFlag != ''"> and cm_order.delFlag = #{delFlag}</if>
+            <if test="freePostageTicketID != null "> and cm_order.freePostageTicketID = #{freePostageTicketID}</if>
+            <if test="splitFlag != null  and splitFlag != ''"> and cm_order.splitFlag = #{splitFlag}</if>
+            <if test="closeReason != null  and closeReason != ''"> and cm_order.closeReason = #{closeReason}</if>
+            <if test="postageOrderFlag != null  and postageOrderFlag != ''"> and cm_order.postageOrderFlag = #{postageOrderFlag}</if>
+            <if test="thirdPartyOrderNo != null  and thirdPartyOrderNo != ''"> and cm_order.thirdPartyOrderNo = #{thirdPartyOrderNo}</if>
+            <if test="synchronizeFlag != null  and synchronizeFlag != ''"> and cm_order.synchronizeFlag = #{synchronizeFlag}</if>
+            <if test="secondHandOrderFlag != null  and secondHandOrderFlag != ''"> and cm_order.secondHandOrderFlag = #{secondHandOrderFlag}</if>
+            <if test="affirmPaymentFlag != null  and affirmPaymentFlag != ''"> and cm_order.affirmPaymentFlag = #{affirmPaymentFlag}</if>
+            <if test="rebateFlag != null  and rebateFlag != ''"> and cm_order.rebateFlag = #{rebateFlag}</if>
+            <if test="rebateFee != null  and rebateFee != ''"> and cm_order.rebateFee = #{rebateFee}</if>
+            <if test="zeroCostFlag != null "> and cm_order.zeroCostFlag = #{zeroCostFlag}</if>
+            <if test="couponAmount != null "> and cm_order.couponAmount = #{couponAmount}</if>
+            <if test="svipFullReduction != null "> and cm_order.svipFullReduction = #{svipFullReduction}</if>
+            <if test="orderSeen != null  and orderSeen != ''"> and cm_order.orderSeen = #{orderSeen}</if>
+            <if test="reductionAmount != null "> and cm_order.reductionAmount = #{reductionAmount}</if>
+            <if test="unionID != null  and unionID != ''"> and cm_order.unionID = #{unionID}</if>
+        </where>
+        group by cm_order.orderID
+        order by cm_order.createTime desc
+    </select>
+    <select id="getCmOrderCount" parameterType="com.caimei.modules.order.entity.NewOrder" resultType="String">
+        select count(1)
+        from cm_order AS cm_order
+        <where>  cm_order.delFlag = 0
+            <if test="orderID != null  and  orderID != ''">
+                and cm_order.orderID
+                <if test="orderID.toUpperCase().indexOf('=')==-1">
+                    = #{orderID}
+                </if>
+                <if test="orderID.toUpperCase().indexOf('=')!=-1">
+                    <if test="orderID.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="orderID.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="orderIDIn" collection="orderID.substring(orderID.toUpperCase().indexOf('=')+1,orderID.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{orderIDIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="orderNo != null  and orderNo != ''"> and cm_order.orderNo = #{orderNo}</if>
+            <if test="apiOrganizeOrderId != null  and apiOrganizeOrderId != ''"> and cm_order.apiOrganizeOrderId = #{apiOrganizeOrderId}</if>
+            <if test="organizeID != null "> and cm_order.organizeID = #{organizeID}</if>
+            <if test="userID != null "> and cm_order.userID = #{userID}</if>
+            <if test="buyUserID != null "> and cm_order.buyUserID = #{buyUserID}</if>
+            <if test="organizeStoreId != null "> and cm_order.organizeStoreId = #{organizeStoreId}</if>
+            <if test="shopOrderIDs != null  and shopOrderIDs != ''"> and cm_order.shopOrderIDs = #{shopOrderIDs}</if>
+            <if test="orderSubmitType != null "> and cm_order.orderSubmitType = #{orderSubmitType}</if>
+            <if test="orderType != null "> and cm_order.orderType = #{orderType}</if>
+            <if test="hasActProduct != null  and hasActProduct != ''"> and cm_order.hasActProduct = #{hasActProduct}</if>
+            <if test="status != null  and status != ''"> and cm_order.status = #{status}</if>
+            <if test="receiptStatus != null  and receiptStatus != ''"> and cm_order.receiptStatus = #{receiptStatus}</if>
+            <if test="payStatus != null  and payStatus != ''"> and cm_order.payStatus = #{payStatus}</if>
+            <if test="sendOutStatus != null  and sendOutStatus != ''"> and cm_order.sendOutStatus = #{sendOutStatus}</if>
+            <if test="refundType != null  and refundType != ''"> and cm_order.refundType = #{refundType}</if>
+            <if test="paySuccessCounter != null "> and cm_order.paySuccessCounter = #{paySuccessCounter}</if>
+            <if test="payFlag != null  and payFlag != ''"> and cm_order.payFlag = #{payFlag}</if>
+            <if test="onlinePayFlag != null  and onlinePayFlag != ''"> and cm_order.onlinePayFlag = #{onlinePayFlag}</if>
+            <if test="productTotalFee != null "> and cm_order.productTotalFee = #{productTotalFee}</if>
+            <if test="orderTotalFee != null "> and cm_order.orderTotalFee = #{orderTotalFee}</if>
+            <if test="payTotalFee != null "> and cm_order.payTotalFee = #{payTotalFee}</if>
+            <if test="payableAmount != null "> and cm_order.payableAmount = #{payableAmount}</if>
+            <if test="balancePayFee != null "> and cm_order.balancePayFee = #{balancePayFee}</if>
+            <if test="preferential != null "> and cm_order.preferential = #{preferential}</if>
+            <if test="discountFee != null "> and cm_order.discountFee = #{discountFee}</if>
+            <if test="promotionFullReduction != null "> and cm_order.promotionFullReduction = #{promotionFullReduction}</if>
+            <if test="spID != null "> and cm_order.spID = #{spID}</if>
+            <if test="mainSpID != null "> and cm_order.mainSpID = #{mainSpID}</if>
+            <if test="note != null  and note != ''"> and cm_order.note = #{note}</if>
+            <if test="clubID != null "> and cm_order.clubID = #{clubID}</if>
+            <if test="clubScanTime != null  and clubScanTime != ''"> and cm_order.clubScanTime = #{clubScanTime}</if>
+            <if test="orderSource != null  and orderSource != ''"> and cm_order.orderSource = #{orderSource}</if>
+            <if test="closeTime != null  and closeTime != ''"> and cm_order.closeTime = #{closeTime}</if>
+            <if test="confirmTime != null  and confirmTime != ''"> and cm_order.confirmTime = #{confirmTime}</if>
+            <if test="payTime != null  and payTime != ''"> and cm_order.payTime = #{payTime}</if>
+            <if test="orderTime != null  and orderTime != ''"> and cm_order.orderTime = #{orderTime}</if>
+            <if test="productCount != null "> and cm_order.productCount = #{productCount}</if>
+            <if test="presentCount != null "> and cm_order.presentCount = #{presentCount}</if>
+            <if test="promotionalGiftsCount != null "> and cm_order.promotionalGiftsCount = #{promotionalGiftsCount}</if>
+            <if test="invoiceFlag != null  and invoiceFlag != ''"> and cm_order.invoiceFlag = #{invoiceFlag}</if>
+            <if test="confirmFlag != null  and confirmFlag != ''"> and cm_order.confirmFlag = #{confirmFlag}</if>
+            <if test="clauseID != null "> and cm_order.clauseID = #{clauseID}</if>
+            <if test="clauseContent != null  and clauseContent != ''"> and cm_order.clauseContent = #{clauseContent}</if>
+            <if test="clauseName != null  and clauseName != ''"> and cm_order.clauseName like concat('%', #{clauseName}, '%')</if>
+            <if test="updateDate != null  and updateDate != ''"> and cm_order.updateDate = #{updateDate}</if>
+            <if test="freePostFlag != null  and freePostFlag != ''"> and cm_order.freePostFlag = #{freePostFlag}</if>
+            <if test="freight != null "> and cm_order.freight = #{freight}</if>
+            <if test="userBeans != null "> and cm_order.userBeans = #{userBeans}</if>
+            <if test="delFlag != null  and delFlag != ''"> and cm_order.delFlag = #{delFlag}</if>
+            <if test="freePostageTicketID != null "> and cm_order.freePostageTicketID = #{freePostageTicketID}</if>
+            <if test="splitFlag != null  and splitFlag != ''"> and cm_order.splitFlag = #{splitFlag}</if>
+            <if test="closeReason != null  and closeReason != ''"> and cm_order.closeReason = #{closeReason}</if>
+            <if test="postageOrderFlag != null  and postageOrderFlag != ''"> and cm_order.postageOrderFlag = #{postageOrderFlag}</if>
+            <if test="thirdPartyOrderNo != null  and thirdPartyOrderNo != ''"> and cm_order.thirdPartyOrderNo = #{thirdPartyOrderNo}</if>
+            <if test="synchronizeFlag != null  and synchronizeFlag != ''"> and cm_order.synchronizeFlag = #{synchronizeFlag}</if>
+            <if test="secondHandOrderFlag != null  and secondHandOrderFlag != ''"> and cm_order.secondHandOrderFlag = #{secondHandOrderFlag}</if>
+            <if test="affirmPaymentFlag != null  and affirmPaymentFlag != ''"> and cm_order.affirmPaymentFlag = #{affirmPaymentFlag}</if>
+            <if test="rebateFlag != null  and rebateFlag != ''"> and cm_order.rebateFlag = #{rebateFlag}</if>
+            <if test="rebateFee != null  and rebateFee != ''"> and cm_order.rebateFee = #{rebateFee}</if>
+            <if test="zeroCostFlag != null "> and cm_order.zeroCostFlag = #{zeroCostFlag}</if>
+            <if test="couponAmount != null "> and cm_order.couponAmount = #{couponAmount}</if>
+            <if test="svipFullReduction != null "> and cm_order.svipFullReduction = #{svipFullReduction}</if>
+            <if test="orderSeen != null  and orderSeen != ''"> and cm_order.orderSeen = #{orderSeen}</if>
+            <if test="reductionAmount != null "> and cm_order.reductionAmount = #{reductionAmount}</if>
+            <if test="unionID != null  and unionID != ''"> and cm_order.unionID = #{unionID}</if>
+        </where>
+        group by cm_order.orderID
+    </select>
+
+    <select id="getCmOrderByOrderID" parameterType="String" resultMap="CmOrderResult">
+        <include refid="selectCmOrderVo"/>
+        from cm_order AS cm_order
+        where  cm_order.delFlag = 0 and cm_order.orderID = #{orderID}
+    </select>
+
+    <select id="getByIds" parameterType="com.caimei.modules.order.entity.NewOrder" resultType="String">
+        select orderID
+        from cm_order AS cm_order
+        <where>  cm_order.delFlag = 0
+            <if test="orderID != null  and orderID != ''">
+                and cm_order.orderID
+                <if test="orderID.toUpperCase().indexOf('=')==-1">
+                    = #{orderID}
+                </if>
+                <if test="orderID.toUpperCase().indexOf('=')!=-1">
+                    <if test="orderID.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="orderID.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="orderIDIn" collection="orderID.substring(orderID.toUpperCase().indexOf('=')+1,orderID.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{orderIDIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="orderNo != null  and orderNo != ''"> and cm_order.orderNo = #{orderNo}</if>
+            <if test="apiOrganizeOrderId != null  and apiOrganizeOrderId != ''"> and cm_order.apiOrganizeOrderId = #{apiOrganizeOrderId}</if>
+            <if test="organizeID != null "> and cm_order.organizeID = #{organizeID}</if>
+            <if test="userID != null "> and cm_order.userID = #{userID}</if>
+            <if test="buyUserID != null "> and cm_order.buyUserID = #{buyUserID}</if>
+            <if test="organizeStoreId != null "> and cm_order.organizeStoreId = #{organizeStoreId}</if>
+            <if test="shopOrderIDs != null  and shopOrderIDs != ''"> and cm_order.shopOrderIDs = #{shopOrderIDs}</if>
+            <if test="orderSubmitType != null "> and cm_order.orderSubmitType = #{orderSubmitType}</if>
+            <if test="orderType != null "> and cm_order.orderType = #{orderType}</if>
+            <if test="hasActProduct != null  and hasActProduct != ''"> and cm_order.hasActProduct = #{hasActProduct}</if>
+            <if test="status != null  and status != ''"> and cm_order.status = #{status}</if>
+            <if test="receiptStatus != null  and receiptStatus != ''"> and cm_order.receiptStatus = #{receiptStatus}</if>
+            <if test="payStatus != null  and payStatus != ''"> and cm_order.payStatus = #{payStatus}</if>
+            <if test="sendOutStatus != null  and sendOutStatus != ''"> and cm_order.sendOutStatus = #{sendOutStatus}</if>
+            <if test="refundType != null  and refundType != ''"> and cm_order.refundType = #{refundType}</if>
+            <if test="paySuccessCounter != null "> and cm_order.paySuccessCounter = #{paySuccessCounter}</if>
+            <if test="payFlag != null  and payFlag != ''"> and cm_order.payFlag = #{payFlag}</if>
+            <if test="onlinePayFlag != null  and onlinePayFlag != ''"> and cm_order.onlinePayFlag = #{onlinePayFlag}</if>
+            <if test="productTotalFee != null "> and cm_order.productTotalFee = #{productTotalFee}</if>
+            <if test="orderTotalFee != null "> and cm_order.orderTotalFee = #{orderTotalFee}</if>
+            <if test="payTotalFee != null "> and cm_order.payTotalFee = #{payTotalFee}</if>
+            <if test="payableAmount != null "> and cm_order.payableAmount = #{payableAmount}</if>
+            <if test="balancePayFee != null "> and cm_order.balancePayFee = #{balancePayFee}</if>
+            <if test="preferential != null "> and cm_order.preferential = #{preferential}</if>
+            <if test="discountFee != null "> and cm_order.discountFee = #{discountFee}</if>
+            <if test="promotionFullReduction != null "> and cm_order.promotionFullReduction = #{promotionFullReduction}</if>
+            <if test="spID != null "> and cm_order.spID = #{spID}</if>
+            <if test="mainSpID != null "> and cm_order.mainSpID = #{mainSpID}</if>
+            <if test="note != null  and note != ''"> and cm_order.note = #{note}</if>
+            <if test="clubID != null "> and cm_order.clubID = #{clubID}</if>
+            <if test="clubScanTime != null  and clubScanTime != ''"> and cm_order.clubScanTime = #{clubScanTime}</if>
+            <if test="orderSource != null  and orderSource != ''"> and cm_order.orderSource = #{orderSource}</if>
+            <if test="closeTime != null  and closeTime != ''"> and cm_order.closeTime = #{closeTime}</if>
+            <if test="confirmTime != null  and confirmTime != ''"> and cm_order.confirmTime = #{confirmTime}</if>
+            <if test="payTime != null  and payTime != ''"> and cm_order.payTime = #{payTime}</if>
+            <if test="orderTime != null  and orderTime != ''"> and cm_order.orderTime = #{orderTime}</if>
+            <if test="productCount != null "> and cm_order.productCount = #{productCount}</if>
+            <if test="presentCount != null "> and cm_order.presentCount = #{presentCount}</if>
+            <if test="promotionalGiftsCount != null "> and cm_order.promotionalGiftsCount = #{promotionalGiftsCount}</if>
+            <if test="invoiceFlag != null  and invoiceFlag != ''"> and cm_order.invoiceFlag = #{invoiceFlag}</if>
+            <if test="confirmFlag != null  and confirmFlag != ''"> and cm_order.confirmFlag = #{confirmFlag}</if>
+            <if test="clauseID != null "> and cm_order.clauseID = #{clauseID}</if>
+            <if test="clauseContent != null  and clauseContent != ''"> and cm_order.clauseContent = #{clauseContent}</if>
+            <if test="clauseName != null  and clauseName != ''"> and cm_order.clauseName like concat('%', #{clauseName}, '%')</if>
+            <if test="updateDate != null  and updateDate != ''"> and cm_order.updateDate = #{updateDate}</if>
+            <if test="freePostFlag != null  and freePostFlag != ''"> and cm_order.freePostFlag = #{freePostFlag}</if>
+            <if test="freight != null "> and cm_order.freight = #{freight}</if>
+            <if test="userBeans != null "> and cm_order.userBeans = #{userBeans}</if>
+            <if test="delFlag != null  and delFlag != ''"> and cm_order.delFlag = #{delFlag}</if>
+            <if test="freePostageTicketID != null "> and cm_order.freePostageTicketID = #{freePostageTicketID}</if>
+            <if test="splitFlag != null  and splitFlag != ''"> and cm_order.splitFlag = #{splitFlag}</if>
+            <if test="closeReason != null  and closeReason != ''"> and cm_order.closeReason = #{closeReason}</if>
+            <if test="postageOrderFlag != null  and postageOrderFlag != ''"> and cm_order.postageOrderFlag = #{postageOrderFlag}</if>
+            <if test="thirdPartyOrderNo != null  and thirdPartyOrderNo != ''"> and cm_order.thirdPartyOrderNo = #{thirdPartyOrderNo}</if>
+            <if test="synchronizeFlag != null  and synchronizeFlag != ''"> and cm_order.synchronizeFlag = #{synchronizeFlag}</if>
+            <if test="secondHandOrderFlag != null  and secondHandOrderFlag != ''"> and cm_order.secondHandOrderFlag = #{secondHandOrderFlag}</if>
+            <if test="affirmPaymentFlag != null  and affirmPaymentFlag != ''"> and cm_order.affirmPaymentFlag = #{affirmPaymentFlag}</if>
+            <if test="rebateFlag != null  and rebateFlag != ''"> and cm_order.rebateFlag = #{rebateFlag}</if>
+            <if test="rebateFee != null  and rebateFee != ''"> and cm_order.rebateFee = #{rebateFee}</if>
+            <if test="zeroCostFlag != null "> and cm_order.zeroCostFlag = #{zeroCostFlag}</if>
+            <if test="couponAmount != null "> and cm_order.couponAmount = #{couponAmount}</if>
+            <if test="svipFullReduction != null "> and cm_order.svipFullReduction = #{svipFullReduction}</if>
+            <if test="orderSeen != null  and orderSeen != ''"> and cm_order.orderSeen = #{orderSeen}</if>
+            <if test="reductionAmount != null "> and cm_order.reductionAmount = #{reductionAmount}</if>
+            <if test="unionID != null  and unionID != ''"> and cm_order.unionID = #{unionID}</if>
+        </where>
+        group by cm_order.orderID
+    </select>
+    <select id="getById" parameterType="com.caimei.modules.order.entity.NewOrder" resultType="String">
+        select orderID
+        from cm_order AS cm_order
+        <where>  cm_order.delFlag = 0
+            <if test="orderID != null  and orderID != ''">
+                and cm_order.orderID
+                <if test="orderID.toUpperCase().indexOf('=')==-1">
+                    = #{orderID}
+                </if>
+                <if test="orderID.toUpperCase().indexOf('=')!=-1">
+                    <if test="orderID.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="orderID.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="orderIDIn" collection="orderID.substring(orderID.toUpperCase().indexOf('=')+1,orderID.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{orderIDIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="orderNo != null  and orderNo != ''"> and cm_order.orderNo = #{orderNo}</if>
+            <if test="apiOrganizeOrderId != null  and apiOrganizeOrderId != ''"> and cm_order.apiOrganizeOrderId = #{apiOrganizeOrderId}</if>
+            <if test="organizeID != null "> and cm_order.organizeID = #{organizeID}</if>
+            <if test="userID != null "> and cm_order.userID = #{userID}</if>
+            <if test="buyUserID != null "> and cm_order.buyUserID = #{buyUserID}</if>
+            <if test="organizeStoreId != null "> and cm_order.organizeStoreId = #{organizeStoreId}</if>
+            <if test="shopOrderIDs != null  and shopOrderIDs != ''"> and cm_order.shopOrderIDs = #{shopOrderIDs}</if>
+            <if test="orderSubmitType != null "> and cm_order.orderSubmitType = #{orderSubmitType}</if>
+            <if test="orderType != null "> and cm_order.orderType = #{orderType}</if>
+            <if test="hasActProduct != null  and hasActProduct != ''"> and cm_order.hasActProduct = #{hasActProduct}</if>
+            <if test="status != null  and status != ''"> and cm_order.status = #{status}</if>
+            <if test="receiptStatus != null  and receiptStatus != ''"> and cm_order.receiptStatus = #{receiptStatus}</if>
+            <if test="payStatus != null  and payStatus != ''"> and cm_order.payStatus = #{payStatus}</if>
+            <if test="sendOutStatus != null  and sendOutStatus != ''"> and cm_order.sendOutStatus = #{sendOutStatus}</if>
+            <if test="refundType != null  and refundType != ''"> and cm_order.refundType = #{refundType}</if>
+            <if test="paySuccessCounter != null "> and cm_order.paySuccessCounter = #{paySuccessCounter}</if>
+            <if test="payFlag != null  and payFlag != ''"> and cm_order.payFlag = #{payFlag}</if>
+            <if test="onlinePayFlag != null  and onlinePayFlag != ''"> and cm_order.onlinePayFlag = #{onlinePayFlag}</if>
+            <if test="productTotalFee != null "> and cm_order.productTotalFee = #{productTotalFee}</if>
+            <if test="orderTotalFee != null "> and cm_order.orderTotalFee = #{orderTotalFee}</if>
+            <if test="payTotalFee != null "> and cm_order.payTotalFee = #{payTotalFee}</if>
+            <if test="payableAmount != null "> and cm_order.payableAmount = #{payableAmount}</if>
+            <if test="balancePayFee != null "> and cm_order.balancePayFee = #{balancePayFee}</if>
+            <if test="preferential != null "> and cm_order.preferential = #{preferential}</if>
+            <if test="discountFee != null "> and cm_order.discountFee = #{discountFee}</if>
+            <if test="promotionFullReduction != null "> and cm_order.promotionFullReduction = #{promotionFullReduction}</if>
+            <if test="spID != null "> and cm_order.spID = #{spID}</if>
+            <if test="mainSpID != null "> and cm_order.mainSpID = #{mainSpID}</if>
+            <if test="note != null  and note != ''"> and cm_order.note = #{note}</if>
+            <if test="clubID != null "> and cm_order.clubID = #{clubID}</if>
+            <if test="clubScanTime != null  and clubScanTime != ''"> and cm_order.clubScanTime = #{clubScanTime}</if>
+            <if test="orderSource != null  and orderSource != ''"> and cm_order.orderSource = #{orderSource}</if>
+            <if test="closeTime != null  and closeTime != ''"> and cm_order.closeTime = #{closeTime}</if>
+            <if test="confirmTime != null  and confirmTime != ''"> and cm_order.confirmTime = #{confirmTime}</if>
+            <if test="payTime != null  and payTime != ''"> and cm_order.payTime = #{payTime}</if>
+            <if test="orderTime != null  and orderTime != ''"> and cm_order.orderTime = #{orderTime}</if>
+            <if test="productCount != null "> and cm_order.productCount = #{productCount}</if>
+            <if test="presentCount != null "> and cm_order.presentCount = #{presentCount}</if>
+            <if test="promotionalGiftsCount != null "> and cm_order.promotionalGiftsCount = #{promotionalGiftsCount}</if>
+            <if test="invoiceFlag != null  and invoiceFlag != ''"> and cm_order.invoiceFlag = #{invoiceFlag}</if>
+            <if test="confirmFlag != null  and confirmFlag != ''"> and cm_order.confirmFlag = #{confirmFlag}</if>
+            <if test="clauseID != null "> and cm_order.clauseID = #{clauseID}</if>
+            <if test="clauseContent != null  and clauseContent != ''"> and cm_order.clauseContent = #{clauseContent}</if>
+            <if test="clauseName != null  and clauseName != ''"> and cm_order.clauseName like concat('%', #{clauseName}, '%')</if>
+            <if test="updateDate != null  and updateDate != ''"> and cm_order.updateDate = #{updateDate}</if>
+            <if test="freePostFlag != null  and freePostFlag != ''"> and cm_order.freePostFlag = #{freePostFlag}</if>
+            <if test="freight != null "> and cm_order.freight = #{freight}</if>
+            <if test="userBeans != null "> and cm_order.userBeans = #{userBeans}</if>
+            <if test="delFlag != null  and delFlag != ''"> and cm_order.delFlag = #{delFlag}</if>
+            <if test="freePostageTicketID != null "> and cm_order.freePostageTicketID = #{freePostageTicketID}</if>
+            <if test="splitFlag != null  and splitFlag != ''"> and cm_order.splitFlag = #{splitFlag}</if>
+            <if test="closeReason != null  and closeReason != ''"> and cm_order.closeReason = #{closeReason}</if>
+            <if test="postageOrderFlag != null  and postageOrderFlag != ''"> and cm_order.postageOrderFlag = #{postageOrderFlag}</if>
+            <if test="thirdPartyOrderNo != null  and thirdPartyOrderNo != ''"> and cm_order.thirdPartyOrderNo = #{thirdPartyOrderNo}</if>
+            <if test="synchronizeFlag != null  and synchronizeFlag != ''"> and cm_order.synchronizeFlag = #{synchronizeFlag}</if>
+            <if test="secondHandOrderFlag != null  and secondHandOrderFlag != ''"> and cm_order.secondHandOrderFlag = #{secondHandOrderFlag}</if>
+            <if test="affirmPaymentFlag != null  and affirmPaymentFlag != ''"> and cm_order.affirmPaymentFlag = #{affirmPaymentFlag}</if>
+            <if test="rebateFlag != null  and rebateFlag != ''"> and cm_order.rebateFlag = #{rebateFlag}</if>
+            <if test="rebateFee != null  and rebateFee != ''"> and cm_order.rebateFee = #{rebateFee}</if>
+            <if test="zeroCostFlag != null "> and cm_order.zeroCostFlag = #{zeroCostFlag}</if>
+            <if test="couponAmount != null "> and cm_order.couponAmount = #{couponAmount}</if>
+            <if test="svipFullReduction != null "> and cm_order.svipFullReduction = #{svipFullReduction}</if>
+            <if test="orderSeen != null  and orderSeen != ''"> and cm_order.orderSeen = #{orderSeen}</if>
+            <if test="reductionAmount != null "> and cm_order.reductionAmount = #{reductionAmount}</if>
+            <if test="unionID != null  and unionID != ''"> and cm_order.unionID = #{unionID}</if>
+        </where>
+        group by cm_order.orderID
+        limit 0,1
+    </select>
+
+    <insert id="addCmOrder" parameterType="com.caimei.modules.order.entity.NewOrder" useGeneratedKeys="true" keyProperty="orderID">
+        insert into cm_order
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="orderID != null and orderID != ''">orderID,</if>
+            <if test="orderNo != null and orderNo != ''">orderNo,</if>
+            <if test="apiOrganizeOrderId != null and apiOrganizeOrderId != ''">apiOrganizeOrderId,</if>
+            <if test="organizeID != null">organizeID,</if>
+            <if test="userID != null">userID,</if>
+            <if test="buyUserID != null">buyUserID,</if>
+            <if test="organizeStoreId != null">organizeStoreId,</if>
+            <if test="shopOrderIDs != null and shopOrderIDs != ''">shopOrderIDs,</if>
+            <if test="orderSubmitType != null">orderSubmitType,</if>
+            <if test="orderType != null">orderType,</if>
+            <if test="hasActProduct != null and hasActProduct != ''">hasActProduct,</if>
+            <if test="status != null and status != ''">status,</if>
+            <if test="receiptStatus != null and receiptStatus != ''">receiptStatus,</if>
+            <if test="payStatus != null and payStatus != ''">payStatus,</if>
+            <if test="sendOutStatus != null and sendOutStatus != ''">sendOutStatus,</if>
+            <if test="refundType != null and refundType != ''">refundType,</if>
+            <if test="paySuccessCounter != null">paySuccessCounter,</if>
+            <if test="payFlag != null and payFlag != ''">payFlag,</if>
+            <if test="onlinePayFlag != null and onlinePayFlag != ''">onlinePayFlag,</if>
+            <if test="productTotalFee != null">productTotalFee,</if>
+            <if test="orderTotalFee != null">orderTotalFee,</if>
+            <if test="payTotalFee != null">payTotalFee,</if>
+            <if test="payableAmount != null">payableAmount,</if>
+            <if test="balancePayFee != null">balancePayFee,</if>
+            <if test="preferential != null">preferential,</if>
+            <if test="discountFee != null">discountFee,</if>
+            <if test="promotionFullReduction != null">promotionFullReduction,</if>
+            <if test="spID != null">spID,</if>
+            <if test="mainSpID != null">mainSpID,</if>
+            <if test="note != null and note != ''">note,</if>
+            <if test="clubID != null">clubID,</if>
+            <if test="clubScanTime != null and clubScanTime != ''">clubScanTime,</if>
+            <if test="orderSource != null and orderSource != ''">orderSource,</if>
+            <if test="closeTime != null and closeTime != ''">closeTime,</if>
+            <if test="confirmTime != null and confirmTime != ''">confirmTime,</if>
+            <if test="payTime != null and payTime != ''">payTime,</if>
+            <if test="orderTime != null and orderTime != ''">orderTime,</if>
+            <if test="productCount != null">productCount,</if>
+            <if test="presentCount != null">presentCount,</if>
+            <if test="promotionalGiftsCount != null">promotionalGiftsCount,</if>
+            <if test="invoiceFlag != null and invoiceFlag != ''">invoiceFlag,</if>
+            <if test="confirmFlag != null and confirmFlag != ''">confirmFlag,</if>
+            <if test="clauseID != null">clauseID,</if>
+            <if test="clauseContent != null and clauseContent != ''">clauseContent,</if>
+            <if test="clauseName != null and clauseName != ''">clauseName,</if>
+            <if test="updateDate != null and updateDate != ''">updateDate,</if>
+            <if test="freePostFlag != null and freePostFlag != ''">freePostFlag,</if>
+            <if test="freight != null">freight,</if>
+            <if test="userBeans != null">userBeans,</if>
+            <if test="delFlag != null and delFlag != ''">delFlag,</if>
+            <if test="freePostageTicketID != null">freePostageTicketID,</if>
+            <if test="splitFlag != null and splitFlag != ''">splitFlag,</if>
+            <if test="closeReason != null and closeReason != ''">closeReason,</if>
+            <if test="postageOrderFlag != null and postageOrderFlag != ''">postageOrderFlag,</if>
+            <if test="thirdPartyOrderNo != null and thirdPartyOrderNo != ''">thirdPartyOrderNo,</if>
+            <if test="synchronizeFlag != null and synchronizeFlag != ''">synchronizeFlag,</if>
+            <if test="secondHandOrderFlag != null and secondHandOrderFlag != ''">secondHandOrderFlag,</if>
+            <if test="affirmPaymentFlag != null and affirmPaymentFlag != ''">affirmPaymentFlag,</if>
+            <if test="rebateFlag != null and rebateFlag != ''">rebateFlag,</if>
+            <if test="rebateFee != null and rebateFee != ''">rebateFee,</if>
+            <if test="zeroCostFlag != null">zeroCostFlag,</if>
+            <if test="couponAmount != null">couponAmount,</if>
+            <if test="svipFullReduction != null">svipFullReduction,</if>
+            <if test="orderSeen != null and orderSeen != ''">orderSeen,</if>
+            <if test="reductionAmount != null">reductionAmount,</if>
+            <if test="unionID != null and unionID != ''">unionID,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="orderID != null and orderID != ''">#{orderID},</if>
+            <if test="orderNo != null and orderNo != ''">#{orderNo},</if>
+            <if test="apiOrganizeOrderId != null and apiOrganizeOrderId != ''">#{apiOrganizeOrderId},</if>
+            <if test="organizeID != null">#{organizeID},</if>
+            <if test="userID != null">#{userID},</if>
+            <if test="buyUserID != null">#{buyUserID},</if>
+            <if test="organizeStoreId != null">#{organizeStoreId},</if>
+            <if test="shopOrderIDs != null and shopOrderIDs != ''">#{shopOrderIDs},</if>
+            <if test="orderSubmitType != null">#{orderSubmitType},</if>
+            <if test="orderType != null">#{orderType},</if>
+            <if test="hasActProduct != null and hasActProduct != ''">#{hasActProduct},</if>
+            <if test="status != null and status != ''">#{status},</if>
+            <if test="receiptStatus != null and receiptStatus != ''">#{receiptStatus},</if>
+            <if test="payStatus != null and payStatus != ''">#{payStatus},</if>
+            <if test="sendOutStatus != null and sendOutStatus != ''">#{sendOutStatus},</if>
+            <if test="refundType != null and refundType != ''">#{refundType},</if>
+            <if test="paySuccessCounter != null">#{paySuccessCounter},</if>
+            <if test="payFlag != null and payFlag != ''">#{payFlag},</if>
+            <if test="onlinePayFlag != null and onlinePayFlag != ''">#{onlinePayFlag},</if>
+            <if test="productTotalFee != null">#{productTotalFee},</if>
+            <if test="orderTotalFee != null">#{orderTotalFee},</if>
+            <if test="payTotalFee != null">#{payTotalFee},</if>
+            <if test="payableAmount != null">#{payableAmount},</if>
+            <if test="balancePayFee != null">#{balancePayFee},</if>
+            <if test="preferential != null">#{preferential},</if>
+            <if test="discountFee != null">#{discountFee},</if>
+            <if test="promotionFullReduction != null">#{promotionFullReduction},</if>
+            <if test="spID != null">#{spID},</if>
+            <if test="mainSpID != null">#{mainSpID},</if>
+            <if test="note != null and note != ''">#{note},</if>
+            <if test="clubID != null">#{clubID},</if>
+            <if test="clubScanTime != null and clubScanTime != ''">#{clubScanTime},</if>
+            <if test="orderSource != null and orderSource != ''">#{orderSource},</if>
+            <if test="closeTime != null and closeTime != ''">#{closeTime},</if>
+            <if test="confirmTime != null and confirmTime != ''">#{confirmTime},</if>
+            <if test="payTime != null and payTime != ''">#{payTime},</if>
+            <if test="orderTime != null and orderTime != ''">#{orderTime},</if>
+            <if test="productCount != null">#{productCount},</if>
+            <if test="presentCount != null">#{presentCount},</if>
+            <if test="promotionalGiftsCount != null">#{promotionalGiftsCount},</if>
+            <if test="invoiceFlag != null and invoiceFlag != ''">#{invoiceFlag},</if>
+            <if test="confirmFlag != null and confirmFlag != ''">#{confirmFlag},</if>
+            <if test="clauseID != null">#{clauseID},</if>
+            <if test="clauseContent != null and clauseContent != ''">#{clauseContent},</if>
+            <if test="clauseName != null and clauseName != ''">#{clauseName},</if>
+            <if test="updateDate != null and updateDate != ''">#{updateDate},</if>
+            <if test="freePostFlag != null and freePostFlag != ''">#{freePostFlag},</if>
+            <if test="freight != null">#{freight},</if>
+            <if test="userBeans != null">#{userBeans},</if>
+            <if test="delFlag != null and delFlag != ''">#{delFlag},</if>
+            <if test="freePostageTicketID != null">#{freePostageTicketID},</if>
+            <if test="splitFlag != null and splitFlag != ''">#{splitFlag},</if>
+            <if test="closeReason != null and closeReason != ''">#{closeReason},</if>
+            <if test="postageOrderFlag != null and postageOrderFlag != ''">#{postageOrderFlag},</if>
+            <if test="thirdPartyOrderNo != null and thirdPartyOrderNo != ''">#{thirdPartyOrderNo},</if>
+            <if test="synchronizeFlag != null and synchronizeFlag != ''">#{synchronizeFlag},</if>
+            <if test="secondHandOrderFlag != null and secondHandOrderFlag != ''">#{secondHandOrderFlag},</if>
+            <if test="affirmPaymentFlag != null and affirmPaymentFlag != ''">#{affirmPaymentFlag},</if>
+            <if test="rebateFlag != null and rebateFlag != ''">#{rebateFlag},</if>
+            <if test="rebateFee != null and rebateFee != ''">#{rebateFee},</if>
+            <if test="zeroCostFlag != null">#{zeroCostFlag},</if>
+            <if test="couponAmount != null">#{couponAmount},</if>
+            <if test="svipFullReduction != null">#{svipFullReduction},</if>
+            <if test="orderSeen != null and orderSeen != ''">#{orderSeen},</if>
+            <if test="reductionAmount != null">#{reductionAmount},</if>
+            <if test="unionID != null and unionID != ''">#{unionID},</if>
+        </trim>
+    </insert>
+
+    <update id="updateCmOrder" parameterType="com.caimei.modules.order.entity.NewOrder">
+        update cm_order
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="orderNo != null and orderNo != ''">orderNo = #{orderNo},</if>
+            <if test="apiOrganizeOrderId != null and apiOrganizeOrderId != ''">apiOrganizeOrderId = #{apiOrganizeOrderId},</if>
+            <if test="organizeID != null">organizeID = #{organizeID},</if>
+            <if test="userID != null">userID = #{userID},</if>
+            <if test="buyUserID != null">buyUserID = #{buyUserID},</if>
+            <if test="organizeStoreId != null">organizeStoreId = #{organizeStoreId},</if>
+            <if test="shopOrderIDs != null and shopOrderIDs != ''">shopOrderIDs = #{shopOrderIDs},</if>
+            <if test="orderSubmitType != null">orderSubmitType = #{orderSubmitType},</if>
+            <if test="orderType != null">orderType = #{orderType},</if>
+            <if test="hasActProduct != null and hasActProduct != ''">hasActProduct = #{hasActProduct},</if>
+            <if test="status != null and status != ''">status = #{status},</if>
+            <if test="receiptStatus != null and receiptStatus != ''">receiptStatus = #{receiptStatus},</if>
+            <if test="payStatus != null and payStatus != ''">payStatus = #{payStatus},</if>
+            <if test="sendOutStatus != null and sendOutStatus != ''">sendOutStatus = #{sendOutStatus},</if>
+            <if test="refundType != null and refundType != ''">refundType = #{refundType},</if>
+            <if test="paySuccessCounter != null">paySuccessCounter = #{paySuccessCounter},</if>
+            <if test="payFlag != null and payFlag != ''">payFlag = #{payFlag},</if>
+            <if test="onlinePayFlag != null and onlinePayFlag != ''">onlinePayFlag = #{onlinePayFlag},</if>
+            <if test="productTotalFee != null">productTotalFee = #{productTotalFee},</if>
+            <if test="orderTotalFee != null">orderTotalFee = #{orderTotalFee},</if>
+            <if test="payTotalFee != null">payTotalFee = #{payTotalFee},</if>
+            <if test="payableAmount != null">payableAmount = #{payableAmount},</if>
+            <if test="balancePayFee != null">balancePayFee = #{balancePayFee},</if>
+            <if test="preferential != null">preferential = #{preferential},</if>
+            <if test="discountFee != null">discountFee = #{discountFee},</if>
+            <if test="promotionFullReduction != null">promotionFullReduction = #{promotionFullReduction},</if>
+            <if test="spID != null">spID = #{spID},</if>
+            <if test="mainSpID != null">mainSpID = #{mainSpID},</if>
+            <if test="note != null and note != ''">note = #{note},</if>
+            <if test="clubID != null">clubID = #{clubID},</if>
+            <if test="clubScanTime != null and clubScanTime != ''">clubScanTime = #{clubScanTime},</if>
+            <if test="orderSource != null and orderSource != ''">orderSource = #{orderSource},</if>
+            <if test="closeTime != null and closeTime != ''">closeTime = #{closeTime},</if>
+            <if test="confirmTime != null and confirmTime != ''">confirmTime = #{confirmTime},</if>
+            <if test="payTime != null and payTime != ''">payTime = #{payTime},</if>
+            <if test="orderTime != null and orderTime != ''">orderTime = #{orderTime},</if>
+            <if test="productCount != null">productCount = #{productCount},</if>
+            <if test="presentCount != null">presentCount = #{presentCount},</if>
+            <if test="promotionalGiftsCount != null">promotionalGiftsCount = #{promotionalGiftsCount},</if>
+            <if test="invoiceFlag != null and invoiceFlag != ''">invoiceFlag = #{invoiceFlag},</if>
+            <if test="confirmFlag != null and confirmFlag != ''">confirmFlag = #{confirmFlag},</if>
+            <if test="clauseID != null">clauseID = #{clauseID},</if>
+            <if test="clauseContent != null and clauseContent != ''">clauseContent = #{clauseContent},</if>
+            <if test="clauseName != null and clauseName != ''">clauseName = #{clauseName},</if>
+            <if test="updateDate != null and updateDate != ''">updateDate = #{updateDate},</if>
+            <if test="freePostFlag != null and freePostFlag != ''">freePostFlag = #{freePostFlag},</if>
+            <if test="freight != null">freight = #{freight},</if>
+            <if test="userBeans != null">userBeans = #{userBeans},</if>
+            <if test="delFlag != null and delFlag != ''">delFlag = #{delFlag},</if>
+            <if test="freePostageTicketID != null">freePostageTicketID = #{freePostageTicketID},</if>
+            <if test="splitFlag != null and splitFlag != ''">splitFlag = #{splitFlag},</if>
+            <if test="closeReason != null and closeReason != ''">closeReason = #{closeReason},</if>
+            <if test="postageOrderFlag != null and postageOrderFlag != ''">postageOrderFlag = #{postageOrderFlag},</if>
+            <if test="thirdPartyOrderNo != null and thirdPartyOrderNo != ''">thirdPartyOrderNo = #{thirdPartyOrderNo},</if>
+            <if test="synchronizeFlag != null and synchronizeFlag != ''">synchronizeFlag = #{synchronizeFlag},</if>
+            <if test="secondHandOrderFlag != null and secondHandOrderFlag != ''">secondHandOrderFlag = #{secondHandOrderFlag},</if>
+            <if test="affirmPaymentFlag != null and affirmPaymentFlag != ''">affirmPaymentFlag = #{affirmPaymentFlag},</if>
+            <if test="rebateFlag != null and rebateFlag != ''">rebateFlag = #{rebateFlag},</if>
+            <if test="rebateFee != null and rebateFee != ''">rebateFee = #{rebateFee},</if>
+            <if test="zeroCostFlag != null">zeroCostFlag = #{zeroCostFlag},</if>
+            <if test="couponAmount != null">couponAmount = #{couponAmount},</if>
+            <if test="svipFullReduction != null">svipFullReduction = #{svipFullReduction},</if>
+            <if test="orderSeen != null and orderSeen != ''">orderSeen = #{orderSeen},</if>
+            <if test="reductionAmount != null">reductionAmount = #{reductionAmount},</if>
+            <if test="unionID != null and unionID != ''">unionID = #{unionID},</if>
+        </trim>
+        where orderID = #{orderID}
+    </update>
+
+    <update id="updateDelCmOrderByOrderIDs" parameterType="String">
+        update cm_order set delFlag=#{delFlag} where orderID in
+        <foreach item="orderID" collection="orderIDs" open="(" separator="," close=")">
+            #{orderID}
+        </foreach>
+    </update>
+
+    <delete id="delCmOrderByOrderID" parameterType="String">
+        delete
+        from cm_order where orderID = #{orderID}
+    </delete>
+
+    <delete id="delCmOrderByOrderIDs" parameterType="String">
+        delete from cm_order where orderID in
+        <foreach item="orderID" collection="orderIDs" open="(" separator="," close=")">
+            #{orderID}
+        </foreach>
+    </delete>
+
 </mapper>

+ 1018 - 0
src/main/resources/mappings/modules/order/ShopOrderMapper.xml

@@ -1277,4 +1277,1022 @@
         WHERE a.shopOrderId = #{onlineShopOrderId}
         ORDER BY a.shopOrderNo DESC
     </select>
+
+    <resultMap type="com.caimei.modules.order.entity.NewShopOrder" id="CmShopOrderResult">
+        <result property="shopOrderID"    column="shopOrderID"    />
+        <result property="shopOrderNo"    column="shopOrderNo"    />
+        <result property="orderNo"    column="orderNo"    />
+        <result property="orderID"    column="orderID"    />
+        <result property="organizeID"    column="organizeID"    />
+        <result property="isColdChina"    column="isColdChina"    />
+        <result property="userID"    column="userID"    />
+        <result property="shopID"    column="shopID"    />
+        <result property="orderPromotionsId"    column="orderPromotionsId"  />
+        <result property="orderType"    column="orderType"    />
+        <result property="orderSubmitType"    column="orderSubmitType"    />
+        <result property="presentNum"    column="presentNum"    />
+        <result property="itemCount"    column="itemCount"    />
+        <result property="outStoreNum"    column="outStoreNum"    />
+        <result property="outStoreTimes"    column="outStoreTimes"    />
+        <result property="townID"    column="townID"    />
+        <result property="note"    column="note"    />
+        <result property="eachDiscount"    column="eachDiscount"    />
+        <result property="realPay"    column="realPay"    />
+        <result property="receiptAmount"    column="receiptAmount"    />
+        <result property="accountAmount"    column="accountAmount"    />
+        <result property="productAmount"    column="productAmount"    />
+        <result property="totalAmount"    column="totalAmount"    />
+        <result property="needPayAmount"    column="needPayAmount"    />
+        <result property="discountAmount"    column="discountAmount"    />
+        <result property="preferential"    column="preferential"    />
+        <result property="promotionFullReduction"    column="promotionFullReduction"    />
+        <result property="payFlag"    column="payFlag"    />
+        <result property="orderTime"    column="orderTime"    />
+        <result property="payTime"    column="payTime"    />
+        <result property="finishTime"    column="finishTime"    />
+        <result property="autoOverTimeMills"    column="autoOverTimeMills"    />
+        <result property="settleStatus"    column="settleStatus"    />
+        <result property="payStatus"    column="payStatus"    />
+        <result property="receiptStatus"    column="receiptStatus"    />
+        <result property="sendOutStatus"    column="sendOutStatus"    />
+        <result property="refundStatus"    column="refundStatus"    />
+        <result property="returnGoodsStatus"    column="returnGoodsStatus"    />
+        <result property="receiveGoodsTime"    column="receiveGoodsTime"    />
+        <result property="autoReceiveTimeMills"    column="autoReceiveTimeMills"    />
+        <result property="totalAddedValueTax"    column="totalAddedValueTax"    />
+        <result property="canRefundAmount"    column="canRefundAmount"    />
+        <result property="refundAmount"    column="refundAmount"    />
+        <result property="clubID"    column="clubID"    />
+        <result property="spID"    column="spID"    />
+        <result property="mainSpID"    column="mainSpID"    />
+        <result property="orderBeanAmount"    column="orderBeanAmount"    />
+        <result property="useBeanAmount"    column="useBeanAmount"    />
+        <result property="useBeanFlag"    column="useBeanFlag"    />
+        <result property="canRefundFlag"    column="canRefundFlag"    />
+        <result property="useBalanceFlag"    column="useBalanceFlag"    />
+        <result property="canRefundBeans"    column="canRefundBeans"    />
+        <result property="freePostageFee"    column="freePostageFee"    />
+        <result property="freePostageTicketID"    column="freePostageTicketID"    />
+        <result property="brokerage"    column="brokerage"    />
+        <result property="delFlag"    column="delFlag"    />
+        <result property="refundsAmount"    column="refundsAmount"    />
+        <result property="orderStatusFlag"    column="orderStatusFlag"    />
+        <result property="buyStatus"    column="buyStatus"    />
+        <result property="deliveryTimeMills"    column="deliveryTimeMills"    />
+        <result property="orderDeliveryID"    column="orderDeliveryID"    />
+        <result property="splitFlag"    column="splitFlag"    />
+        <result property="paying"    column="paying"    />
+        <result property="shopProductAmount"    column="shopProductAmount"    />
+        <result property="shopPostFee"    column="shopPostFee"    />
+        <result property="secondHandOrderFlag"    column="secondHandOrderFlag"    />
+        <result property="shopPostFlag"    column="shopPostFlag"    />
+        <result property="shopTaxFee"    column="shopTaxFee"    />
+        <result property="payCmAmount"    column="payCmAmount"    />
+        <result property="shouldPayShopAmount"    column="shouldPayShopAmount"    />
+        <result property="payedShopAmount"    column="payedShopAmount"    />
+        <result property="shopOtherFee"    column="shopOtherFee"    />
+        <result property="receiptedFlag"    column="receiptedFlag"    />
+        <result property="receiptedType"    column="receiptedType"    />
+        <result property="costType"    column="costType"    />
+        <result property="proportional"    column="proportional"    />
+        <result property="modifyShouldPayNote"    column="modifyShouldPayNote"    />
+        <result property="modifyShouldPayUserID"    column="modifyShouldPayUserID"    />
+        <result property="modifyShouldPayDate"    column="modifyShouldPayDate"    />
+        <result property="zeroCostFlag"    column="zeroCostFlag"    />
+        <result property="differenceType"    column="differenceType"    />
+        <result property="differencePrice"    column="differencePrice"    />
+        <result property="svipShopReduction"    column="svipShopReduction"    />
+        <result property="splitCode"    column="splitCode"    />
+        <result property="paySuccessCounter"    column="paySuccessCounter"    />
+        <result property="onlinePayWays"    column="onlinePayWays"    />
+        <result property="status"    column="shopStatus"    />
+    </resultMap>
+
+    <sql id="selectCmShopOrderVo">
+        select
+            cm_shop_order.shopOrderID,
+            cm_shop_order.shopOrderNo,
+            cm_shop_order.orderNo,
+            cm_shop_order.orderID,
+            cm_shop_order.organizeID,
+            cm_shop_order.isColdChina,
+            cm_shop_order.userID,
+            cm_shop_order.shopID,
+            cm_shop_order.orderPromotionsId,
+            cm_shop_order.orderType,
+            cm_shop_order.orderSubmitType,
+            cm_shop_order.presentNum,
+            cm_shop_order.itemCount,
+            cm_shop_order.outStoreNum,
+            cm_shop_order.outStoreTimes,
+            cm_shop_order.townID,
+            cm_shop_order.note,
+            cm_shop_order.eachDiscount,
+            cm_shop_order.realPay,
+            cm_shop_order.receiptAmount,
+            cm_shop_order.accountAmount,
+            cm_shop_order.productAmount,
+            cm_shop_order.totalAmount,
+            cm_shop_order.needPayAmount,
+            cm_shop_order.discountAmount,
+            cm_shop_order.preferential,
+            cm_shop_order.promotionFullReduction,
+            cm_shop_order.payFlag,
+            cm_shop_order.orderTime,
+            cm_shop_order.payTime,
+            cm_shop_order.finishTime,
+            cm_shop_order.autoOverTimeMills,
+            cm_shop_order.settleStatus,
+            cm_shop_order.payStatus,
+            cm_shop_order.receiptStatus,
+            cm_shop_order.sendOutStatus,
+            cm_shop_order.refundStatus,
+            cm_shop_order.returnGoodsStatus,
+            cm_shop_order.receiveGoodsTime,
+            cm_shop_order.autoReceiveTimeMills,
+            cm_shop_order.totalAddedValueTax,
+            cm_shop_order.canRefundAmount,
+            cm_shop_order.refundAmount,
+            cm_shop_order.clubID,
+            cm_shop_order.spID,
+            cm_shop_order.mainSpID,
+            cm_shop_order.orderBeanAmount,
+            cm_shop_order.useBeanAmount,
+            cm_shop_order.useBeanFlag,
+            cm_shop_order.canRefundFlag,
+            cm_shop_order.useBalanceFlag,
+            cm_shop_order.canRefundBeans,
+            cm_shop_order.freePostageFee,
+            cm_shop_order.freePostageTicketID,
+            cm_shop_order.brokerage,
+            cm_shop_order.delFlag,
+            cm_shop_order.refundsAmount,
+            cm_shop_order.orderStatusFlag,
+            cm_shop_order.buyStatus,
+            cm_shop_order.deliveryTimeMills,
+            cm_shop_order.orderDeliveryID,
+            cm_shop_order.splitFlag,
+            cm_shop_order.paying,
+            cm_shop_order.shopProductAmount,
+            cm_shop_order.shopPostFee,
+            cm_shop_order.secondHandOrderFlag,
+            cm_shop_order.shopPostFlag,
+            cm_shop_order.shopTaxFee,
+            cm_shop_order.payCmAmount,
+            cm_shop_order.shouldPayShopAmount,
+            cm_shop_order.payedShopAmount,
+            cm_shop_order.shopOtherFee,
+            cm_shop_order.receiptedFlag,
+            cm_shop_order.receiptedType,
+            cm_shop_order.costType,
+            cm_shop_order.proportional,
+            cm_shop_order.modifyShouldPayNote,
+            cm_shop_order.modifyShouldPayUserID,
+            cm_shop_order.modifyShouldPayDate,
+            cm_shop_order.zeroCostFlag,
+            cm_shop_order.differenceType,
+            cm_shop_order.differencePrice,
+            cm_shop_order.svipShopReduction,
+            cm_shop_order.splitCode,
+            cm_shop_order.paySuccessCounter,
+            cm_shop_order.onlinePayWays,
+            cm_shop_order.shopStatus
+    </sql>
+
+    <select id="getByCmShopOrder" parameterType="com.caimei.modules.order.entity.NewShopOrder" resultMap="CmShopOrderResult">
+        <include refid="selectCmShopOrderVo"/>
+        from cm_shop_order AS cm_shop_order
+        <where>  cm_shop_order.delFlag = 0
+            <if test="shopOrderID != null  and shopOrderID != ''">
+                and cm_shop_order.shopOrderID
+                <if test="shopOrderID.toUpperCase().indexOf('=')==-1">
+                    = #{shopOrderID}
+                </if>
+                <if test="shopOrderID.toUpperCase().indexOf('=')!=-1">
+                    <if test="shopOrderID.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="shopOrderID.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="shopOrderIDIn" collection="shopOrderID.substring(shopOrderID.toUpperCase().indexOf('=')+1,shopOrderID.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{shopOrderIDIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="shopOrderNo != null  and shopOrderNo != ''"> and cm_shop_order.shopOrderNo = #{shopOrderNo}</if>
+            <if test="orderNo != null  and orderNo != ''"> and cm_shop_order.orderNo = #{orderNo}</if>
+            <if test="orderID != null "> and cm_shop_order.orderID = #{orderID}</if>
+            <if test="organizeID != null "> and cm_shop_order.organizeID = #{organizeID}</if>
+            <if test="isColdChina != null "> and cm_shop_order.isColdChina = #{isColdChina}</if>
+            <if test="userID != null "> and cm_shop_order.userID = #{userID}</if>
+            <if test="shopID != null "> and cm_shop_order.shopID = #{shopID}</if>
+            <if test="orderPromotionsId != null "> and cm_shop_order.orderPromotionsId = #{orderPromotionsId}</if>
+            <if test="orderType != null "> and cm_shop_order.orderType = #{orderType}</if>
+            <if test="orderSubmitType != null "> and cm_shop_order.orderSubmitType = #{orderSubmitType}</if>
+            <if test="presentNum != null "> and cm_shop_order.presentNum = #{presentNum}</if>
+            <if test="itemCount != null "> and cm_shop_order.itemCount = #{itemCount}</if>
+            <if test="outStoreNum != null "> and cm_shop_order.outStoreNum = #{outStoreNum}</if>
+            <if test="outStoreTimes != null "> and cm_shop_order.outStoreTimes = #{outStoreTimes}</if>
+            <if test="townID != null "> and cm_shop_order.townID = #{townID}</if>
+            <if test="note != null  and note != ''"> and cm_shop_order.note = #{note}</if>
+            <if test="eachDiscount != null "> and cm_shop_order.eachDiscount = #{eachDiscount}</if>
+            <if test="realPay != null "> and cm_shop_order.realPay = #{realPay}</if>
+            <if test="receiptAmount != null "> and cm_shop_order.receiptAmount = #{receiptAmount}</if>
+            <if test="accountAmount != null "> and cm_shop_order.accountAmount = #{accountAmount}</if>
+            <if test="productAmount != null "> and cm_shop_order.productAmount = #{productAmount}</if>
+            <if test="totalAmount != null "> and cm_shop_order.totalAmount = #{totalAmount}</if>
+            <if test="needPayAmount != null "> and cm_shop_order.needPayAmount = #{needPayAmount}</if>
+            <if test="discountAmount != null "> and cm_shop_order.discountAmount = #{discountAmount}</if>
+            <if test="preferential != null "> and cm_shop_order.preferential = #{preferential}</if>
+            <if test="promotionFullReduction != null "> and cm_shop_order.promotionFullReduction = #{promotionFullReduction}</if>
+            <if test="payFlag != null  and payFlag != ''"> and cm_shop_order.payFlag = #{payFlag}</if>
+            <if test="orderTime != null  and orderTime != ''"> and cm_shop_order.orderTime = #{orderTime}</if>
+            <if test="payTime != null  and payTime != ''"> and cm_shop_order.payTime = #{payTime}</if>
+            <if test="finishTime != null  and finishTime != ''"> and cm_shop_order.finishTime = #{finishTime}</if>
+            <if test="autoOverTimeMills != null "> and cm_shop_order.autoOverTimeMills = #{autoOverTimeMills}</if>
+            <if test="settleStatus != null  and settleStatus != ''"> and cm_shop_order.settleStatus = #{settleStatus}</if>
+            <if test="payStatus != null  and payStatus != ''"> and cm_shop_order.payStatus = #{payStatus}</if>
+            <if test="receiptStatus != null  and receiptStatus != ''"> and cm_shop_order.receiptStatus = #{receiptStatus}</if>
+            <if test="sendOutStatus != null  and sendOutStatus != ''"> and cm_shop_order.sendOutStatus = #{sendOutStatus}</if>
+            <if test="refundStatus != null "> and cm_shop_order.refundStatus = #{refundStatus}</if>
+            <if test="returnGoodsStatus != null "> and cm_shop_order.returnGoodsStatus = #{returnGoodsStatus}</if>
+            <if test="receiveGoodsTime != null  and receiveGoodsTime != ''"> and cm_shop_order.receiveGoodsTime = #{receiveGoodsTime}</if>
+            <if test="autoReceiveTimeMills != null "> and cm_shop_order.autoReceiveTimeMills = #{autoReceiveTimeMills}</if>
+            <if test="totalAddedValueTax != null "> and cm_shop_order.totalAddedValueTax = #{totalAddedValueTax}</if>
+            <if test="canRefundAmount != null "> and cm_shop_order.canRefundAmount = #{canRefundAmount}</if>
+            <if test="refundAmount != null "> and cm_shop_order.refundAmount = #{refundAmount}</if>
+            <if test="clubID != null "> and cm_shop_order.clubID = #{clubID}</if>
+            <if test="spID != null "> and cm_shop_order.spID = #{spID}</if>
+            <if test="mainSpID != null "> and cm_shop_order.mainSpID = #{mainSpID}</if>
+            <if test="orderBeanAmount != null "> and cm_shop_order.orderBeanAmount = #{orderBeanAmount}</if>
+            <if test="useBeanAmount != null "> and cm_shop_order.useBeanAmount = #{useBeanAmount}</if>
+            <if test="useBeanFlag != null "> and cm_shop_order.useBeanFlag = #{useBeanFlag}</if>
+            <if test="canRefundFlag != null "> and cm_shop_order.canRefundFlag = #{canRefundFlag}</if>
+            <if test="useBalanceFlag != null "> and cm_shop_order.useBalanceFlag = #{useBalanceFlag}</if>
+            <if test="canRefundBeans != null "> and cm_shop_order.canRefundBeans = #{canRefundBeans}</if>
+            <if test="freePostageFee != null "> and cm_shop_order.freePostageFee = #{freePostageFee}</if>
+            <if test="freePostageTicketID != null "> and cm_shop_order.freePostageTicketID = #{freePostageTicketID}</if>
+            <if test="brokerage != null "> and cm_shop_order.brokerage = #{brokerage}</if>
+            <if test="delFlag != null  and delFlag != ''"> and cm_shop_order.delFlag = #{delFlag}</if>
+            <if test="refundsAmount != null "> and cm_shop_order.refundsAmount = #{refundsAmount}</if>
+            <if test="orderStatusFlag != null  and orderStatusFlag != ''"> and cm_shop_order.orderStatusFlag = #{orderStatusFlag}</if>
+            <if test="buyStatus != null  and buyStatus != ''"> and cm_shop_order.buyStatus = #{buyStatus}</if>
+            <if test="deliveryTimeMills != null  and deliveryTimeMills != ''"> and cm_shop_order.deliveryTimeMills = #{deliveryTimeMills}</if>
+            <if test="orderDeliveryID != null "> and cm_shop_order.orderDeliveryID = #{orderDeliveryID}</if>
+            <if test="splitFlag != null  and splitFlag != ''"> and cm_shop_order.splitFlag = #{splitFlag}</if>
+            <if test="paying != null  and paying != ''"> and cm_shop_order.paying = #{paying}</if>
+            <if test="shopProductAmount != null "> and cm_shop_order.shopProductAmount = #{shopProductAmount}</if>
+            <if test="shopPostFee != null "> and cm_shop_order.shopPostFee = #{shopPostFee}</if>
+            <if test="secondHandOrderFlag != null  and secondHandOrderFlag != ''"> and cm_shop_order.secondHandOrderFlag = #{secondHandOrderFlag}</if>
+            <if test="shopPostFlag != null  and shopPostFlag != ''"> and cm_shop_order.shopPostFlag = #{shopPostFlag}</if>
+            <if test="shopTaxFee != null "> and cm_shop_order.shopTaxFee = #{shopTaxFee}</if>
+            <if test="payCmAmount != null "> and cm_shop_order.payCmAmount = #{payCmAmount}</if>
+            <if test="shouldPayShopAmount != null "> and cm_shop_order.shouldPayShopAmount = #{shouldPayShopAmount}</if>
+            <if test="payedShopAmount != null "> and cm_shop_order.payedShopAmount = #{payedShopAmount}</if>
+            <if test="shopOtherFee != null "> and cm_shop_order.shopOtherFee = #{shopOtherFee}</if>
+            <if test="receiptedFlag != null  and receiptedFlag != ''"> and cm_shop_order.receiptedFlag = #{receiptedFlag}</if>
+            <if test="receiptedType != null  and receiptedType != ''"> and cm_shop_order.receiptedType = #{receiptedType}</if>
+            <if test="costType != null  and costType != ''"> and cm_shop_order.costType = #{costType}</if>
+            <if test="proportional != null "> and cm_shop_order.proportional = #{proportional}</if>
+            <if test="modifyShouldPayNote != null  and modifyShouldPayNote != ''"> and cm_shop_order.modifyShouldPayNote = #{modifyShouldPayNote}</if>
+            <if test="modifyShouldPayUserID != null "> and cm_shop_order.modifyShouldPayUserID = #{modifyShouldPayUserID}</if>
+            <if test="modifyShouldPayDate != null "> and cm_shop_order.modifyShouldPayDate = #{modifyShouldPayDate}</if>
+            <if test="zeroCostFlag != null "> and cm_shop_order.zeroCostFlag = #{zeroCostFlag}</if>
+            <if test="differenceType != null  and differenceType != ''"> and cm_shop_order.differenceType = #{differenceType}</if>
+            <if test="differencePrice != null "> and cm_shop_order.differencePrice = #{differencePrice}</if>
+            <if test="svipShopReduction != null "> and cm_shop_order.svipShopReduction = #{svipShopReduction}</if>
+            <if test="splitCode != null  and splitCode != ''"> and cm_shop_order.splitCode = #{splitCode}</if>
+            <if test="paySuccessCounter != null "> and cm_shop_order.paySuccessCounter = #{paySuccessCounter}</if>
+            <if test="onlinePayWays != null  and onlinePayWays != ''"> and cm_shop_order.onlinePayWays = #{onlinePayWays}</if>
+            <if test="shopStatus != null  and shopStatus != ''"> and cm_shop_order.shopStatus = #{shopStatus}</if>
+        </where>
+        group by cm_shop_order.shopOrderID
+        order by cm_shop_order.createTime desc
+        limit 0,1
+    </select>
+
+    <select id="getCmShopOrderList" parameterType="com.caimei.modules.order.entity.NewShopOrder" resultMap="CmShopOrderResult">
+        <include refid="selectCmShopOrderVo"/>
+        from cm_shop_order AS cm_shop_order
+        <where>  cm_shop_order.delFlag = 0
+            <if test="shopOrderID != null  and shopOrderID != ''">
+                and cm_shop_order.shopOrderID
+                <if test="shopOrderID.toUpperCase().indexOf('=')==-1">
+                    = #{shopOrderID}
+                </if>
+                <if test="shopOrderID.toUpperCase().indexOf('=')!=-1">
+                    <if test="shopOrderID.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="shopOrderID.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="shopOrderIDIn" collection="shopOrderID.substring(shopOrderID.toUpperCase().indexOf('=')+1,shopOrderID.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{shopOrderIDIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="shopOrderNo != null  and shopOrderNo != ''"> and cm_shop_order.shopOrderNo = #{shopOrderNo}</if>
+            <if test="orderNo != null  and orderNo != ''"> and cm_shop_order.orderNo = #{orderNo}</if>
+            <if test="orderID != null "> and cm_shop_order.orderID = #{orderID}</if>
+            <if test="organizeID != null "> and cm_shop_order.organizeID = #{organizeID}</if>
+            <if test="isColdChina != null "> and cm_shop_order.isColdChina = #{isColdChina}</if>
+            <if test="userID != null "> and cm_shop_order.userID = #{userID}</if>
+            <if test="shopID != null "> and cm_shop_order.shopID = #{shopID}</if>
+            <if test="orderPromotionsId != null "> and cm_shop_order.orderPromotionsId = #{orderPromotionsId}</if>
+            <if test="orderType != null "> and cm_shop_order.orderType = #{orderType}</if>
+            <if test="orderSubmitType != null "> and cm_shop_order.orderSubmitType = #{orderSubmitType}</if>
+            <if test="presentNum != null "> and cm_shop_order.presentNum = #{presentNum}</if>
+            <if test="itemCount != null "> and cm_shop_order.itemCount = #{itemCount}</if>
+            <if test="outStoreNum != null "> and cm_shop_order.outStoreNum = #{outStoreNum}</if>
+            <if test="outStoreTimes != null "> and cm_shop_order.outStoreTimes = #{outStoreTimes}</if>
+            <if test="townID != null "> and cm_shop_order.townID = #{townID}</if>
+            <if test="note != null  and note != ''"> and cm_shop_order.note = #{note}</if>
+            <if test="eachDiscount != null "> and cm_shop_order.eachDiscount = #{eachDiscount}</if>
+            <if test="realPay != null "> and cm_shop_order.realPay = #{realPay}</if>
+            <if test="receiptAmount != null "> and cm_shop_order.receiptAmount = #{receiptAmount}</if>
+            <if test="accountAmount != null "> and cm_shop_order.accountAmount = #{accountAmount}</if>
+            <if test="productAmount != null "> and cm_shop_order.productAmount = #{productAmount}</if>
+            <if test="totalAmount != null "> and cm_shop_order.totalAmount = #{totalAmount}</if>
+            <if test="needPayAmount != null "> and cm_shop_order.needPayAmount = #{needPayAmount}</if>
+            <if test="discountAmount != null "> and cm_shop_order.discountAmount = #{discountAmount}</if>
+            <if test="preferential != null "> and cm_shop_order.preferential = #{preferential}</if>
+            <if test="promotionFullReduction != null "> and cm_shop_order.promotionFullReduction = #{promotionFullReduction}</if>
+            <if test="payFlag != null  and payFlag != ''"> and cm_shop_order.payFlag = #{payFlag}</if>
+            <if test="orderTime != null  and orderTime != ''"> and cm_shop_order.orderTime = #{orderTime}</if>
+            <if test="payTime != null  and payTime != ''"> and cm_shop_order.payTime = #{payTime}</if>
+            <if test="finishTime != null  and finishTime != ''"> and cm_shop_order.finishTime = #{finishTime}</if>
+            <if test="autoOverTimeMills != null "> and cm_shop_order.autoOverTimeMills = #{autoOverTimeMills}</if>
+            <if test="settleStatus != null  and settleStatus != ''"> and cm_shop_order.settleStatus = #{settleStatus}</if>
+            <if test="payStatus != null  and payStatus != ''"> and cm_shop_order.payStatus = #{payStatus}</if>
+            <if test="receiptStatus != null  and receiptStatus != ''"> and cm_shop_order.receiptStatus = #{receiptStatus}</if>
+            <if test="sendOutStatus != null  and sendOutStatus != ''"> and cm_shop_order.sendOutStatus = #{sendOutStatus}</if>
+            <if test="refundStatus != null "> and cm_shop_order.refundStatus = #{refundStatus}</if>
+            <if test="returnGoodsStatus != null "> and cm_shop_order.returnGoodsStatus = #{returnGoodsStatus}</if>
+            <if test="receiveGoodsTime != null  and receiveGoodsTime != ''"> and cm_shop_order.receiveGoodsTime = #{receiveGoodsTime}</if>
+            <if test="autoReceiveTimeMills != null "> and cm_shop_order.autoReceiveTimeMills = #{autoReceiveTimeMills}</if>
+            <if test="totalAddedValueTax != null "> and cm_shop_order.totalAddedValueTax = #{totalAddedValueTax}</if>
+            <if test="canRefundAmount != null "> and cm_shop_order.canRefundAmount = #{canRefundAmount}</if>
+            <if test="refundAmount != null "> and cm_shop_order.refundAmount = #{refundAmount}</if>
+            <if test="clubID != null "> and cm_shop_order.clubID = #{clubID}</if>
+            <if test="spID != null "> and cm_shop_order.spID = #{spID}</if>
+            <if test="mainSpID != null "> and cm_shop_order.mainSpID = #{mainSpID}</if>
+            <if test="orderBeanAmount != null "> and cm_shop_order.orderBeanAmount = #{orderBeanAmount}</if>
+            <if test="useBeanAmount != null "> and cm_shop_order.useBeanAmount = #{useBeanAmount}</if>
+            <if test="useBeanFlag != null "> and cm_shop_order.useBeanFlag = #{useBeanFlag}</if>
+            <if test="canRefundFlag != null "> and cm_shop_order.canRefundFlag = #{canRefundFlag}</if>
+            <if test="useBalanceFlag != null "> and cm_shop_order.useBalanceFlag = #{useBalanceFlag}</if>
+            <if test="canRefundBeans != null "> and cm_shop_order.canRefundBeans = #{canRefundBeans}</if>
+            <if test="freePostageFee != null "> and cm_shop_order.freePostageFee = #{freePostageFee}</if>
+            <if test="freePostageTicketID != null "> and cm_shop_order.freePostageTicketID = #{freePostageTicketID}</if>
+            <if test="brokerage != null "> and cm_shop_order.brokerage = #{brokerage}</if>
+            <if test="delFlag != null  and delFlag != ''"> and cm_shop_order.delFlag = #{delFlag}</if>
+            <if test="refundsAmount != null "> and cm_shop_order.refundsAmount = #{refundsAmount}</if>
+            <if test="orderStatusFlag != null  and orderStatusFlag != ''"> and cm_shop_order.orderStatusFlag = #{orderStatusFlag}</if>
+            <if test="buyStatus != null  and buyStatus != ''"> and cm_shop_order.buyStatus = #{buyStatus}</if>
+            <if test="deliveryTimeMills != null  and deliveryTimeMills != ''"> and cm_shop_order.deliveryTimeMills = #{deliveryTimeMills}</if>
+            <if test="orderDeliveryID != null "> and cm_shop_order.orderDeliveryID = #{orderDeliveryID}</if>
+            <if test="splitFlag != null  and splitFlag != ''"> and cm_shop_order.splitFlag = #{splitFlag}</if>
+            <if test="paying != null  and paying != ''"> and cm_shop_order.paying = #{paying}</if>
+            <if test="shopProductAmount != null "> and cm_shop_order.shopProductAmount = #{shopProductAmount}</if>
+            <if test="shopPostFee != null "> and cm_shop_order.shopPostFee = #{shopPostFee}</if>
+            <if test="secondHandOrderFlag != null  and secondHandOrderFlag != ''"> and cm_shop_order.secondHandOrderFlag = #{secondHandOrderFlag}</if>
+            <if test="shopPostFlag != null  and shopPostFlag != ''"> and cm_shop_order.shopPostFlag = #{shopPostFlag}</if>
+            <if test="shopTaxFee != null "> and cm_shop_order.shopTaxFee = #{shopTaxFee}</if>
+            <if test="payCmAmount != null "> and cm_shop_order.payCmAmount = #{payCmAmount}</if>
+            <if test="shouldPayShopAmount != null "> and cm_shop_order.shouldPayShopAmount = #{shouldPayShopAmount}</if>
+            <if test="payedShopAmount != null "> and cm_shop_order.payedShopAmount = #{payedShopAmount}</if>
+            <if test="shopOtherFee != null "> and cm_shop_order.shopOtherFee = #{shopOtherFee}</if>
+            <if test="receiptedFlag != null  and receiptedFlag != ''"> and cm_shop_order.receiptedFlag = #{receiptedFlag}</if>
+            <if test="receiptedType != null  and receiptedType != ''"> and cm_shop_order.receiptedType = #{receiptedType}</if>
+            <if test="costType != null  and costType != ''"> and cm_shop_order.costType = #{costType}</if>
+            <if test="proportional != null "> and cm_shop_order.proportional = #{proportional}</if>
+            <if test="modifyShouldPayNote != null  and modifyShouldPayNote != ''"> and cm_shop_order.modifyShouldPayNote = #{modifyShouldPayNote}</if>
+            <if test="modifyShouldPayUserID != null "> and cm_shop_order.modifyShouldPayUserID = #{modifyShouldPayUserID}</if>
+            <if test="modifyShouldPayDate != null "> and cm_shop_order.modifyShouldPayDate = #{modifyShouldPayDate}</if>
+            <if test="zeroCostFlag != null "> and cm_shop_order.zeroCostFlag = #{zeroCostFlag}</if>
+            <if test="differenceType != null  and differenceType != ''"> and cm_shop_order.differenceType = #{differenceType}</if>
+            <if test="differencePrice != null "> and cm_shop_order.differencePrice = #{differencePrice}</if>
+            <if test="svipShopReduction != null "> and cm_shop_order.svipShopReduction = #{svipShopReduction}</if>
+            <if test="splitCode != null  and splitCode != ''"> and cm_shop_order.splitCode = #{splitCode}</if>
+            <if test="paySuccessCounter != null "> and cm_shop_order.paySuccessCounter = #{paySuccessCounter}</if>
+            <if test="onlinePayWays != null  and onlinePayWays != ''"> and cm_shop_order.onlinePayWays = #{onlinePayWays}</if>
+            <if test="shopStatus != null  and shopStatus != ''"> and cm_shop_order.shopStatus = #{shopStatus}</if>
+        </where>
+        group by cm_shop_order.shopOrderID
+        order by cm_shop_order.createTime desc
+    </select>
+    <select id="getCmShopOrderCount" parameterType="com.caimei.modules.order.entity.NewShopOrder" resultType="String">
+        select count(1)
+        from cm_shop_order AS cm_shop_order
+        <where>  cm_shop_order.delFlag = 0
+            <if test="shopOrderID != null  and  shopOrderID != ''">
+                and cm_shop_order.shopOrderID
+                <if test="shopOrderID.toUpperCase().indexOf('=')==-1">
+                    = #{shopOrderID}
+                </if>
+                <if test="shopOrderID.toUpperCase().indexOf('=')!=-1">
+                    <if test="shopOrderID.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="shopOrderID.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="shopOrderIDIn" collection="shopOrderID.substring(shopOrderID.toUpperCase().indexOf('=')+1,shopOrderID.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{shopOrderIDIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="shopOrderNo != null  and shopOrderNo != ''"> and cm_shop_order.shopOrderNo = #{shopOrderNo}</if>
+            <if test="orderNo != null  and orderNo != ''"> and cm_shop_order.orderNo = #{orderNo}</if>
+            <if test="orderID != null "> and cm_shop_order.orderID = #{orderID}</if>
+            <if test="organizeID != null "> and cm_shop_order.organizeID = #{organizeID}</if>
+            <if test="isColdChina != null "> and cm_shop_order.isColdChina = #{isColdChina}</if>
+            <if test="userID != null "> and cm_shop_order.userID = #{userID}</if>
+            <if test="shopID != null "> and cm_shop_order.shopID = #{shopID}</if>
+            <if test="orderPromotionsId != null "> and cm_shop_order.orderPromotionsId = #{orderPromotionsId}</if>
+            <if test="orderType != null "> and cm_shop_order.orderType = #{orderType}</if>
+            <if test="orderSubmitType != null "> and cm_shop_order.orderSubmitType = #{orderSubmitType}</if>
+            <if test="presentNum != null "> and cm_shop_order.presentNum = #{presentNum}</if>
+            <if test="itemCount != null "> and cm_shop_order.itemCount = #{itemCount}</if>
+            <if test="outStoreNum != null "> and cm_shop_order.outStoreNum = #{outStoreNum}</if>
+            <if test="outStoreTimes != null "> and cm_shop_order.outStoreTimes = #{outStoreTimes}</if>
+            <if test="townID != null "> and cm_shop_order.townID = #{townID}</if>
+            <if test="note != null  and note != ''"> and cm_shop_order.note = #{note}</if>
+            <if test="eachDiscount != null "> and cm_shop_order.eachDiscount = #{eachDiscount}</if>
+            <if test="realPay != null "> and cm_shop_order.realPay = #{realPay}</if>
+            <if test="receiptAmount != null "> and cm_shop_order.receiptAmount = #{receiptAmount}</if>
+            <if test="accountAmount != null "> and cm_shop_order.accountAmount = #{accountAmount}</if>
+            <if test="productAmount != null "> and cm_shop_order.productAmount = #{productAmount}</if>
+            <if test="totalAmount != null "> and cm_shop_order.totalAmount = #{totalAmount}</if>
+            <if test="needPayAmount != null "> and cm_shop_order.needPayAmount = #{needPayAmount}</if>
+            <if test="discountAmount != null "> and cm_shop_order.discountAmount = #{discountAmount}</if>
+            <if test="preferential != null "> and cm_shop_order.preferential = #{preferential}</if>
+            <if test="promotionFullReduction != null "> and cm_shop_order.promotionFullReduction = #{promotionFullReduction}</if>
+            <if test="payFlag != null  and payFlag != ''"> and cm_shop_order.payFlag = #{payFlag}</if>
+            <if test="orderTime != null  and orderTime != ''"> and cm_shop_order.orderTime = #{orderTime}</if>
+            <if test="payTime != null  and payTime != ''"> and cm_shop_order.payTime = #{payTime}</if>
+            <if test="finishTime != null  and finishTime != ''"> and cm_shop_order.finishTime = #{finishTime}</if>
+            <if test="autoOverTimeMills != null "> and cm_shop_order.autoOverTimeMills = #{autoOverTimeMills}</if>
+            <if test="settleStatus != null  and settleStatus != ''"> and cm_shop_order.settleStatus = #{settleStatus}</if>
+            <if test="payStatus != null  and payStatus != ''"> and cm_shop_order.payStatus = #{payStatus}</if>
+            <if test="receiptStatus != null  and receiptStatus != ''"> and cm_shop_order.receiptStatus = #{receiptStatus}</if>
+            <if test="sendOutStatus != null  and sendOutStatus != ''"> and cm_shop_order.sendOutStatus = #{sendOutStatus}</if>
+            <if test="refundStatus != null "> and cm_shop_order.refundStatus = #{refundStatus}</if>
+            <if test="returnGoodsStatus != null "> and cm_shop_order.returnGoodsStatus = #{returnGoodsStatus}</if>
+            <if test="receiveGoodsTime != null  and receiveGoodsTime != ''"> and cm_shop_order.receiveGoodsTime = #{receiveGoodsTime}</if>
+            <if test="autoReceiveTimeMills != null "> and cm_shop_order.autoReceiveTimeMills = #{autoReceiveTimeMills}</if>
+            <if test="totalAddedValueTax != null "> and cm_shop_order.totalAddedValueTax = #{totalAddedValueTax}</if>
+            <if test="canRefundAmount != null "> and cm_shop_order.canRefundAmount = #{canRefundAmount}</if>
+            <if test="refundAmount != null "> and cm_shop_order.refundAmount = #{refundAmount}</if>
+            <if test="clubID != null "> and cm_shop_order.clubID = #{clubID}</if>
+            <if test="spID != null "> and cm_shop_order.spID = #{spID}</if>
+            <if test="mainSpID != null "> and cm_shop_order.mainSpID = #{mainSpID}</if>
+            <if test="orderBeanAmount != null "> and cm_shop_order.orderBeanAmount = #{orderBeanAmount}</if>
+            <if test="useBeanAmount != null "> and cm_shop_order.useBeanAmount = #{useBeanAmount}</if>
+            <if test="useBeanFlag != null "> and cm_shop_order.useBeanFlag = #{useBeanFlag}</if>
+            <if test="canRefundFlag != null "> and cm_shop_order.canRefundFlag = #{canRefundFlag}</if>
+            <if test="useBalanceFlag != null "> and cm_shop_order.useBalanceFlag = #{useBalanceFlag}</if>
+            <if test="canRefundBeans != null "> and cm_shop_order.canRefundBeans = #{canRefundBeans}</if>
+            <if test="freePostageFee != null "> and cm_shop_order.freePostageFee = #{freePostageFee}</if>
+            <if test="freePostageTicketID != null "> and cm_shop_order.freePostageTicketID = #{freePostageTicketID}</if>
+            <if test="brokerage != null "> and cm_shop_order.brokerage = #{brokerage}</if>
+            <if test="delFlag != null  and delFlag != ''"> and cm_shop_order.delFlag = #{delFlag}</if>
+            <if test="refundsAmount != null "> and cm_shop_order.refundsAmount = #{refundsAmount}</if>
+            <if test="orderStatusFlag != null  and orderStatusFlag != ''"> and cm_shop_order.orderStatusFlag = #{orderStatusFlag}</if>
+            <if test="buyStatus != null  and buyStatus != ''"> and cm_shop_order.buyStatus = #{buyStatus}</if>
+            <if test="deliveryTimeMills != null  and deliveryTimeMills != ''"> and cm_shop_order.deliveryTimeMills = #{deliveryTimeMills}</if>
+            <if test="orderDeliveryID != null "> and cm_shop_order.orderDeliveryID = #{orderDeliveryID}</if>
+            <if test="splitFlag != null  and splitFlag != ''"> and cm_shop_order.splitFlag = #{splitFlag}</if>
+            <if test="paying != null  and paying != ''"> and cm_shop_order.paying = #{paying}</if>
+            <if test="shopProductAmount != null "> and cm_shop_order.shopProductAmount = #{shopProductAmount}</if>
+            <if test="shopPostFee != null "> and cm_shop_order.shopPostFee = #{shopPostFee}</if>
+            <if test="secondHandOrderFlag != null  and secondHandOrderFlag != ''"> and cm_shop_order.secondHandOrderFlag = #{secondHandOrderFlag}</if>
+            <if test="shopPostFlag != null  and shopPostFlag != ''"> and cm_shop_order.shopPostFlag = #{shopPostFlag}</if>
+            <if test="shopTaxFee != null "> and cm_shop_order.shopTaxFee = #{shopTaxFee}</if>
+            <if test="payCmAmount != null "> and cm_shop_order.payCmAmount = #{payCmAmount}</if>
+            <if test="shouldPayShopAmount != null "> and cm_shop_order.shouldPayShopAmount = #{shouldPayShopAmount}</if>
+            <if test="payedShopAmount != null "> and cm_shop_order.payedShopAmount = #{payedShopAmount}</if>
+            <if test="shopOtherFee != null "> and cm_shop_order.shopOtherFee = #{shopOtherFee}</if>
+            <if test="receiptedFlag != null  and receiptedFlag != ''"> and cm_shop_order.receiptedFlag = #{receiptedFlag}</if>
+            <if test="receiptedType != null  and receiptedType != ''"> and cm_shop_order.receiptedType = #{receiptedType}</if>
+            <if test="costType != null  and costType != ''"> and cm_shop_order.costType = #{costType}</if>
+            <if test="proportional != null "> and cm_shop_order.proportional = #{proportional}</if>
+            <if test="modifyShouldPayNote != null  and modifyShouldPayNote != ''"> and cm_shop_order.modifyShouldPayNote = #{modifyShouldPayNote}</if>
+            <if test="modifyShouldPayUserID != null "> and cm_shop_order.modifyShouldPayUserID = #{modifyShouldPayUserID}</if>
+            <if test="modifyShouldPayDate != null "> and cm_shop_order.modifyShouldPayDate = #{modifyShouldPayDate}</if>
+            <if test="zeroCostFlag != null "> and cm_shop_order.zeroCostFlag = #{zeroCostFlag}</if>
+            <if test="differenceType != null  and differenceType != ''"> and cm_shop_order.differenceType = #{differenceType}</if>
+            <if test="differencePrice != null "> and cm_shop_order.differencePrice = #{differencePrice}</if>
+            <if test="svipShopReduction != null "> and cm_shop_order.svipShopReduction = #{svipShopReduction}</if>
+            <if test="splitCode != null  and splitCode != ''"> and cm_shop_order.splitCode = #{splitCode}</if>
+            <if test="paySuccessCounter != null "> and cm_shop_order.paySuccessCounter = #{paySuccessCounter}</if>
+            <if test="onlinePayWays != null  and onlinePayWays != ''"> and cm_shop_order.onlinePayWays = #{onlinePayWays}</if>
+            <if test="shopStatus != null  and shopStatus != ''"> and cm_shop_order.shopStatus = #{shopStatus}</if>
+        </where>
+        group by cm_shop_order.shopOrderID
+    </select>
+
+    <select id="getCmShopOrderByShopOrderID" parameterType="String" resultMap="CmShopOrderResult">
+        <include refid="selectCmShopOrderVo"/>
+        from cm_shop_order AS cm_shop_order
+        where  cm_shop_order.delFlag = 0 and cm_shop_order.shopOrderID = #{shopOrderID}
+    </select>
+
+    <select id="getByIds" parameterType="com.caimei.modules.order.entity.NewShopOrder" resultType="String">
+        select shopOrderID
+        from cm_shop_order AS cm_shop_order
+        <where>  cm_shop_order.delFlag = 0
+            <if test="shopOrderID != null  and shopOrderID != ''">
+                and cm_shop_order.shopOrderID
+                <if test="shopOrderID.toUpperCase().indexOf('=')==-1">
+                    = #{shopOrderID}
+                </if>
+                <if test="shopOrderID.toUpperCase().indexOf('=')!=-1">
+                    <if test="shopOrderID.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="shopOrderID.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="shopOrderIDIn" collection="shopOrderID.substring(shopOrderID.toUpperCase().indexOf('=')+1,shopOrderID.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{shopOrderIDIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="shopOrderNo != null  and shopOrderNo != ''"> and cm_shop_order.shopOrderNo = #{shopOrderNo}</if>
+            <if test="orderNo != null  and orderNo != ''"> and cm_shop_order.orderNo = #{orderNo}</if>
+            <if test="orderID != null "> and cm_shop_order.orderID = #{orderID}</if>
+            <if test="organizeID != null "> and cm_shop_order.organizeID = #{organizeID}</if>
+            <if test="isColdChina != null "> and cm_shop_order.isColdChina = #{isColdChina}</if>
+            <if test="userID != null "> and cm_shop_order.userID = #{userID}</if>
+            <if test="shopID != null "> and cm_shop_order.shopID = #{shopID}</if>
+            <if test="orderPromotionsId != null "> and cm_shop_order.orderPromotionsId = #{orderPromotionsId}</if>
+            <if test="orderType != null "> and cm_shop_order.orderType = #{orderType}</if>
+            <if test="orderSubmitType != null "> and cm_shop_order.orderSubmitType = #{orderSubmitType}</if>
+            <if test="presentNum != null "> and cm_shop_order.presentNum = #{presentNum}</if>
+            <if test="itemCount != null "> and cm_shop_order.itemCount = #{itemCount}</if>
+            <if test="outStoreNum != null "> and cm_shop_order.outStoreNum = #{outStoreNum}</if>
+            <if test="outStoreTimes != null "> and cm_shop_order.outStoreTimes = #{outStoreTimes}</if>
+            <if test="townID != null "> and cm_shop_order.townID = #{townID}</if>
+            <if test="note != null  and note != ''"> and cm_shop_order.note = #{note}</if>
+            <if test="eachDiscount != null "> and cm_shop_order.eachDiscount = #{eachDiscount}</if>
+            <if test="realPay != null "> and cm_shop_order.realPay = #{realPay}</if>
+            <if test="receiptAmount != null "> and cm_shop_order.receiptAmount = #{receiptAmount}</if>
+            <if test="accountAmount != null "> and cm_shop_order.accountAmount = #{accountAmount}</if>
+            <if test="productAmount != null "> and cm_shop_order.productAmount = #{productAmount}</if>
+            <if test="totalAmount != null "> and cm_shop_order.totalAmount = #{totalAmount}</if>
+            <if test="needPayAmount != null "> and cm_shop_order.needPayAmount = #{needPayAmount}</if>
+            <if test="discountAmount != null "> and cm_shop_order.discountAmount = #{discountAmount}</if>
+            <if test="preferential != null "> and cm_shop_order.preferential = #{preferential}</if>
+            <if test="promotionFullReduction != null "> and cm_shop_order.promotionFullReduction = #{promotionFullReduction}</if>
+            <if test="payFlag != null  and payFlag != ''"> and cm_shop_order.payFlag = #{payFlag}</if>
+            <if test="orderTime != null  and orderTime != ''"> and cm_shop_order.orderTime = #{orderTime}</if>
+            <if test="payTime != null  and payTime != ''"> and cm_shop_order.payTime = #{payTime}</if>
+            <if test="finishTime != null  and finishTime != ''"> and cm_shop_order.finishTime = #{finishTime}</if>
+            <if test="autoOverTimeMills != null "> and cm_shop_order.autoOverTimeMills = #{autoOverTimeMills}</if>
+            <if test="settleStatus != null  and settleStatus != ''"> and cm_shop_order.settleStatus = #{settleStatus}</if>
+            <if test="payStatus != null  and payStatus != ''"> and cm_shop_order.payStatus = #{payStatus}</if>
+            <if test="receiptStatus != null  and receiptStatus != ''"> and cm_shop_order.receiptStatus = #{receiptStatus}</if>
+            <if test="sendOutStatus != null  and sendOutStatus != ''"> and cm_shop_order.sendOutStatus = #{sendOutStatus}</if>
+            <if test="refundStatus != null "> and cm_shop_order.refundStatus = #{refundStatus}</if>
+            <if test="returnGoodsStatus != null "> and cm_shop_order.returnGoodsStatus = #{returnGoodsStatus}</if>
+            <if test="receiveGoodsTime != null  and receiveGoodsTime != ''"> and cm_shop_order.receiveGoodsTime = #{receiveGoodsTime}</if>
+            <if test="autoReceiveTimeMills != null "> and cm_shop_order.autoReceiveTimeMills = #{autoReceiveTimeMills}</if>
+            <if test="totalAddedValueTax != null "> and cm_shop_order.totalAddedValueTax = #{totalAddedValueTax}</if>
+            <if test="canRefundAmount != null "> and cm_shop_order.canRefundAmount = #{canRefundAmount}</if>
+            <if test="refundAmount != null "> and cm_shop_order.refundAmount = #{refundAmount}</if>
+            <if test="clubID != null "> and cm_shop_order.clubID = #{clubID}</if>
+            <if test="spID != null "> and cm_shop_order.spID = #{spID}</if>
+            <if test="mainSpID != null "> and cm_shop_order.mainSpID = #{mainSpID}</if>
+            <if test="orderBeanAmount != null "> and cm_shop_order.orderBeanAmount = #{orderBeanAmount}</if>
+            <if test="useBeanAmount != null "> and cm_shop_order.useBeanAmount = #{useBeanAmount}</if>
+            <if test="useBeanFlag != null "> and cm_shop_order.useBeanFlag = #{useBeanFlag}</if>
+            <if test="canRefundFlag != null "> and cm_shop_order.canRefundFlag = #{canRefundFlag}</if>
+            <if test="useBalanceFlag != null "> and cm_shop_order.useBalanceFlag = #{useBalanceFlag}</if>
+            <if test="canRefundBeans != null "> and cm_shop_order.canRefundBeans = #{canRefundBeans}</if>
+            <if test="freePostageFee != null "> and cm_shop_order.freePostageFee = #{freePostageFee}</if>
+            <if test="freePostageTicketID != null "> and cm_shop_order.freePostageTicketID = #{freePostageTicketID}</if>
+            <if test="brokerage != null "> and cm_shop_order.brokerage = #{brokerage}</if>
+            <if test="delFlag != null  and delFlag != ''"> and cm_shop_order.delFlag = #{delFlag}</if>
+            <if test="refundsAmount != null "> and cm_shop_order.refundsAmount = #{refundsAmount}</if>
+            <if test="orderStatusFlag != null  and orderStatusFlag != ''"> and cm_shop_order.orderStatusFlag = #{orderStatusFlag}</if>
+            <if test="buyStatus != null  and buyStatus != ''"> and cm_shop_order.buyStatus = #{buyStatus}</if>
+            <if test="deliveryTimeMills != null  and deliveryTimeMills != ''"> and cm_shop_order.deliveryTimeMills = #{deliveryTimeMills}</if>
+            <if test="orderDeliveryID != null "> and cm_shop_order.orderDeliveryID = #{orderDeliveryID}</if>
+            <if test="splitFlag != null  and splitFlag != ''"> and cm_shop_order.splitFlag = #{splitFlag}</if>
+            <if test="paying != null  and paying != ''"> and cm_shop_order.paying = #{paying}</if>
+            <if test="shopProductAmount != null "> and cm_shop_order.shopProductAmount = #{shopProductAmount}</if>
+            <if test="shopPostFee != null "> and cm_shop_order.shopPostFee = #{shopPostFee}</if>
+            <if test="secondHandOrderFlag != null  and secondHandOrderFlag != ''"> and cm_shop_order.secondHandOrderFlag = #{secondHandOrderFlag}</if>
+            <if test="shopPostFlag != null  and shopPostFlag != ''"> and cm_shop_order.shopPostFlag = #{shopPostFlag}</if>
+            <if test="shopTaxFee != null "> and cm_shop_order.shopTaxFee = #{shopTaxFee}</if>
+            <if test="payCmAmount != null "> and cm_shop_order.payCmAmount = #{payCmAmount}</if>
+            <if test="shouldPayShopAmount != null "> and cm_shop_order.shouldPayShopAmount = #{shouldPayShopAmount}</if>
+            <if test="payedShopAmount != null "> and cm_shop_order.payedShopAmount = #{payedShopAmount}</if>
+            <if test="shopOtherFee != null "> and cm_shop_order.shopOtherFee = #{shopOtherFee}</if>
+            <if test="receiptedFlag != null  and receiptedFlag != ''"> and cm_shop_order.receiptedFlag = #{receiptedFlag}</if>
+            <if test="receiptedType != null  and receiptedType != ''"> and cm_shop_order.receiptedType = #{receiptedType}</if>
+            <if test="costType != null  and costType != ''"> and cm_shop_order.costType = #{costType}</if>
+            <if test="proportional != null "> and cm_shop_order.proportional = #{proportional}</if>
+            <if test="modifyShouldPayNote != null  and modifyShouldPayNote != ''"> and cm_shop_order.modifyShouldPayNote = #{modifyShouldPayNote}</if>
+            <if test="modifyShouldPayUserID != null "> and cm_shop_order.modifyShouldPayUserID = #{modifyShouldPayUserID}</if>
+            <if test="modifyShouldPayDate != null "> and cm_shop_order.modifyShouldPayDate = #{modifyShouldPayDate}</if>
+            <if test="zeroCostFlag != null "> and cm_shop_order.zeroCostFlag = #{zeroCostFlag}</if>
+            <if test="differenceType != null  and differenceType != ''"> and cm_shop_order.differenceType = #{differenceType}</if>
+            <if test="differencePrice != null "> and cm_shop_order.differencePrice = #{differencePrice}</if>
+            <if test="svipShopReduction != null "> and cm_shop_order.svipShopReduction = #{svipShopReduction}</if>
+            <if test="splitCode != null  and splitCode != ''"> and cm_shop_order.splitCode = #{splitCode}</if>
+            <if test="paySuccessCounter != null "> and cm_shop_order.paySuccessCounter = #{paySuccessCounter}</if>
+            <if test="onlinePayWays != null  and onlinePayWays != ''"> and cm_shop_order.onlinePayWays = #{onlinePayWays}</if>
+            <if test="shopStatus != null  and shopStatus != ''"> and cm_shop_order.shopStatus = #{shopStatus}</if>
+        </where>
+        group by cm_shop_order.shopOrderID
+    </select>
+    <select id="getById" parameterType="com.caimei.modules.order.entity.NewShopOrder" resultType="String">
+        select shopOrderID
+        from cm_shop_order AS cm_shop_order
+        <where>  cm_shop_order.delFlag = 0
+            <if test="shopOrderID != null  and shopOrderID != ''">
+                and cm_shop_order.shopOrderID
+                <if test="shopOrderID.toUpperCase().indexOf('=')==-1">
+                    = #{shopOrderID}
+                </if>
+                <if test="shopOrderID.toUpperCase().indexOf('=')!=-1">
+                    <if test="shopOrderID.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="shopOrderID.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="shopOrderIDIn" collection="shopOrderID.substring(shopOrderID.toUpperCase().indexOf('=')+1,shopOrderID.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{shopOrderIDIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="shopOrderNo != null  and shopOrderNo != ''"> and cm_shop_order.shopOrderNo = #{shopOrderNo}</if>
+            <if test="orderNo != null  and orderNo != ''"> and cm_shop_order.orderNo = #{orderNo}</if>
+            <if test="orderID != null "> and cm_shop_order.orderID = #{orderID}</if>
+            <if test="organizeID != null "> and cm_shop_order.organizeID = #{organizeID}</if>
+            <if test="isColdChina != null "> and cm_shop_order.isColdChina = #{isColdChina}</if>
+            <if test="userID != null "> and cm_shop_order.userID = #{userID}</if>
+            <if test="shopID != null "> and cm_shop_order.shopID = #{shopID}</if>
+            <if test="orderPromotionsId != null "> and cm_shop_order.orderPromotionsId = #{orderPromotionsId}</if>
+            <if test="orderType != null "> and cm_shop_order.orderType = #{orderType}</if>
+            <if test="orderSubmitType != null "> and cm_shop_order.orderSubmitType = #{orderSubmitType}</if>
+            <if test="presentNum != null "> and cm_shop_order.presentNum = #{presentNum}</if>
+            <if test="itemCount != null "> and cm_shop_order.itemCount = #{itemCount}</if>
+            <if test="outStoreNum != null "> and cm_shop_order.outStoreNum = #{outStoreNum}</if>
+            <if test="outStoreTimes != null "> and cm_shop_order.outStoreTimes = #{outStoreTimes}</if>
+            <if test="townID != null "> and cm_shop_order.townID = #{townID}</if>
+            <if test="note != null  and note != ''"> and cm_shop_order.note = #{note}</if>
+            <if test="eachDiscount != null "> and cm_shop_order.eachDiscount = #{eachDiscount}</if>
+            <if test="realPay != null "> and cm_shop_order.realPay = #{realPay}</if>
+            <if test="receiptAmount != null "> and cm_shop_order.receiptAmount = #{receiptAmount}</if>
+            <if test="accountAmount != null "> and cm_shop_order.accountAmount = #{accountAmount}</if>
+            <if test="productAmount != null "> and cm_shop_order.productAmount = #{productAmount}</if>
+            <if test="totalAmount != null "> and cm_shop_order.totalAmount = #{totalAmount}</if>
+            <if test="needPayAmount != null "> and cm_shop_order.needPayAmount = #{needPayAmount}</if>
+            <if test="discountAmount != null "> and cm_shop_order.discountAmount = #{discountAmount}</if>
+            <if test="preferential != null "> and cm_shop_order.preferential = #{preferential}</if>
+            <if test="promotionFullReduction != null "> and cm_shop_order.promotionFullReduction = #{promotionFullReduction}</if>
+            <if test="payFlag != null  and payFlag != ''"> and cm_shop_order.payFlag = #{payFlag}</if>
+            <if test="orderTime != null  and orderTime != ''"> and cm_shop_order.orderTime = #{orderTime}</if>
+            <if test="payTime != null  and payTime != ''"> and cm_shop_order.payTime = #{payTime}</if>
+            <if test="finishTime != null  and finishTime != ''"> and cm_shop_order.finishTime = #{finishTime}</if>
+            <if test="autoOverTimeMills != null "> and cm_shop_order.autoOverTimeMills = #{autoOverTimeMills}</if>
+            <if test="settleStatus != null  and settleStatus != ''"> and cm_shop_order.settleStatus = #{settleStatus}</if>
+            <if test="payStatus != null  and payStatus != ''"> and cm_shop_order.payStatus = #{payStatus}</if>
+            <if test="receiptStatus != null  and receiptStatus != ''"> and cm_shop_order.receiptStatus = #{receiptStatus}</if>
+            <if test="sendOutStatus != null  and sendOutStatus != ''"> and cm_shop_order.sendOutStatus = #{sendOutStatus}</if>
+            <if test="refundStatus != null "> and cm_shop_order.refundStatus = #{refundStatus}</if>
+            <if test="returnGoodsStatus != null "> and cm_shop_order.returnGoodsStatus = #{returnGoodsStatus}</if>
+            <if test="receiveGoodsTime != null  and receiveGoodsTime != ''"> and cm_shop_order.receiveGoodsTime = #{receiveGoodsTime}</if>
+            <if test="autoReceiveTimeMills != null "> and cm_shop_order.autoReceiveTimeMills = #{autoReceiveTimeMills}</if>
+            <if test="totalAddedValueTax != null "> and cm_shop_order.totalAddedValueTax = #{totalAddedValueTax}</if>
+            <if test="canRefundAmount != null "> and cm_shop_order.canRefundAmount = #{canRefundAmount}</if>
+            <if test="refundAmount != null "> and cm_shop_order.refundAmount = #{refundAmount}</if>
+            <if test="clubID != null "> and cm_shop_order.clubID = #{clubID}</if>
+            <if test="spID != null "> and cm_shop_order.spID = #{spID}</if>
+            <if test="mainSpID != null "> and cm_shop_order.mainSpID = #{mainSpID}</if>
+            <if test="orderBeanAmount != null "> and cm_shop_order.orderBeanAmount = #{orderBeanAmount}</if>
+            <if test="useBeanAmount != null "> and cm_shop_order.useBeanAmount = #{useBeanAmount}</if>
+            <if test="useBeanFlag != null "> and cm_shop_order.useBeanFlag = #{useBeanFlag}</if>
+            <if test="canRefundFlag != null "> and cm_shop_order.canRefundFlag = #{canRefundFlag}</if>
+            <if test="useBalanceFlag != null "> and cm_shop_order.useBalanceFlag = #{useBalanceFlag}</if>
+            <if test="canRefundBeans != null "> and cm_shop_order.canRefundBeans = #{canRefundBeans}</if>
+            <if test="freePostageFee != null "> and cm_shop_order.freePostageFee = #{freePostageFee}</if>
+            <if test="freePostageTicketID != null "> and cm_shop_order.freePostageTicketID = #{freePostageTicketID}</if>
+            <if test="brokerage != null "> and cm_shop_order.brokerage = #{brokerage}</if>
+            <if test="delFlag != null  and delFlag != ''"> and cm_shop_order.delFlag = #{delFlag}</if>
+            <if test="refundsAmount != null "> and cm_shop_order.refundsAmount = #{refundsAmount}</if>
+            <if test="orderStatusFlag != null  and orderStatusFlag != ''"> and cm_shop_order.orderStatusFlag = #{orderStatusFlag}</if>
+            <if test="buyStatus != null  and buyStatus != ''"> and cm_shop_order.buyStatus = #{buyStatus}</if>
+            <if test="deliveryTimeMills != null  and deliveryTimeMills != ''"> and cm_shop_order.deliveryTimeMills = #{deliveryTimeMills}</if>
+            <if test="orderDeliveryID != null "> and cm_shop_order.orderDeliveryID = #{orderDeliveryID}</if>
+            <if test="splitFlag != null  and splitFlag != ''"> and cm_shop_order.splitFlag = #{splitFlag}</if>
+            <if test="paying != null  and paying != ''"> and cm_shop_order.paying = #{paying}</if>
+            <if test="shopProductAmount != null "> and cm_shop_order.shopProductAmount = #{shopProductAmount}</if>
+            <if test="shopPostFee != null "> and cm_shop_order.shopPostFee = #{shopPostFee}</if>
+            <if test="secondHandOrderFlag != null  and secondHandOrderFlag != ''"> and cm_shop_order.secondHandOrderFlag = #{secondHandOrderFlag}</if>
+            <if test="shopPostFlag != null  and shopPostFlag != ''"> and cm_shop_order.shopPostFlag = #{shopPostFlag}</if>
+            <if test="shopTaxFee != null "> and cm_shop_order.shopTaxFee = #{shopTaxFee}</if>
+            <if test="payCmAmount != null "> and cm_shop_order.payCmAmount = #{payCmAmount}</if>
+            <if test="shouldPayShopAmount != null "> and cm_shop_order.shouldPayShopAmount = #{shouldPayShopAmount}</if>
+            <if test="payedShopAmount != null "> and cm_shop_order.payedShopAmount = #{payedShopAmount}</if>
+            <if test="shopOtherFee != null "> and cm_shop_order.shopOtherFee = #{shopOtherFee}</if>
+            <if test="receiptedFlag != null  and receiptedFlag != ''"> and cm_shop_order.receiptedFlag = #{receiptedFlag}</if>
+            <if test="receiptedType != null  and receiptedType != ''"> and cm_shop_order.receiptedType = #{receiptedType}</if>
+            <if test="costType != null  and costType != ''"> and cm_shop_order.costType = #{costType}</if>
+            <if test="proportional != null "> and cm_shop_order.proportional = #{proportional}</if>
+            <if test="modifyShouldPayNote != null  and modifyShouldPayNote != ''"> and cm_shop_order.modifyShouldPayNote = #{modifyShouldPayNote}</if>
+            <if test="modifyShouldPayUserID != null "> and cm_shop_order.modifyShouldPayUserID = #{modifyShouldPayUserID}</if>
+            <if test="modifyShouldPayDate != null "> and cm_shop_order.modifyShouldPayDate = #{modifyShouldPayDate}</if>
+            <if test="zeroCostFlag != null "> and cm_shop_order.zeroCostFlag = #{zeroCostFlag}</if>
+            <if test="differenceType != null  and differenceType != ''"> and cm_shop_order.differenceType = #{differenceType}</if>
+            <if test="differencePrice != null "> and cm_shop_order.differencePrice = #{differencePrice}</if>
+            <if test="svipShopReduction != null "> and cm_shop_order.svipShopReduction = #{svipShopReduction}</if>
+            <if test="splitCode != null  and splitCode != ''"> and cm_shop_order.splitCode = #{splitCode}</if>
+            <if test="paySuccessCounter != null "> and cm_shop_order.paySuccessCounter = #{paySuccessCounter}</if>
+            <if test="onlinePayWays != null  and onlinePayWays != ''"> and cm_shop_order.onlinePayWays = #{onlinePayWays}</if>
+            <if test="shopStatus != null  and shopStatus != ''"> and cm_shop_order.shopStatus = #{shopStatus}</if>
+        </where>
+        group by cm_shop_order.shopOrderID
+        limit 0,1
+    </select>
+
+    <insert id="addCmShopOrder" parameterType="com.caimei.modules.order.entity.NewShopOrder" useGeneratedKeys="true" keyProperty="shopOrderID">
+        insert into cm_shop_order
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="shopOrderID != null and shopOrderID != ''">shopOrderID,</if>
+            <if test="shopOrderNo != null and shopOrderNo != ''">shopOrderNo,</if>
+            <if test="orderNo != null and orderNo != ''">orderNo,</if>
+            <if test="orderID != null">orderID,</if>
+            <if test="organizeID != null">organizeID,</if>
+            <if test="isColdChina != null">isColdChina,</if>
+            <if test="userID != null">userID,</if>
+            <if test="shopID != null">shopID,</if>
+            <if test="orderPromotionsId != null">orderPromotionsId,</if>
+            <if test="orderType != null">orderType,</if>
+            <if test="orderSubmitType != null">orderSubmitType,</if>
+            <if test="presentNum != null">presentNum,</if>
+            <if test="itemCount != null">itemCount,</if>
+            <if test="outStoreNum != null">outStoreNum,</if>
+            <if test="outStoreTimes != null">outStoreTimes,</if>
+            <if test="townID != null">townID,</if>
+            <if test="note != null and note != ''">note,</if>
+            <if test="eachDiscount != null">eachDiscount,</if>
+            <if test="realPay != null">realPay,</if>
+            <if test="receiptAmount != null">receiptAmount,</if>
+            <if test="accountAmount != null">accountAmount,</if>
+            <if test="productAmount != null">productAmount,</if>
+            <if test="totalAmount != null">totalAmount,</if>
+            <if test="needPayAmount != null">needPayAmount,</if>
+            <if test="discountAmount != null">discountAmount,</if>
+            <if test="preferential != null">preferential,</if>
+            <if test="promotionFullReduction != null">promotionFullReduction,</if>
+            <if test="payFlag != null and payFlag != ''">payFlag,</if>
+            <if test="orderTime != null and orderTime != ''">orderTime,</if>
+            <if test="payTime != null and payTime != ''">payTime,</if>
+            <if test="finishTime != null and finishTime != ''">finishTime,</if>
+            <if test="autoOverTimeMills != null">autoOverTimeMills,</if>
+            <if test="settleStatus != null and settleStatus != ''">settleStatus,</if>
+            <if test="payStatus != null and payStatus != ''">payStatus,</if>
+            <if test="receiptStatus != null and receiptStatus != ''">receiptStatus,</if>
+            <if test="sendOutStatus != null and sendOutStatus != ''">sendOutStatus,</if>
+            <if test="refundStatus != null">refundStatus,</if>
+            <if test="returnGoodsStatus != null">returnGoodsStatus,</if>
+            <if test="receiveGoodsTime != null and receiveGoodsTime != ''">receiveGoodsTime,</if>
+            <if test="autoReceiveTimeMills != null">autoReceiveTimeMills,</if>
+            <if test="totalAddedValueTax != null">totalAddedValueTax,</if>
+            <if test="canRefundAmount != null">canRefundAmount,</if>
+            <if test="refundAmount != null">refundAmount,</if>
+            <if test="clubID != null">clubID,</if>
+            <if test="spID != null">spID,</if>
+            <if test="mainSpID != null">mainSpID,</if>
+            <if test="orderBeanAmount != null">orderBeanAmount,</if>
+            <if test="useBeanAmount != null">useBeanAmount,</if>
+            <if test="useBeanFlag != null">useBeanFlag,</if>
+            <if test="canRefundFlag != null">canRefundFlag,</if>
+            <if test="useBalanceFlag != null">useBalanceFlag,</if>
+            <if test="canRefundBeans != null">canRefundBeans,</if>
+            <if test="freePostageFee != null">freePostageFee,</if>
+            <if test="freePostageTicketID != null">freePostageTicketID,</if>
+            <if test="brokerage != null">brokerage,</if>
+            <if test="delFlag != null and delFlag != ''">delFlag,</if>
+            <if test="refundsAmount != null">refundsAmount,</if>
+            <if test="orderStatusFlag != null and orderStatusFlag != ''">orderStatusFlag,</if>
+            <if test="buyStatus != null and buyStatus != ''">buyStatus,</if>
+            <if test="deliveryTimeMills != null and deliveryTimeMills != ''">deliveryTimeMills,</if>
+            <if test="orderDeliveryID != null">orderDeliveryID,</if>
+            <if test="splitFlag != null and splitFlag != ''">splitFlag,</if>
+            <if test="paying != null and paying != ''">paying,</if>
+            <if test="shopProductAmount != null">shopProductAmount,</if>
+            <if test="shopPostFee != null">shopPostFee,</if>
+            <if test="secondHandOrderFlag != null and secondHandOrderFlag != ''">secondHandOrderFlag,</if>
+            <if test="shopPostFlag != null and shopPostFlag != ''">shopPostFlag,</if>
+            <if test="shopTaxFee != null">shopTaxFee,</if>
+            <if test="payCmAmount != null">payCmAmount,</if>
+            <if test="shouldPayShopAmount != null">shouldPayShopAmount,</if>
+            <if test="payedShopAmount != null">payedShopAmount,</if>
+            <if test="shopOtherFee != null">shopOtherFee,</if>
+            <if test="receiptedFlag != null and receiptedFlag != ''">receiptedFlag,</if>
+            <if test="receiptedType != null and receiptedType != ''">receiptedType,</if>
+            <if test="costType != null and costType != ''">costType,</if>
+            <if test="proportional != null">proportional,</if>
+            <if test="modifyShouldPayNote != null and modifyShouldPayNote != ''">modifyShouldPayNote,</if>
+            <if test="modifyShouldPayUserID != null">modifyShouldPayUserID,</if>
+            <if test="modifyShouldPayDate != null">modifyShouldPayDate,</if>
+            <if test="zeroCostFlag != null">zeroCostFlag,</if>
+            <if test="differenceType != null and differenceType != ''">differenceType,</if>
+            <if test="differencePrice != null">differencePrice,</if>
+            <if test="svipShopReduction != null">svipShopReduction,</if>
+            <if test="splitCode != null and splitCode != ''">splitCode,</if>
+            <if test="paySuccessCounter != null">paySuccessCounter,</if>
+            <if test="onlinePayWays != null and onlinePayWays != ''">onlinePayWays,</if>
+            <if test="shopStatus != null and shopStatus != ''">shopStatus,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="shopOrderID != null and shopOrderID != ''">#{shopOrderID},</if>
+            <if test="shopOrderNo != null and shopOrderNo != ''">#{shopOrderNo},</if>
+            <if test="orderNo != null and orderNo != ''">#{orderNo},</if>
+            <if test="orderID != null">#{orderID},</if>
+            <if test="organizeID != null">#{organizeID},</if>
+            <if test="isColdChina != null">#{isColdChina},</if>
+            <if test="userID != null">#{userID},</if>
+            <if test="shopID != null">#{shopID},</if>
+            <if test="orderPromotionsId != null">#{orderPromotionsId},</if>
+            <if test="orderType != null">#{orderType},</if>
+            <if test="orderSubmitType != null">#{orderSubmitType},</if>
+            <if test="presentNum != null">#{presentNum},</if>
+            <if test="itemCount != null">#{itemCount},</if>
+            <if test="outStoreNum != null">#{outStoreNum},</if>
+            <if test="outStoreTimes != null">#{outStoreTimes},</if>
+            <if test="townID != null">#{townID},</if>
+            <if test="note != null and note != ''">#{note},</if>
+            <if test="eachDiscount != null">#{eachDiscount},</if>
+            <if test="realPay != null">#{realPay},</if>
+            <if test="receiptAmount != null">#{receiptAmount},</if>
+            <if test="accountAmount != null">#{accountAmount},</if>
+            <if test="productAmount != null">#{productAmount},</if>
+            <if test="totalAmount != null">#{totalAmount},</if>
+            <if test="needPayAmount != null">#{needPayAmount},</if>
+            <if test="discountAmount != null">#{discountAmount},</if>
+            <if test="preferential != null">#{preferential},</if>
+            <if test="promotionFullReduction != null">#{promotionFullReduction},</if>
+            <if test="payFlag != null and payFlag != ''">#{payFlag},</if>
+            <if test="orderTime != null and orderTime != ''">#{orderTime},</if>
+            <if test="payTime != null and payTime != ''">#{payTime},</if>
+            <if test="finishTime != null and finishTime != ''">#{finishTime},</if>
+            <if test="autoOverTimeMills != null">#{autoOverTimeMills},</if>
+            <if test="settleStatus != null and settleStatus != ''">#{settleStatus},</if>
+            <if test="payStatus != null and payStatus != ''">#{payStatus},</if>
+            <if test="receiptStatus != null and receiptStatus != ''">#{receiptStatus},</if>
+            <if test="sendOutStatus != null and sendOutStatus != ''">#{sendOutStatus},</if>
+            <if test="refundStatus != null">#{refundStatus},</if>
+            <if test="returnGoodsStatus != null">#{returnGoodsStatus},</if>
+            <if test="receiveGoodsTime != null and receiveGoodsTime != ''">#{receiveGoodsTime},</if>
+            <if test="autoReceiveTimeMills != null">#{autoReceiveTimeMills},</if>
+            <if test="totalAddedValueTax != null">#{totalAddedValueTax},</if>
+            <if test="canRefundAmount != null">#{canRefundAmount},</if>
+            <if test="refundAmount != null">#{refundAmount},</if>
+            <if test="clubID != null">#{clubID},</if>
+            <if test="spID != null">#{spID},</if>
+            <if test="mainSpID != null">#{mainSpID},</if>
+            <if test="orderBeanAmount != null">#{orderBeanAmount},</if>
+            <if test="useBeanAmount != null">#{useBeanAmount},</if>
+            <if test="useBeanFlag != null">#{useBeanFlag},</if>
+            <if test="canRefundFlag != null">#{canRefundFlag},</if>
+            <if test="useBalanceFlag != null">#{useBalanceFlag},</if>
+            <if test="canRefundBeans != null">#{canRefundBeans},</if>
+            <if test="freePostageFee != null">#{freePostageFee},</if>
+            <if test="freePostageTicketID != null">#{freePostageTicketID},</if>
+            <if test="brokerage != null">#{brokerage},</if>
+            <if test="delFlag != null and delFlag != ''">#{delFlag},</if>
+            <if test="refundsAmount != null">#{refundsAmount},</if>
+            <if test="orderStatusFlag != null and orderStatusFlag != ''">#{orderStatusFlag},</if>
+            <if test="buyStatus != null and buyStatus != ''">#{buyStatus},</if>
+            <if test="deliveryTimeMills != null and deliveryTimeMills != ''">#{deliveryTimeMills},</if>
+            <if test="orderDeliveryID != null">#{orderDeliveryID},</if>
+            <if test="splitFlag != null and splitFlag != ''">#{splitFlag},</if>
+            <if test="paying != null and paying != ''">#{paying},</if>
+            <if test="shopProductAmount != null">#{shopProductAmount},</if>
+            <if test="shopPostFee != null">#{shopPostFee},</if>
+            <if test="secondHandOrderFlag != null and secondHandOrderFlag != ''">#{secondHandOrderFlag},</if>
+            <if test="shopPostFlag != null and shopPostFlag != ''">#{shopPostFlag},</if>
+            <if test="shopTaxFee != null">#{shopTaxFee},</if>
+            <if test="payCmAmount != null">#{payCmAmount},</if>
+            <if test="shouldPayShopAmount != null">#{shouldPayShopAmount},</if>
+            <if test="payedShopAmount != null">#{payedShopAmount},</if>
+            <if test="shopOtherFee != null">#{shopOtherFee},</if>
+            <if test="receiptedFlag != null and receiptedFlag != ''">#{receiptedFlag},</if>
+            <if test="receiptedType != null and receiptedType != ''">#{receiptedType},</if>
+            <if test="costType != null and costType != ''">#{costType},</if>
+            <if test="proportional != null">#{proportional},</if>
+            <if test="modifyShouldPayNote != null and modifyShouldPayNote != ''">#{modifyShouldPayNote},</if>
+            <if test="modifyShouldPayUserID != null">#{modifyShouldPayUserID},</if>
+            <if test="modifyShouldPayDate != null">#{modifyShouldPayDate},</if>
+            <if test="zeroCostFlag != null">#{zeroCostFlag},</if>
+            <if test="differenceType != null and differenceType != ''">#{differenceType},</if>
+            <if test="differencePrice != null">#{differencePrice},</if>
+            <if test="svipShopReduction != null">#{svipShopReduction},</if>
+            <if test="splitCode != null and splitCode != ''">#{splitCode},</if>
+            <if test="paySuccessCounter != null">#{paySuccessCounter},</if>
+            <if test="onlinePayWays != null and onlinePayWays != ''">#{onlinePayWays},</if>
+            <if test="shopStatus != null and shopStatus != ''">#{shopStatus},</if>
+        </trim>
+    </insert>
+
+    <update id="updateCmShopOrder" parameterType="com.caimei.modules.order.entity.NewShopOrder">
+        update cm_shop_order
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="shopOrderNo != null and shopOrderNo != ''">shopOrderNo = #{shopOrderNo},</if>
+            <if test="orderNo != null and orderNo != ''">orderNo = #{orderNo},</if>
+            <if test="orderID != null">orderID = #{orderID},</if>
+            <if test="organizeID != null">organizeID = #{organizeID},</if>
+            <if test="isColdChina != null">isColdChina = #{isColdChina},</if>
+            <if test="userID != null">userID = #{userID},</if>
+            <if test="shopID != null">shopID = #{shopID},</if>
+            <if test="orderPromotionsId != null">orderPromotionsId = #{orderPromotionsId},</if>
+            <if test="orderType != null">orderType = #{orderType},</if>
+            <if test="orderSubmitType != null">orderSubmitType = #{orderSubmitType},</if>
+            <if test="presentNum != null">presentNum = #{presentNum},</if>
+            <if test="itemCount != null">itemCount = #{itemCount},</if>
+            <if test="outStoreNum != null">outStoreNum = #{outStoreNum},</if>
+            <if test="outStoreTimes != null">outStoreTimes = #{outStoreTimes},</if>
+            <if test="townID != null">townID = #{townID},</if>
+            <if test="note != null and note != ''">note = #{note},</if>
+            <if test="eachDiscount != null">eachDiscount = #{eachDiscount},</if>
+            <if test="realPay != null">realPay = #{realPay},</if>
+            <if test="receiptAmount != null">receiptAmount = #{receiptAmount},</if>
+            <if test="accountAmount != null">accountAmount = #{accountAmount},</if>
+            <if test="productAmount != null">productAmount = #{productAmount},</if>
+            <if test="totalAmount != null">totalAmount = #{totalAmount},</if>
+            <if test="needPayAmount != null">needPayAmount = #{needPayAmount},</if>
+            <if test="discountAmount != null">discountAmount = #{discountAmount},</if>
+            <if test="preferential != null">preferential = #{preferential},</if>
+            <if test="promotionFullReduction != null">promotionFullReduction = #{promotionFullReduction},</if>
+            <if test="payFlag != null and payFlag != ''">payFlag = #{payFlag},</if>
+            <if test="orderTime != null and orderTime != ''">orderTime = #{orderTime},</if>
+            <if test="payTime != null and payTime != ''">payTime = #{payTime},</if>
+            <if test="finishTime != null and finishTime != ''">finishTime = #{finishTime},</if>
+            <if test="autoOverTimeMills != null">autoOverTimeMills = #{autoOverTimeMills},</if>
+            <if test="settleStatus != null and settleStatus != ''">settleStatus = #{settleStatus},</if>
+            <if test="payStatus != null and payStatus != ''">payStatus = #{payStatus},</if>
+            <if test="receiptStatus != null and receiptStatus != ''">receiptStatus = #{receiptStatus},</if>
+            <if test="sendOutStatus != null and sendOutStatus != ''">sendOutStatus = #{sendOutStatus},</if>
+            <if test="refundStatus != null">refundStatus = #{refundStatus},</if>
+            <if test="returnGoodsStatus != null">returnGoodsStatus = #{returnGoodsStatus},</if>
+            <if test="receiveGoodsTime != null and receiveGoodsTime != ''">receiveGoodsTime = #{receiveGoodsTime},</if>
+            <if test="autoReceiveTimeMills != null">autoReceiveTimeMills = #{autoReceiveTimeMills},</if>
+            <if test="totalAddedValueTax != null">totalAddedValueTax = #{totalAddedValueTax},</if>
+            <if test="canRefundAmount != null">canRefundAmount = #{canRefundAmount},</if>
+            <if test="refundAmount != null">refundAmount = #{refundAmount},</if>
+            <if test="clubID != null">clubID = #{clubID},</if>
+            <if test="spID != null">spID = #{spID},</if>
+            <if test="mainSpID != null">mainSpID = #{mainSpID},</if>
+            <if test="orderBeanAmount != null">orderBeanAmount = #{orderBeanAmount},</if>
+            <if test="useBeanAmount != null">useBeanAmount = #{useBeanAmount},</if>
+            <if test="useBeanFlag != null">useBeanFlag = #{useBeanFlag},</if>
+            <if test="canRefundFlag != null">canRefundFlag = #{canRefundFlag},</if>
+            <if test="useBalanceFlag != null">useBalanceFlag = #{useBalanceFlag},</if>
+            <if test="canRefundBeans != null">canRefundBeans = #{canRefundBeans},</if>
+            <if test="freePostageFee != null">freePostageFee = #{freePostageFee},</if>
+            <if test="freePostageTicketID != null">freePostageTicketID = #{freePostageTicketID},</if>
+            <if test="brokerage != null">brokerage = #{brokerage},</if>
+            <if test="delFlag != null and delFlag != ''">delFlag = #{delFlag},</if>
+            <if test="refundsAmount != null">refundsAmount = #{refundsAmount},</if>
+            <if test="orderStatusFlag != null and orderStatusFlag != ''">orderStatusFlag = #{orderStatusFlag},</if>
+            <if test="buyStatus != null and buyStatus != ''">buyStatus = #{buyStatus},</if>
+            <if test="deliveryTimeMills != null and deliveryTimeMills != ''">deliveryTimeMills = #{deliveryTimeMills},</if>
+            <if test="orderDeliveryID != null">orderDeliveryID = #{orderDeliveryID},</if>
+            <if test="splitFlag != null and splitFlag != ''">splitFlag = #{splitFlag},</if>
+            <if test="paying != null and paying != ''">paying = #{paying},</if>
+            <if test="shopProductAmount != null">shopProductAmount = #{shopProductAmount},</if>
+            <if test="shopPostFee != null">shopPostFee = #{shopPostFee},</if>
+            <if test="secondHandOrderFlag != null and secondHandOrderFlag != ''">secondHandOrderFlag = #{secondHandOrderFlag},</if>
+            <if test="shopPostFlag != null and shopPostFlag != ''">shopPostFlag = #{shopPostFlag},</if>
+            <if test="shopTaxFee != null">shopTaxFee = #{shopTaxFee},</if>
+            <if test="payCmAmount != null">payCmAmount = #{payCmAmount},</if>
+            <if test="shouldPayShopAmount != null">shouldPayShopAmount = #{shouldPayShopAmount},</if>
+            <if test="payedShopAmount != null">payedShopAmount = #{payedShopAmount},</if>
+            <if test="shopOtherFee != null">shopOtherFee = #{shopOtherFee},</if>
+            <if test="receiptedFlag != null and receiptedFlag != ''">receiptedFlag = #{receiptedFlag},</if>
+            <if test="receiptedType != null and receiptedType != ''">receiptedType = #{receiptedType},</if>
+            <if test="costType != null and costType != ''">costType = #{costType},</if>
+            <if test="proportional != null">proportional = #{proportional},</if>
+            <if test="modifyShouldPayNote != null and modifyShouldPayNote != ''">modifyShouldPayNote = #{modifyShouldPayNote},</if>
+            <if test="modifyShouldPayUserID != null">modifyShouldPayUserID = #{modifyShouldPayUserID},</if>
+            <if test="modifyShouldPayDate != null">modifyShouldPayDate = #{modifyShouldPayDate},</if>
+            <if test="zeroCostFlag != null">zeroCostFlag = #{zeroCostFlag},</if>
+            <if test="differenceType != null and differenceType != ''">differenceType = #{differenceType},</if>
+            <if test="differencePrice != null">differencePrice = #{differencePrice},</if>
+            <if test="svipShopReduction != null">svipShopReduction = #{svipShopReduction},</if>
+            <if test="splitCode != null and splitCode != ''">splitCode = #{splitCode},</if>
+            <if test="paySuccessCounter != null">paySuccessCounter = #{paySuccessCounter},</if>
+            <if test="onlinePayWays != null and onlinePayWays != ''">onlinePayWays = #{onlinePayWays},</if>
+            <if test="shopStatus != null and shopStatus != ''">shopStatus = #{shopStatus},</if>
+        </trim>
+        where shopOrderID = #{shopOrderID}
+    </update>
+
+    <update id="updateDelCmShopOrderByShopOrderIDs" parameterType="String">
+        update cm_shop_order set delFlag=#{delFlag} where shopOrderID in
+        <foreach item="shopOrderID" collection="shopOrderIDs" open="(" separator="," close=")">
+            #{shopOrderID}
+        </foreach>
+    </update>
+
+    <delete id="delCmShopOrderByShopOrderID" parameterType="String">
+        delete
+        from cm_shop_order where shopOrderID = #{shopOrderID}
+    </delete>
+
+    <delete id="delCmShopOrderByShopOrderIDs" parameterType="String">
+        delete from cm_shop_order where shopOrderID in
+        <foreach item="shopOrderID" collection="shopOrderIDs" open="(" separator="," close=")">
+            #{shopOrderID}
+        </foreach>
+    </delete>
 </mapper>

+ 4 - 1
src/main/resources/mappings/modules/product/ProductMapper.xml

@@ -2073,8 +2073,11 @@
                cs.unit,
                cs.stock,
                cs.costCheckFlag,
-               cs.shopPercent,
                cs.costPrice,
+               ifnull(cs.shopPercent, 0) as shopPercent,
+               ifnull(cs.organizePercent, 0) as organizePercent,
+               ifnull(cs.cmPercent, 0) as cmPercent,
+               ifnull(cs.costCheckFlag, 0)    as costType,
                chs.price
         from cm_sku cs
                  left join cm_hehe_sku chs on cs.skuId = chs.skuId

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/bulkpurchase/refundRecord.jsp

@@ -104,7 +104,7 @@
         </c:if>
     </c:if>
     <c:if test="${from eq '2'}">
-        <li><a href="${ctx}/order/detail?id=${orderID}">订单详情</a></li>
+        <li><a href="${ctx}${orderType == 2 ?'/hehe/new':''}/order/detail?id=${orderID}">订单详情</a></li>
     </c:if>
     <c:if test="${from eq '3'}">
         <li><a href="${ctx}/shopOrder/checkPaymentOrder">订单财务信息</a></li>

+ 5 - 4
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheProductForm.jsp

@@ -297,12 +297,13 @@
            class="form-horizontal">
 <form:hidden path="id"/>
 <form:hidden path="productId" id="productId"/>
+<form:hidden path="isNewRecord" id="isNewRecord"/>
 <sys:message content="${message}"/>
     <%--        <form:hidden path="floorIds"/>--%>
 <div class="control-group">
     <label class="control-label"><font color="red">*</font>商品:</label>
     <div class="controls" id="addProduct">
-        <a href="JavaScript:;" onclick="showSelect()">请选择加入呵呵商城的商品</a>
+        <a href="JavaScript:;" onclick="showSelect()">请选择加入颜选美学商城的商品</a>
     </div>
     <table id="contentTable" class="table table-striped table-bordered table-condensed" hidden="hidden">
         <thead>
@@ -347,7 +348,7 @@
                             <label><font color="red">*</font>成本价:${sku.costPrice}</label>
                         </c:if>
                         <c:if test="${sku.costCheckFlag eq 2}">
-                            <label><font color="red">*</font>成本比例百分比:${sku.shopPercent}%</label>
+                            <label><font color="red">*</font>${sku.skuId } 比例:供应商${sku.shopPercent}%,集团${sku.organizePercent}%,采美${sku.cmPercent}%</label>
                         </c:if>
                     </div>
                 </div>
@@ -501,8 +502,8 @@
 
                             for (let i = 0; i < skus.length; i++) {
                                 var unit=i+1;
-                                var cost = skus[i].costCheckFlag == 1 ? '固定成本' : '比例成本';
-                                var costShow = skus[i].costCheckFlag == 1 ? '<label><font color="red">*</font>成本价:' + skus[i].costPrice + '</label>' : '<label><font color="red">*</font>成本比例百分比:' + skus[i].shopPercent + '%</label>';
+                                var cost = skus[i].costCheckFlag == 1 ? '固定成本' : '比例成本'+skus[i].shuId+'gggggg' ;
+                                var costShow = skus[i].costCheckFlag == 1 ? '<label><font color="red">*</font>成本价:' + skus[i].costPrice + '</label>' : '<label><font color="red">*</font>比例:供应商' + skus[i].shopPercent + '%,集团' + skus[i].organizePercent + '%,采美' + skus[i].cmPercent + '%</label>';
                                 html += '<div><input type="number" style="display:none" value="' + skus[i].skuId + '" name="skus[' + i + '].skuId">';
                                 html += '<label class="control-label"><font color="red">*</font>规格:规格' + unit;
                                 html += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>';

+ 4 - 4
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheProductList.jsp

@@ -10,7 +10,7 @@
 	</style>
 	<script type="text/javascript">
 		$(document).ready(function() {
-			
+
 		});
 		function page(n,s){
 			$("#pageNo").val(n);
@@ -70,7 +70,7 @@
 				<th>商品名称</th>
 				<th>供应商名称</th>
 				<th>售价</th>
-				<th>成本价</th>
+				<th>成本价/比例</th>
 				<th>是否含税</th>
 				<th>商品状态</th>
 				<th>添加时间</th>
@@ -96,7 +96,7 @@
 						${cmHeheProduct.price}
 				</td>
 				<td>
-						${cmHeheProduct.costPrice}
+						${cmHeheProduct.costType eq 1?cmHeheProduct.costPrice:cmHeheProduct.shopPercent}${cmHeheProduct.costType eq 1?'':'%'}
 				</td>
 				<td>
 					${cmHeheProduct.includedTax eq 0 ? "不含税" : "含税"}-
@@ -158,4 +158,4 @@
 	}
 </script>
 </body>
-</html>
+</html>

+ 230 - 205
src/main/webapp/WEB-INF/views/modules/hehe/heheNewOrderDetail.jsp

@@ -250,14 +250,14 @@
             background: #fff;
             width: 125px;
             position: absolute;
-            left: 35px;
-            top: 30px;
+            left: 826px;
+            top: 5px;
             padding: 10px;
             border: 1px solid #666;
             -webkit-border-radius: 5px;
             -moz-border-radius: 5px;
             border-radius: 5px;
-            z-index: 999;
+            z-index: 100001;
             display: none
         }
 
@@ -391,7 +391,7 @@
     <tr>
         <td>下单时间: ${order.orderTime}</td>
         <td>订单号(ID): ${order.orderNo}(${order.orderID})</td>
-        <td>返佣订单: ${(order.rebateOrder ne '0' || order.rebateFlag eq '1')?'是':'否'}</td>
+<%--        <td>返佣订单: ${(order.rebateOrder ne '0' || order.rebateFlag eq '1')?'是':'否'}</td>--%>
     </tr>
     <tr>
         <td>订单类型: ${order.collageFlag eq 1?'拼团订单':'独立订单'}</td>
@@ -526,15 +526,15 @@
         <td>
             应收金额:<fmt:formatNumber value="${order.payableAmount}" type="currency"/>
             <span style="color: red">
-                <c:if test="${order.balancePayFee gt 0}">
-                    <a href="${ctx}/user/cmUserBalanceRecord/userBalanceRecord?userId=${order.userID}"
-                       style="color: red;text-decoration: underline">
-                        (账户余额抵扣: <fmt:formatNumber value="${order.balancePayFee}" type="currency"/>)
-                    </a>
-                </c:if>
-                <c:if test="${order.balancePayFee le 0}">
-                    (账户余额抵扣: <fmt:formatNumber value="${order.balancePayFee}" type="currency"/>)
-                </c:if>
+<%--                <c:if test="${order.balancePayFee gt 0}">--%>
+<%--                    <a href="${ctx}/user/cmUserBalanceRecord/userBalanceRecord?userId=${order.userID}"--%>
+<%--                       style="color: red;text-decoration: underline">--%>
+<%--                        (账户余额抵扣: <fmt:formatNumber value="${order.balancePayFee}" type="currency"/>)--%>
+<%--                    </a>--%>
+<%--                </c:if>--%>
+<%--                <c:if test="${order.balancePayFee le 0}">--%>
+<%--                    (账户余额抵扣: <fmt:formatNumber value="${order.balancePayFee}" type="currency"/>)--%>
+<%--                </c:if>--%>
 
 
             </span>
@@ -552,68 +552,68 @@
         </td>
         <td>
             退款金额(已完成):<fmt:formatNumber value="${returnValue}" type="currency"/>
-            <span style="color: red">
-                    (原<fmt:formatNumber value="${returnedPurchaseFee}" type="currency"/>,折扣取消
-                    <c:if test="${order.discountFee gt returnedPurchaseFee}"><fmt:formatNumber
-                            value="${returnedPurchaseFee}" type="currency"/></c:if>
-                    <c:if test="${order.discountFee le returnedPurchaseFee}"><fmt:formatNumber
-                            value="${order.discountFee}" type="currency"/></c:if>)
-                </span>
+<%--            <span style="color: red">--%>
+<%--                    (原<fmt:formatNumber value="${returnedPurchaseFee}" type="currency"/>,折扣取消--%>
+<%--                    <c:if test="${order.discountFee gt returnedPurchaseFee}"><fmt:formatNumber--%>
+<%--                            value="${returnedPurchaseFee}" type="currency"/></c:if>--%>
+<%--                    <c:if test="${order.discountFee le returnedPurchaseFee}"><fmt:formatNumber--%>
+<%--                            value="${order.discountFee}" type="currency"/></c:if>)--%>
+<%--                </span>--%>
         </td>
     </tr>
     <tr>
-        <td>
-            经理折扣:
-            <c:if test="${order.discountFee gt 0}">
-                <c:if test="${order.discountFee gt returnedPurchaseFee}">
-                    <fmt:formatNumber value="${order.discountFee - returnedPurchaseFee}" type="currency"/>
-                </c:if>
-                <c:if test="${order.discountFee le returnedPurchaseFee}">
-                    ¥0.00
-                </c:if>
-                <span style="color: red">
-                        (原<fmt:formatNumber value="${order.discountFee}" type="currency"/>,折扣取消
-                        <c:if test="${order.discountFee gt returnedPurchaseFee}">
-                            <fmt:formatNumber value="${returnedPurchaseFee}" type="currency"/>
-                        </c:if>
-                        <c:if test="${order.discountFee le returnedPurchaseFee}">
-                            <fmt:formatNumber value="${order.discountFee}" type="currency"/>
-                        </c:if>)
-                    </span>
-            </c:if>
-            <c:if test="${order.discountFee le 0}">¥0.00</c:if>
-        </td>
-        <td>运费:
-            <c:if test="${order.freight == 0}">
-                包邮
-            </c:if>
-            <c:if test="${order.freight == -1}">
-                到付
-            </c:if>
-            <c:if test="${order.freight == -2}">
-                仪器到付-产品包邮
-            </c:if>
-            <c:if test="${order.freight != -1 && order.freight != 0 && order.freight != -2}">
-                <fmt:formatNumber value="${order.freight}" type="currency"/>
-            </c:if>
-        </td>
-        <td style="position: relative;"><a class="operation-btn btn">功能</a>
-            <div class="operation-block">
-                <shiro:hasPermission name="order:order:edit">
-                    <%--包含订单充值商品就不显示--%>
-                    <c:if test="${order.rechargeGoods ne 1 and order.rechargeGoods ne 2}">
-                        <c:if test="${order.status == 11 || order.status == 12 || order.status == 21 || order.status == 22 || order.status == 31 || order.status == 32}">
-                            <a href="${ctx}/order/toDeliveryPage?id=${order.orderID}">发货</a>
-                        </c:if>
-                        <c:if test="${order.receiptStatus == 2 && order.status != 6 && order.status != 7}">
-                            <a href="javascript:void(0);" onclick="collection(${order.orderID})">抹平收款</a>
-                        </c:if>
-                    </c:if>
-                    <c:if test="${(order.organizeID == 0 or order.organizeID > 2) && order.status == 11 && order.payStatus == 1}">
-                        <a href="javascript:void(0);"
-                           onclick="modelShow('${order.orderID}')">编辑经理折扣</a>
-                    </c:if>
-                </shiro:hasPermission>
+<%--        <td>--%>
+<%--            经理折扣:--%>
+<%--            <c:if test="${order.discountFee gt 0}">--%>
+<%--                <c:if test="${order.discountFee gt returnedPurchaseFee}">--%>
+<%--                    <fmt:formatNumber value="${order.discountFee - returnedPurchaseFee}" type="currency"/>--%>
+<%--                </c:if>--%>
+<%--                <c:if test="${order.discountFee le returnedPurchaseFee}">--%>
+<%--                    ¥0.00--%>
+<%--                </c:if>--%>
+<%--                <span style="color: red">--%>
+<%--                        (原<fmt:formatNumber value="${order.discountFee}" type="currency"/>,折扣取消--%>
+<%--                        <c:if test="${order.discountFee gt returnedPurchaseFee}">--%>
+<%--                            <fmt:formatNumber value="${returnedPurchaseFee}" type="currency"/>--%>
+<%--                        </c:if>--%>
+<%--                        <c:if test="${order.discountFee le returnedPurchaseFee}">--%>
+<%--                            <fmt:formatNumber value="${order.discountFee}" type="currency"/>--%>
+<%--                        </c:if>)--%>
+<%--                    </span>--%>
+<%--            </c:if>--%>
+<%--            <c:if test="${order.discountFee le 0}">¥0.00</c:if>--%>
+<%--        </td>--%>
+<%--        <td>运费:--%>
+<%--            <c:if test="${order.freight == 0}">--%>
+<%--                包邮--%>
+<%--            </c:if>--%>
+<%--            <c:if test="${order.freight == -1}">--%>
+<%--                到付--%>
+<%--            </c:if>--%>
+<%--            <c:if test="${order.freight == -2}">--%>
+<%--                仪器到付-产品包邮--%>
+<%--            </c:if>--%>
+<%--            <c:if test="${order.freight != -1 && order.freight != 0 && order.freight != -2}">--%>
+<%--                <fmt:formatNumber value="${order.freight}" type="currency"/>--%>
+<%--            </c:if>--%>
+<%--        </td>--%>
+<%--        <td style="position: relative;"><a class="operation-btn btn">功能</a>--%>
+<%--            <div class="operation-block">--%>
+<%--                <shiro:hasPermission name="order:order:edit">--%>
+<%--                    &lt;%&ndash;包含订单充值商品就不显示&ndash;%&gt;--%>
+<%--                    <c:if test="${order.rechargeGoods ne 1 and order.rechargeGoods ne 2}">--%>
+<%--                        <c:if test="${order.status == 11 || order.status == 12 || order.status == 21 || order.status == 22 || order.status == 31 || order.status == 32}">--%>
+<%--                            <a href="${ctx}/order/toDeliveryPage?id=${order.orderID}">发货</a>--%>
+<%--                        </c:if>--%>
+<%--                        <c:if test="${order.receiptStatus == 2 && order.status != 6 && order.status != 7}">--%>
+<%--                            <a href="javascript:void(0);" onclick="collection(${order.orderID})">抹平收款</a>--%>
+<%--                        </c:if>--%>
+<%--                    </c:if>--%>
+<%--                    <c:if test="${(order.organizeID == 0 or order.organizeID > 2) && order.status == 11 && order.payStatus == 1}">--%>
+<%--                        <a href="javascript:void(0);"--%>
+<%--                           onclick="modelShow('${order.orderID}')">编辑经理折扣</a>--%>
+<%--                    </c:if>--%>
+<%--                </shiro:hasPermission>--%>
 <%--                <shiro:hasPermission name="order:order:applyrefound">--%>
 <%--                    <c:if test="${order.status == 12 || order.status == 13 || order.status == 21 || order.status == 22 || order.status == 23 || order.status == 31 || order.status == 32 || order.status == 33 || order.status == 4 || order.status == 5}">--%>
 <%--                        &lt;%&ndash;  返佣订单不能申请退款(退货) &ndash;%&gt;--%>
@@ -640,29 +640,29 @@
 <%--                    </c:if>--%>
 <%--                </shiro:hasPermission>--%>
 
-                <shiro:hasPermission name="order:order:edit">
-                    <c:if test="${order.status ne 0}">
-                        <a href="${ctx}/order/printOrder?orderID=${order.orderID}">打印发货单</a>
-                    </c:if>
-                    <a href="${ctx}/order/exportOrder?id=${order.orderID}">订单导出</a>
-                    <a href="${ctx}/order/cmOrderRemark/remarksViewNew.rpc?orderID=${order.orderID}&source=2&orderType=2">订单备注</a>
-                    <%--包含订单充值商品就不显示--%>
-                    <c:if test="${empty order.rechargeGoods}">
-                        <c:if test="${order.status ne 0 && order.status ne 11 && order.status ne 21 && order.status ne 6 && order.status ne 4}">
-                            <a href="${ctx}/order/logisticsDetails?orderID=${order.orderID}">发货记录</a>
-                        </c:if>
-                        <c:if test="${order.status ne 0 && order.status ne 11 && order.status ne 6}">
-                            <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${order.orderID}&from=2">收退款记录
-                            </a>
-                        </c:if>
-                        <c:if test="${order.status ne 0 && order.status ne 11 && order.status ne 6}">
-                            <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRecturnRecordByOrderID.rpc?orderID=${order.orderID}">退款(退货)记录
-                            </a>
-                        </c:if>
-                    </c:if>
-                </shiro:hasPermission>
-            </div>
-        </td>
+<%--                <shiro:hasPermission name="order:order:edit">--%>
+<%--                    <c:if test="${order.status ne 0}">--%>
+<%--                        <a href="${ctx}/order/printOrder?orderID=${order.orderID}">打印发货单</a>--%>
+<%--                    </c:if>--%>
+<%--                    <a href="${ctx}/order/exportOrder?id=${order.orderID}">订单导出</a>--%>
+<%--                    <a href="${ctx}/order/cmOrderRemark/remarksViewNew.rpc?orderID=${order.orderID}&source=2&orderType=2">订单备注</a>--%>
+<%--                    &lt;%&ndash;包含订单充值商品就不显示&ndash;%&gt;--%>
+<%--                    <c:if test="${empty order.rechargeGoods}">--%>
+<%--                        <c:if test="${order.status ne 0 && order.status ne 11 && order.status ne 21 && order.status ne 6 && order.status ne 4}">--%>
+<%--                            <a href="${ctx}/order/logisticsDetails?orderID=${order.orderID}">发货记录</a>--%>
+<%--                        </c:if>--%>
+<%--                        <c:if test="${order.status ne 0 && order.status ne 11 && order.status ne 6}">--%>
+<%--                            <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${order.orderID}&from=2">收退款记录--%>
+<%--                            </a>--%>
+<%--                        </c:if>--%>
+<%--                        <c:if test="${order.status ne 0 && order.status ne 11 && order.status ne 6}">--%>
+<%--                            <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRecturnRecordByOrderID.rpc?orderID=${order.orderID}">退款(退货)记录--%>
+<%--                            </a>--%>
+<%--                        </c:if>--%>
+<%--                    </c:if>--%>
+<%--                </shiro:hasPermission>--%>
+<%--            </div>--%>
+<%--        </td>--%>
     </tr>
     <tr>
         <td>拼团状态:
@@ -699,124 +699,149 @@
     <div class="order-rows">
         <span><label>下单时间:</label>${order.orderTime}</span>
         <span><label>子订单号(ID):</label>${shopOrder.shopOrderNo}(${shopOrder.shopOrderID})</span>
-        <span><label>子订单金额:</label><fmt:formatNumber value="${shopOrder.realPay}" type="currency"/></span>
-        <c:if test="${shopOrder.postFeeCos eq '0'}">
-            <div class="print-wrapper">
-                <a href="${ctx}/order/printOrder?shopOrderID=${shopOrder.shopOrderID}">打印</a>
-                <a href="${ctx}/order/exportSubOrder?shopOrderID=${shopOrder.shopOrderID}">导出</a>
-                <c:if test="${order.status ne '0'}">
-                    <a onclick="copyText('${shopOrder.shopOrderID}')" style="cursor:pointer;">供应商订单二维码</a>
-                </c:if>
-                <c:if test="${shopOrder.orderArchiveId ne null}">
-                    <a href="${ctx}/archive/cmOrderArchive/form?id=${shopOrder.orderArchiveId}">查看订单资料</a>
-                </c:if>
-                <c:if test="${order.onlinePayFlag eq 0}">
-                    <c:if test="${order.status == 12 || order.status == 13 || order.status == 21 || order.status == 22 || order.status == 23 || order.status == 31 || order.status == 32 || order.status == 33 || order.status == 4 || order.status == 5}">
-                        <%--  返佣订单不能申请退款(退货) --%>
-                        <c:if test="${order.rebateOrder == '0'}">
-                            <c:if test="${order.toAudit eq 1}">
-                                <%--如果存在审核收款则不允许申请:1不能申请,其它可以申请--%>
-                                <c:if test="${order.toAudit eq 1}">
-                                    <%--弹窗提示--%>
-                                    <a href="#" onclick="return alertx('订单存在未审核的收款,暂不能退款。请将收款审核通过后再操作退款。')">申请退款</a>
-                                </c:if>
-                            </c:if>
-                            <c:if test="${order.toAudit ne 1}">
-                                <c:if test="${order.applyReturnedPurchaseFlag eq 1}">
-                                    <a href="${ctx}/bulkpurchase/cmRefundsProduct/applyRefound.rpc?orderID=${order.orderID}&onlineShopOrderId=${shopOrder.shopOrderID}&refundType=1"
-                                       <c:if test="${order.status == 21 || order.status == 22 || order.status == 23}">onclick="return confirmx('部分收款的订单、申请退款只能申请全部退款!', this.href)"
-                                    </c:if>
-                                    >申请退款</a>
-                                </c:if>
-                                <c:if test="${order.applyReturnedPurchaseFlag ne 1}">
-                                    <font title="存在未处理完的申请,请前往退款列表处理!">申请退款</font>
-                                </c:if>
-                            </c:if>
+        <span><label>子订单金额:</label><fmt:formatNumber
+                value="${order.onlinePayFlag eq 0?shopOrder.realPay:shopOrder.needPayAmount}" type="currency"/></span>
+        <td style="position: relative;"><a class="operation-btn btn"
+                                           onclick="operation(${shopOrder.shopOrderID})">功能</a>
+            <div style="position: relative;">
+                <div class="operation-block ${shopOrder.shopOrderID}">
+                    <shiro:hasPermission name="order:order:edit">
+                        <%--包含订单充值商品就不显示--%>
+                        <c:if test="${shopOrder.status == 0}">
+                            <a href="${ctx}/order/confirmOrder?orderID=${order.orderID}&shopOrderID=${shopOrder.shopOrderID}&orderType=2"
+                               onclick="return confirmx('是否确认订单?', this.href)">确认订单</a>
                         </c:if>
-                    </c:if>
-                </c:if>
+                    </shiro:hasPermission>
+
+
+                    <shiro:hasPermission name="order:order:edit">
+                        <%--包含订单充值商品就不显示--%>
+                        <a href="${ctx}/order/logisticsDetails?orderID=${order.orderID}&shopOrderID=${shopOrder.shopOrderID}&orderType=2">发货记录</a>
+                        <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${order.orderID}&shopOrderID=${shopOrder.shopOrderID}&from=2&orderType=2">收付款记录</a>
+                        <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRecturnRecordByOrderID.rpc?orderID=${order.orderID}&shopOrderID=${shopOrder.shopOrderID}&orderType=2">退款(退货)记录</a>
+                        <a href="${ctx}/order/cmOrderRemark/remarksViewNew.rpc?orderID=${order.orderID}&source=2&shopOrderID=${shopOrder.shopOrderID}&orderType=2">订单备注</a>
+                    </shiro:hasPermission>
+                </div>
             </div>
-        </c:if>
-        <c:if test="${order.onlinePayFlag eq 0}">
-            <br/>
-            <span><label>商品总额:</label><fmt:formatNumber value="${shopOrder.needPayAmount}" type="currency"/></span>
-            <span><label>优惠:</label><fmt:formatNumber value="${shopOrder.eachDiscount}" type="currency"/></span>
-            <span><label>应付金额:</label><fmt:formatNumber value="${shopOrder.realPay}" type="currency"/></span>
-            <span><label>已付金额:</label><fmt:formatNumber value="${shopOrder.receiptAmount}" type="currency"/></span>
-            <span><label>待付金额:</label><fmt:formatNumber value="${shopOrder.restAmount}" type="currency"/></span>
-            <br/>
-            <span><label>收款状态:</label>
-                    <c:if test="${shopOrder.shopReceiptStatus == 1}">
-                        <font color="red">待收款</font>
-                    </c:if>
-                    <c:if test="${shopOrder.shopReceiptStatus == 2}">
-                        <font color="#ff8c00">部分收款</font>
-                    </c:if>
-                    <c:if test="${shopOrder.shopReceiptStatus == 3}">
-                        <font color="green">已收款</font>
-                    </c:if>
-            </span>
-            <span><label>付款状态:</label>
-                    <c:if test="${shopOrder.payStatus == 1}">
-                        <font color="red">待付款</font>
-                    </c:if>
-                    <c:if test="${shopOrder.payStatus == 2}">
-                        <font color="#ff8c00">部分付款</font>
-                    </c:if>
-                    <c:if test="${shopOrder.payStatus == 3}">
-                        <font color="green">已付款</font>
-                    </c:if>
+        </td>
+        </tr>
+        <span>商品总额:<fmt:formatNumber value="${shopOrder.productAmount}" type="currency"/></span>
+        <span>运费:
+                    ${shopOrder.postageInfo}
             </span>
-            <span><label>发货状态:</label>
-                    <c:if test="${shopOrder.sendOutStatus == 1}">
-                        <font color="red">待发货</font>
-                    </c:if>
-                    <c:if test="${shopOrder.sendOutStatus == 2}">
-                        <font color="#ff8c00">部分发货</font>
-                    </c:if>
-                    <c:if test="${shopOrder.sendOutStatus == 3}">
-                        <font color="green">已发货</font>
-                    </c:if>
+        <span>子订单总额:<fmt:formatNumber value="${shopOrder.totalAmount}" type="currency"/></span>
+            <%--        <span>优惠:<fmt:formatNumber value="${shopOrder.eachDiscount}" type="currency"/></span>--%>
+        <span>应收金额:
+            <c:if test="${shopOrder.realPay!=null}"><fmt:formatNumber value="${shopOrder.realPay}"
+                                                                      type="currency"/></c:if>
+            <c:if test="${shopOrder.realPay==null}"><fmt:formatNumber value="${shopOrder.needPayAmount}"
+                                                                      type="currency"/></c:if>
+        </span>
+        <span>
+                已收金额:<fmt:formatNumber value="${shopOrder.receiptAmount}" type="currency"/>
+                <c:if test="${shopOrder.useBalanceFlag eq 1 and shopOrder.accountAmount ne null}">(余额抵扣¥${shopOrder.accountAmount})</c:if>
+<%--                <c:if test="${order.organizeID != 4&&shopOrder.commercialCode eq 'E1807059160' && (order.receiptStatus == 2 || order.receiptStatus == 3)}">--%>
+<%--                    <font color="red">(采美信息线上收款)</font>--%>
+<%--                </c:if>--%>
+
             </span>
-            <c:if test="${not empty shopOrder.note}">
-                <span>留言:${shopOrder.note}</span>
-            </c:if>
-        </c:if>
-        <c:if test="${order.onlinePayFlag eq 1}">
-            <c:if test="${shopOrder.postFeeCos eq '0'}">
-                <c:if test="${order.status ne 0 && order.status ne 11}">
-                    <div class="delivery-wrapper">
-                            <span>发货状态:
-                                <c:if test="${shopOrder.sendOutStatus == 1}">
-                                    <font color="red">待发货</font>
-                                </c:if>
-                                <c:if test="${shopOrder.sendOutStatus == 2}">
-                                    <font color="#ff8c00">部分发货</font>
+        <span>待收金额:<fmt:formatNumber value="${shopOrder.restAmount}" type="currency"/></span>
+        <br/>
+        <span>子订单状态:
+ <c:if test="${shopOrder.status eq 11 || shopOrder.status eq 12 || shopOrder.status eq 13 ||shopOrder.status eq 21 ||shopOrder.status eq 22 ||
+				shopOrder.status eq 23 || shopOrder.status eq 31 ||shopOrder.status eq 32 ||shopOrder.status eq 33}">
+     交易中
+ </c:if>
+<%--            <c:if test="${shopOrder.status eq 0 || shopOrder.status eq 4 || shopOrder.status eq 5 || shopOrder.status eq 6 || shopOrder.status eq 7}">--%>
+<%--                ${fns:getDictLabel(shopOrder.status,"order_status","" )}--%>
+<%--                <c:if test="${shopOrder.status eq 0}">--%>
+<%--                    <span id="time" style="color: red"></span>--%>
+<%--                </c:if>--%>
+<%--                <c:if test="${shopOrder.status eq 6}">--%>
+<%--                    <font color="red">(--%>
+<%--                            <c:if test="${shopOrder.closeTime ne null}">--%>
+<%--                                ${shopOrder.closeTime}--%>
+<%--                            </c:if>--%>
+<%--                            <c:if test="${shopOrder.closeReason ne null}">--%>
+<%--                                , ${shopOrder.closeReason}--%>
+<%--                            </c:if>--%>
+<%--                    )</font>--%>
+<%--                </c:if>--%>
+<%--            </c:if>--%>
+<%--            订单状态 0:待确认 1:已确认 2:交易完成 3:订单完成 4:已关闭 5:交易全退--%>
+                            <c:if test="${shopOrder.status == 0}">
+                                <font color="red">待确认</font>
+                            </c:if>
+                            <c:if test="${shopOrder.status == 1}">
+                                <font color="red">已确认</font>
+                            </c:if>
+                            <c:if test="${shopOrder.status == 2}">
+                                <font color="red">交易完成</font>
+                            </c:if>
+                            <c:if test="${shopOrder.status == 3}">
+                                <font color="red">订单完成</font>
+                            </c:if>
+                            <c:if test="${shopOrder.status == 4}">
+                                <font color="red">已关闭</font>
+                            </c:if>
+                            <c:if test="${shopOrder.status == 5}">
+                                <font color="red">交易全退</font>
+                            </c:if>
+
+                        </span>
+        <span>收款状态:
+                            <c:if test="${shopOrder.shopReceiptStatus == 1}">
+                                <font color="red">待收款</font>
+                            </c:if>
+                            <c:if test="${shopOrder.shopReceiptStatus == 2}">
+                                <font color="#ff8c00">部分收款</font>
+                            </c:if>
+                            <c:if test="${shopOrder.shopReceiptStatus == 3}">
+                                <font color="green">已收款</font>
+                            </c:if>
+                        </span>
+
+        <span>发货状态:
+                            <c:if test="${shopOrder.sendOutStatus == 1}">
+                                <font color="red">待发货</font>
+                            </c:if>
+                            <c:if test="${shopOrder.sendOutStatus == 2}">
+                                <font color="#ff8c00">部分发货</font>
+                            </c:if>
+                            <c:if test="${shopOrder.sendOutStatus == 3}">
+                                <font color="green">已发货</font>
+                            </c:if>
+                        </span>
+        <span>付款状态:
+                            <c:if test="${shopOrder.payStatus == 1}">
+                                <font color="red">待付款</font>
+                            </c:if>
+                            <c:if test="${shopOrder.payStatus == 2}">
+                                <font color="#ff8c00">部分付款</font>
+                            </c:if>
+                            <c:if test="${shopOrder.payStatus == 3}">
+                                <font color="green">已付款</font>
+                            </c:if>
+                        </span>
+        <span>
+                                退款状态:
+                                <c:if test="${shopOrder.refundStatus == 1}">
+                                    <font>无退款</font>
                                 </c:if>
-                                <c:if test="${shopOrder.sendOutStatus == 3}">
-                                    <font color="green">已发货</font>
+<%--                                <c:if test="${shopOrder.refundStatus == 2}">--%>
+<%--                                    <font>退款中</font>--%>
+<%--                                </c:if>--%>
+<%--                                <c:if test="${shopOrder.orderStatusFlag == 2}">--%>
+<%--                                    <font>部分退款</font>--%>
+<%--                                </c:if>--%>
+                                <c:if test="${shopOrder.refundStatus == 3}">
+                                    <font>已退款</font>
                                 </c:if>
                             </span>
-                        <span>付款状态:<c:if test="${shopOrder.payStatus == 1}">
-                            <font color="red">待付款</font>
-                        </c:if>
-                                            <c:if test="${shopOrder.payStatus == 2}">
-                                                <font color="#ff8c00">部分付款</font>
-                                            </c:if>
-                                            <c:if test="${shopOrder.payStatus == 3}">
-                                                <font color="green">已付款</font>
-                                            </c:if></span>
-                        <c:if test="${shopOrder.payStatus == 3 or shopOrder.payStatus == 2}">
-                                    <span>已付金额: <fmt:formatNumber value="${shopOrder.payed}" type="currency"/>
-                                    </span>
-                        </c:if>
-                    </div>
-                </c:if>
-                <c:if test="${not empty shopOrder.note}">
-                    <div><label>留言:</label>${shopOrder.note}</div>
-                </c:if>
-            </c:if>
+        <c:if test="${not empty shopOrder.note}">
+            <span>留言:${shopOrder.note}</span>
         </c:if>
+            <%--        </c:if>--%>
     </div>
 
     <div class="order-rows">

+ 44 - 44
src/main/webapp/WEB-INF/views/modules/hehe/heheNewOrderList.jsp

@@ -943,23 +943,23 @@
             <li>${order.orderTime}</li>
             <li class="operation-wrap">
                 <a href="${ctx}/hehe/new/order/detail?id=${order.orderID}">查看详情</a>
-                <a class="operation-btn">功能</a>
-                <div class="operation-block">
-                    <shiro:hasPermission name="order:order:edit">
-                        <%--包含订单充值商品就不显示--%>
-                        <c:if test="${empty order.rechargeGoods}">
-                            <c:if test="${order.status == 11 || order.status == 12 || order.status == 21 || order.status == 22 || order.status == 31 || order.status == 32}">
-                                <a href="${ctx}/order/toDeliveryPage?id=${order.orderID}">发货</a>
-                            </c:if>
-                            <c:if test="${order.receiptStatus == 2 && order.status != 6 && order.status != 7}">
-                                <a href="javascript:void(0);" onclick="collection(${order.orderID})">抹平收款</a>
-                            </c:if>
-                        </c:if>
-                        <c:if test="${(order.organizeID == 0 or order.organizeID > 2) && order.status == 11 && order.payStatus == 1}">
-                            <a href="javascript:void(0);"
-                               onclick="modelShow('${order.orderID}')">编辑经理折扣</a>
-                        </c:if>
-                    </shiro:hasPermission>
+<%--                <a class="operation-btn">功能</a>--%>
+<%--                <div class="operation-block">--%>
+<%--                    <shiro:hasPermission name="order:order:edit">--%>
+<%--                        &lt;%&ndash;包含订单充值商品就不显示&ndash;%&gt;--%>
+<%--                        <c:if test="${empty order.rechargeGoods}">--%>
+<%--                            <c:if test="${order.status == 11 || order.status == 12 || order.status == 21 || order.status == 22 || order.status == 31 || order.status == 32}">--%>
+<%--                                <a href="${ctx}/order/toDeliveryPage?id=${order.orderID}">发货</a>--%>
+<%--                            </c:if>--%>
+<%--                            <c:if test="${order.receiptStatus == 2 && order.status != 6 && order.status != 7}">--%>
+<%--                                <a href="javascript:void(0);" onclick="collection(${order.orderID})">抹平收款</a>--%>
+<%--                            </c:if>--%>
+<%--                        </c:if>--%>
+<%--                        <c:if test="${(order.organizeID == 0 or order.organizeID > 2) && order.status == 11 && order.payStatus == 1}">--%>
+<%--                            <a href="javascript:void(0);"--%>
+<%--                               onclick="modelShow('${order.orderID}')">编辑经理折扣</a>--%>
+<%--                        </c:if>--%>
+<%--                    </shiro:hasPermission>--%>
 
 <%--                    <shiro:hasPermission name="order:order:applyrefound">--%>
 <%--                        <c:if test="${order.status == 12 || order.status == 13 || order.status == 21 || order.status == 22 || order.status == 23 || order.status == 31 || order.status == 32 || order.status == 33 || order.status == 4 || order.status == 5}">--%>
@@ -988,33 +988,33 @@
 <%--                        </c:if>--%>
 <%--                    </shiro:hasPermission>--%>
 
-                    <shiro:hasPermission name="order:order:edit">
-                        <c:if test="${order.status == 0 || order.status == 11}">
-                            <a href="${ctx}/hehe/new/order/cancelOrder?orderID=${order.orderID}"
-                               onclick="return confirmx('是否取消订单?', this.href)">取消订单</a>
-                        </c:if>
-                        <c:if test="${order.status ne 0}">
-                            <a href="${ctx}/order/printOrder?orderID=${order.orderID}">打印发货单</a>
-                        </c:if>
-                        <%--<a href="/">供应商链接</a>--%>
-                        <a href="${ctx}/order/exportOrder?id=${order.orderID}">订单导出</a>
-                        <a href="${ctx}/order/cmOrderRemark/remarksViewNew.rpc?orderID=${order.orderID}&source=1&orderType=2">订单备注</a>
-                        <%--包含订单充值商品就不显示--%>
-                        <c:if test="${empty order.rechargeGoods}">
-                            <c:if test="${order.status ne 0 && order.status ne 11 && order.status ne 21 && order.status ne 6 && order.status ne 4}">
-                                <a href="${ctx}/order/logisticsDetails?orderID=${order.orderID}&orderType=2">发货记录</a>
-                            </c:if>
-                            <c:if test="${order.status ne 0 && order.status ne 11 && order.status ne 6}">
-                                <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${order.orderID}&from=1">收退款记录
-                                </a>
-                            </c:if>
-                            <c:if test="${order.status ne 0 && order.status ne 11 && order.status ne 6}">
-                                <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRecturnRecordByOrderID.rpc?orderID=${order.orderID}">退款(退货)记录
-                                </a>
-                            </c:if>
-                        </c:if>
-                    </shiro:hasPermission>
-                </div>
+<%--                    <shiro:hasPermission name="order:order:edit">--%>
+<%--                        <c:if test="${order.status == 0 || order.status == 11}">--%>
+<%--                            <a href="${ctx}/hehe/new/order/cancelOrder?orderID=${order.orderID}"--%>
+<%--                               onclick="return confirmx('是否取消订单?', this.href)">取消订单</a>--%>
+<%--                        </c:if>--%>
+<%--                        <c:if test="${order.status ne 0}">--%>
+<%--                            <a href="${ctx}/order/printOrder?orderID=${order.orderID}">打印发货单</a>--%>
+<%--                        </c:if>--%>
+<%--                        &lt;%&ndash;<a href="/">供应商链接</a>&ndash;%&gt;--%>
+<%--                        <a href="${ctx}/order/exportOrder?id=${order.orderID}">订单导出</a>--%>
+<%--                        <a href="${ctx}/order/cmOrderRemark/remarksViewNew.rpc?orderID=${order.orderID}&source=1&orderType=2">订单备注</a>--%>
+<%--                        &lt;%&ndash;包含订单充值商品就不显示&ndash;%&gt;--%>
+<%--                        <c:if test="${empty order.rechargeGoods}">--%>
+<%--                            <c:if test="${order.status ne 0 && order.status ne 11 && order.status ne 21 && order.status ne 6 && order.status ne 4}">--%>
+<%--                                <a href="${ctx}/order/logisticsDetails?orderID=${order.orderID}&orderType=2">发货记录</a>--%>
+<%--                            </c:if>--%>
+<%--                            <c:if test="${order.status ne 0 && order.status ne 11 && order.status ne 6}">--%>
+<%--                                <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${order.orderID}&from=1">收退款记录--%>
+<%--                                </a>--%>
+<%--                            </c:if>--%>
+<%--                            <c:if test="${order.status ne 0 && order.status ne 11 && order.status ne 6}">--%>
+<%--                                <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRecturnRecordByOrderID.rpc?orderID=${order.orderID}">退款(退货)记录--%>
+<%--                                </a>--%>
+<%--                            </c:if>--%>
+<%--                        </c:if>--%>
+<%--                    </shiro:hasPermission>--%>
+<%--                </div>--%>
             </li>
         </ul>
     </c:forEach>

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/hehe/userActivityProductList.jsp

@@ -183,4 +183,4 @@
     }
 </script>
 </body>
-</html>
+</html>

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/order/cmOrderRemarksFormNew.jsp

@@ -36,7 +36,7 @@
 			</c:if>
 		</c:if>
 		<c:if test="${source eq 2}">
-			<li><a href="${ctx}/order/detail?id=${orderID}">订单详情</a></li>
+			<li><a href="${ctx}${orderType == 2 ?'/hehe/new':''}/order/detail?id=${orderID}">订单详情</a></li>
 		</c:if>
 		<li class="active"><a href="${ctx}/order/cmOrderRemark/remarksViewNew.rpc?orderID=${orderID}&source=${source}&orderType=${orderType}">订单备注</a></li>
 		<li><a href="${ctx}/order/cmOrderRemark/toAddRemarksViewNew.rpc?orderID=${orderID}&shopOrderID=${shopOrderID}&source=${source}&orderType=${orderType}">添加订单备注</a></li>

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/order/cmReturnedPurchaseList.jsp

@@ -224,7 +224,7 @@
 <%--							</shiro:hasPermission>--%>
 <%--					</c:if>--%>
 					<%--审核通过---{撤销}--%>
-					<c:if test="${cmReturnedPurchase.status eq 2}">
+					<c:if test="${cmReturnedPurchase.status eq 2&&orderType!=2}">
 						<%--线上退款,不可撤销--%>
 						<c:if test="${empty cmReturnedPurchase.refundOnlineFee || cmReturnedPurchase.refundOnlineFee eq 0 }">
 							<shiro:hasPermission name="order:cmReturnedPurchase:chexiao">

+ 23 - 23
src/main/webapp/WEB-INF/views/modules/order/orderDetail.jsp

@@ -612,29 +612,29 @@
         </td>
     </tr>
     <tr>
-        <c:if test="${order.organizeID != 4}">
-            <td>
-                经理折扣:
-                <c:if test="${order.discountFee gt 0}">
-                    <c:if test="${order.discountFee gt returnedPurchaseFee}">
-                        <fmt:formatNumber value="${order.discountFee - returnedPurchaseFee}" type="currency"/>
-                    </c:if>
-                    <c:if test="${order.discountFee le returnedPurchaseFee}">
-                        ¥0.00
-                    </c:if>
-                    <span style="color: red">
-                        (原<fmt:formatNumber value="${order.discountFee}" type="currency"/>,折扣取消
-                        <c:if test="${order.discountFee gt returnedPurchaseFee}">
-                            <fmt:formatNumber value="${returnedPurchaseFee}" type="currency"/>
-                        </c:if>
-                        <c:if test="${order.discountFee le returnedPurchaseFee}">
-                            <fmt:formatNumber value="${order.discountFee}" type="currency"/>
-                        </c:if>)
-                    </span>
-                </c:if>
-                <c:if test="${order.discountFee le 0}">¥0.00</c:if>
-            </td>
-        </c:if>
+<%--        <c:if test="${order.organizeID != 4}">--%>
+<%--            <td>--%>
+<%--                经理折扣:--%>
+<%--                <c:if test="${order.discountFee gt 0}">--%>
+<%--                    <c:if test="${order.discountFee gt returnedPurchaseFee}">--%>
+<%--                        <fmt:formatNumber value="${order.discountFee - returnedPurchaseFee}" type="currency"/>--%>
+<%--                    </c:if>--%>
+<%--                    <c:if test="${order.discountFee le returnedPurchaseFee}">--%>
+<%--                        ¥0.00--%>
+<%--                    </c:if>--%>
+<%--                    <span style="color: red">--%>
+<%--                        (原<fmt:formatNumber value="${order.discountFee}" type="currency"/>,折扣取消--%>
+<%--                        <c:if test="${order.discountFee gt returnedPurchaseFee}">--%>
+<%--                            <fmt:formatNumber value="${returnedPurchaseFee}" type="currency"/>--%>
+<%--                        </c:if>--%>
+<%--                        <c:if test="${order.discountFee le returnedPurchaseFee}">--%>
+<%--                            <fmt:formatNumber value="${order.discountFee}" type="currency"/>--%>
+<%--                        </c:if>)--%>
+<%--                    </span>--%>
+<%--                </c:if>--%>
+<%--                <c:if test="${order.discountFee le 0}">¥0.00</c:if>--%>
+<%--            </td>--%>
+<%--        </c:if>--%>
         <%--        <td>运费:--%>
         <%--            <c:if test="${order.organizeID != 4}">--%>
         <%--                <c:if test="${order.freePostFlag == 0}">--%>