<?php
/**
 * 部门管理Dao
 * Created by PhpStorm.
 * User: 小威
 * Date: 2019/10/31
 * Time: 17:00
 */

namespace JinDouYun\Dao\Department;

use JinDouYun\Dao\BaseDao;

class DDepartment extends BaseDao
{
    public function __construct($serviceDB = 'default')
    {
        $this->_table = 'department';
        $this->_primary = 'id';
        $this->_fields = [
            "id", //int(10) NOT NULL AUTO_INCREMENT COMMENT '自增id',
            "shopId", //int(10) DEFAULT NULL COMMENT '商铺id',
            "pid", //int(10) NOT NULL DEFAULT '0' COMMENT '上级id 0:为顶级',
            "departmentCode", //varchar(50) DEFAULT NULL COMMENT '部门编码',
            "order", //tinyint(3) NOT NULL COMMENT '排序 默认0 数越大 越靠前',
            "departmentName", //varchar(255) NOT NULL COMMENT '部门名称',
            "desc", //text COMMENT '部门说明/描述',
            "deleteStatus", //tinyint(3) NOT NULL DEFAULT '5' COMMENT '删除状态 4:删除 5:正常',
            "enableStatus", //tinyint(3) NOT NULL DEFAULT '4' COMMENT '启用状态 4:未启用 5:已启用',
            "createTime", //int(10) DEFAULT NULL COMMENT '创建时间',
            "updateTime", //int(10) DEFAULT NULL COMMENT '更新时间',
            "extend", //json DEFAULT NULL COMMENT '扩展字段',
            "dept_id", //jint DEFAULT NULL COMMENT '部门id',
        ];
        $this->_readonly = ['id'];
        $this->_create_autofill = [
            'createTime' => time()
        ];
        $this->_update_autofill = [
            'updateTime' => time()
        ];

        parent::__construct($serviceDB);
    }
}