<?php
/**
 * 销售订单统计Dao
 * Created by PhpStorm.
 * User: 小威
 * Date: 2019/12/30
 * Time: 16:00
 */

namespace JinDouYun\Dao\Order;

use JinDouYun\Dao\BaseDao;

class DOrderStatistics extends BaseDao
{
    public function __construct($serviceDB = 'default')
    {
        $this->_table = 'order_statistics';
        $this->_primary = 'id';
        $this->_fields = [
            "id", //int(10) NOT NULL AUTO_INCREMENT COMMENT '自增id',
            "orderId", //int(10) NOT NULL COMMENT '订单id',
            "orderNo", //int(10) NOT NULL COMMENT '订单no',
            "shopId", //int(10) NOT NULL COMMENT '商铺id',
            "shopName", //varchar(50) NOT NULL COMMENT '商铺名称',
            "outerTradeNo", //varchar(255) NOT NULL DEFAULT '' COMMENT '外部流水号(支付宝/微信返回的流水号)',
            "totalMoney", //decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '总金额',
            "payAmount", //decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '实付金额',
            "buyTotal", //int(10) NOT NULL DEFAULT '0' COMMENT '购买总数',
            "customerName", //varchar(50) NOT NULL COMMENT '客户姓名',
            "customerId", //int(10) NOT NULL COMMENT '客户id',
            "payStatus", //tinyint(3) NOT NULL DEFAULT '4' COMMENT '支付状态  默认 4未支付 5已支付',
            "orderStatus", //tinyint(3) NOT NULL DEFAULT '2' COMMENT '订单状态 默认 2待支付 3代发货 4待收货 5已完成 6已关闭',
            "payType", //tinyint(3) NOT NULL COMMENT '支付方式 1微信 2支付宝 3货到付款 4上门自提',
            "deliveryType", //tinyint(3) NOT NULL COMMENT '配送方式 1商品配送 2上门自提',
            "source", //tinyint(3) NOT NULL COMMENT '订单来源 默认1 ios 2android 3小程序 4后台创建',
            "remark", //varchar(255) NOT NULL DEFAULT '' COMMENT '订单备注',
            "deleteStatus", //tinyint(3) NOT NULL DEFAULT '5' COMMENT '是否删除  默认5 正常 4删除',
            "auditStatus", //tinyint(3) NOT NULL DEFAULT '1' COMMENT '审核状态 默认1 待审 2审核通过 3 审核未通过 4 审核中',
            "returnStatus", //tinyint(3) NOT NULL DEFAULT '0' COMMENT '退货状态 0:未退货 1:部分退货 2:全部退货',
            "outStatus", //tinyint(3) NOT NULL COMMENT '出库状态 4:未出库 5:已出库',
            "payTime", //int(10) NOT NULL DEFAULT '0' COMMENT '付款时间',
            "createTime", //int(10) NOT NULL DEFAULT '0' COMMENT '创建时间',
            "updateTime", //int(10) NOT NULL DEFAULT '0' COMMENT '更新时间',
            "orderPreferentialActivityId", //int(10) NOT NULL DEFAULT '0' COMMENT '店铺优惠活动id',
            "salesManId", //int(10) NOT NULL DEFAULT '0' COMMENT '业务员id',
            "salesManName", //varchar(255) NOT NULL COMMENT '业务员名称',
            "customerType", //tinyint(3) NOT NULL COMMENT '客户类型',
            "userCenterId", //int(10) NOT NULL DEFAULT '0' COMMENT 'userCenterId',
            "detailsId", //int(10) NOT NULL COMMENT '详情id',
            "goodsCode", //varchar(255) NOT NULL DEFAULT '' COMMENT '商品编号',
            "goodsId", //int(10) NOT NULL DEFAULT '0' COMMENT '商品Id',
            "goodsName", //varchar(50) NOT NULL DEFAULT '' COMMENT '商品名称',
            "categoryId", // int(10) NOT NULL COMMENT '分类id',
            "categoryName", // varchar(50) NOT NULL COMMENT '分类名称',
            "originPrice", //decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '原始单价',
            "detailsBuyNum", //int(10) NOT NULL DEFAULT '0' COMMENT '购买数量',
            "preferential", //decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '每/优惠',
            "deliverNum", //int(10) NOT NULL DEFAULT '0' COMMENT '发货数量',
            "detailsTotalMoney", //decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '小计金额',
            "detailsDeleteStatus", //tinyint(3) NOT NULL DEFAULT '5' COMMENT '是否删除  默认5 正常 4删除',
            "detailsReturnStatus", //tinyint(3) NOT NULL COMMENT '退货状态 0:未退货 1:已退货',
            "detailsCreateTime", //int(10) NOT NULL DEFAULT '0' COMMENT '创建时间',
            "detailsUpdateTime", //int(10) NOT NULL DEFAULT '0' COMMENT '更新时间',
            "detailsPreferentialActivityId", //int(10) NOT NULL DEFAULT '0' COMMENT '店铺优惠活动id',
            "goodsBasicId", //int(10) NOT NULL COMMENT 'goodsBasicId',
            "skuId",
            "unitName", //varchar(50) NOT NULL COMMENT '单位名称',
            "conversion", //decimal(10,2) NOT NULL COMMENT '换算比率',
        ];
        $this->_readonly = ['id'];
        $this->_create_autofill = [
            'createTime' => time()
        ];
        $this->_update_autofill = [
            'updateTime' => time()
        ];

        parent::__construct($serviceDB);
    }
}