<?php
/**
 * 库存管理Dao
 * Created by PhpStorm.
 * User: 小威
 * Date: 2019/11/12
 * Time: 10:00
 */

namespace JinDouYun\Dao\Stock;

use JinDouYun\Dao\BaseDao;

class DInventoryWarehouse extends BaseDao
{
    public function __construct($serviceDB = 'stock')
    {
        $this->_table = 'inventory_warehouse';
        $this->_primary = 'id';
        $this->_fields = [
            "id", //int(10) NOT NULL AUTO_INCREMENT COMMENT '自增id',
            "merchantId", //int(10) NOT NULL DEFAULT '0' COMMENT '商户id',
            "materielId", //int(10) NOT NULL COMMENT '物料ID',
            "warehouseId", //int(10) NOT NULL COMMENT '仓库id',
            "materielCode", //varchar(255) DEFAULT NULL COMMENT '物料编码',
            "inventoryNum", //decimal(20,8) NOT NULL COMMENT '库存数',
            "otherNum", //decimal(20,8) DEFAULT '0.00000000' COMMENT '其他单位数量',
            "costPrice", //decimal(15,4) DEFAULT NULL COMMENT '成本价',
            "skuId", //int(10) DEFAULT NULL COMMENT '单位id',
            "sort", //int(10) DEFAULT '0' COMMENT '排序 从小到大',
            "updateTime", //int(10) DEFAULT NULL COMMENT '修改时间',
            "createTime", //int(10) DEFAULT NULL COMMENT '创建时间',
        ];
        $this->_readonly = ['id'];
        $this->_create_autofill = [
            'createTime' => time(),
            'updateTime' => time()
        ];
        $this->_update_autofill = [
            'updateTime' => time()
        ];

        parent::__construct($serviceDB);
    }
}