生成 MySQL-CRUD代码

  • crud

    • 单列表crud

/**
 * 列表页搜索字段
 *
 * @return array
 */
static public function getListPageSearchFields()
{
    return [
        'FType' => '申请类型',
        'FMachineType' => '云主机类型',
        'FDbMemory' => 'DB内存',
        'FDbHardDisk' => '硬盘,单位G',
        'FRedisCapacity' => 'redis容量,单位G',
        'FQqDomain' => 'QQ域名',
        'FStatus' => '状态'
    ];
}

/**
 * 列表页展示字段
 *
 * @return array
 */
static public function getListPageShowFields()
{
    return [
        'FId' => '主键',
        'FType' => '申请类型',
        'FMachineType' => '云主机类型',
        'FDbMemory' => 'DB内存',
        'FDbHardDisk' => '硬盘,单位G',
        'FRedisCapacity' => 'redis容量,单位G',
        'FQqDomain' => 'QQ域名',
        'FQqDomainIps' => 'QQ域名IP,多个以;相隔',
        'FProject' => '申请项目',
        'FStatus' => '状态',
        'FBetaOnlineTime' => '测试上线时间',
        'FProdOnlineTime' => '上线时间',
        'FCreator' => '创建者用户名',
        'FUpdater' => '更新者用户名',
        'FUpdateTime' => '更新时间',
        'FCreateTime' => '创建时间',
        'FIp' => '加入IP'
    ];
}
  • 多列表crud
    • 在业务类定义多列表配置
    • name:sidebar和链接名字(英文)
    • desc:sidebar描述
    • listApiUrl:列表接口地址
    • args:参数,区别其它列表,如果没指定listApiUrl就会在默认地址加上这些参数
    • searchFields:列表可搜索字段map
    • showFields:列表显示的字段
static public function MultiListPages()
{
    return [
        [
            'name' => 'machinelist',
            'desc' => '云主机',
            'listApiUrl' => '/api/apply/list?type=machine&manual=1',
            'args' => [
                'type' => self::TYPE_MACHINE
            ],
            'searchFields' => [
                'FMachineTypeName' => '云主机类型',
                'FProject' => '申请项目',
                'FStatus' => '状态'
            ],
            'showFields' => [
                'FId' => '主键',
                'FMachineTypeName' => '云主机类型',
                'FProject' => '申请项目',
                'FStatus' => '状态',
                'FBetaOnlineTime' => '测试上线时间',
                'FProdOnlineTime' => '上线时间'
            ]
        ],
        [
            'name' => 'dblist',
            'listApiUrl' => '/api/apply/list?type=db',
            'desc' => '数据库',
            'args' => [
                'type' => self::TYPE_DB
            ],
            'searchFields' => [
                'FDbMemory' => 'DB内存',
                'FDbHardDisk' => '硬盘,单位G',
                'FProject' => '申请项目',
                'FStatus' => '状态',
            ],
            'showFields' => [
                'FId' => '主键',
                'FDbMemory' => 'DB内存',
                'FDbHardDisk' => '硬盘,单位G',
                'FProject' => '申请项目',
                'FStatus' => '状态',
                'FBetaOnlineTime' => '测试上线时间',
                'FProdOnlineTime' => '上线时间'
            ]
        ],
    ];
}

results matching ""

    No results matching ""