<?php
/**
 * 订单商品详情Dao
 * Created by PhpStorm.
 * User: XiaoMing
 * Date: 2019/10/31
 * Time: 16:04
 */

namespace JinDouYun\Dao\Order;

use JinDouYun\Dao\BaseDao;

class DOrderGoods extends BaseDao
{
    public function __construct($serviceDB = 'default')
    {
        $this->_table = 'order_goods';
        $this->_primary = 'id';
        $this->_fields = [
            "id", //int(10) NOT NULL AUTO_INCREMENT,
            "no", //char(25) NOT NULL COMMENT '订单编号',
            "orderId", //int(10) NOT NULL DEFAULT '0' 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 '商品名称',
            "shopId", //int(10) NOT NULL DEFAULT '0' COMMENT '商铺Id',
            "shopName", //varchar(50) NOT NULL DEFAULT '' COMMENT '商铺名称',
            "merchantId", //int(10) DEFAULT NULL COMMENT '商户id',
            "originPrice", //decimal(12,2) DEFAULT '0.00' COMMENT '原始单价',
            "price", //decimal(12,2) DEFAULT '0.00' COMMENT '商品单价',
            "buyNum", //double(10,4) NOT NULL DEFAULT '0.0000' COMMENT '购买数量',
            "otherNum", //decimal(10,4) NOT NULL DEFAULT '0.0000' COMMENT '其他单位数量',
            "preferential", //decimal(12,2) DEFAULT '0.00' COMMENT '优惠券优惠金额',
            "totalMoney", //decimal(12,2) DEFAULT '0.00' COMMENT '小计金额',
            "deliverNum", //decimal(10,4) NOT NULL DEFAULT '0.0000' COMMENT '发货数量',
            "extends", //json DEFAULT NULL COMMENT '拓展字段',
            "deleteStatus", //tinyint(3) NOT NULL DEFAULT '5' COMMENT '是否删除  默认5 正常 4删除',
            "returnStatus", //tinyint(3) DEFAULT '0' COMMENT '退货状态 0:未退货 1:已退货',
            "createTime", //int(10) NOT NULL DEFAULT '0' COMMENT '创建时间',
            "updateTime", //int(10) NOT NULL DEFAULT '0' COMMENT '更新时间',
            "preferentialActivityId", //int(10) DEFAULT '0' COMMENT '店铺优惠活动id',
            "skuId", //int(10) DEFAULT NULL COMMENT 'skuid',
            "goodsBasicId", //int(10) DEFAULT NULL COMMENT 'goodsBasicId',
            "unitName", //varchar(50) DEFAULT NULL COMMENT '单位名称',
            "conversion", //decimal(10,2) DEFAULT NULL COMMENT '换算比率',
            "outCostPrice", //decimal(10,2) DEFAULT NULL COMMENT '成本',
            "outNum", //decimal(10,4) DEFAULT '0.0000' COMMENT '出库数量',
            "outOfNum", //decimal(10,4) DEFAULT '0.0000' COMMENT '未出库数量',
            "outStatus", //tinyint(1) DEFAULT NULL COMMENT '出库状态 1:未出库 2:全部出库 3:部分出库',
            "vipDiscount", //decimal(12,2) DEFAULT '0.00' COMMENT '会员卡优惠金额',
            "categoryPath", //varchar(50) DEFAULT '' COMMENT '分类路径',
            "isGiveaway", //tinyint(1) NOT NULL DEFAULT '4' COMMENT '是否赠品 4:否 5:是',
            "brandId", //int(5) DEFAULT '0' COMMENT '品牌id',
            "specGroup", //json DEFAULT NULL COMMENT '规格明细',
            "goodsImages", //varchar(255) DEFAULT '' COMMENT '商品图',
            "categoryName", //varchar(255) DEFAULT '' COMMENT '分类名称',
            "brandName", //varchar(255) DEFAULT '' COMMENT '品牌名称',
            "barCode", //char(50) DEFAULT '' COMMENT '商品条码',
            "storageCode", //varchar(50) DEFAULT '' COMMENT '商品货架编码',
            "activityExt", //json DEFAULT NULL COMMENT '商品活动数据',
            "expressMoney", //decimal(10,2) DEFAULT '0.00' COMMENT '运费',
            "isEq", //tinyint(3) DEFAULT '4' COMMENT '是否是超码商品',
        ];
        $this->_readonly = ['id'];
        $this->_create_autofill = [
            'createTime' => time()
        ];
        $this->_update_autofill = [
            'updateTime' => time()
        ];

        parent::__construct($serviceDB);
    }
}