<?php
/*
|--------------------------------------------------------------------------
| admin.php 管理员表
|--------------------------------------------------------------------------
*/

return array
(
	# 表名
	'name' => 'admin_role',
	# 显示给用户看的名称
	'lang' => '管理员角色关联表',
	'menu' => false,

	# 数据结构
	'struct' => array
	(
		'id' 		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> 'ID',
			'default' 	=> '',
			'desc' 		=> '',
			'match' 	=> 'is_numeric',
			'search'	=> 'order',
			'list'		=> true,
		),
		
		'admin_id'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '管理员ID',
			'default' 	=> '',
			'desc' 		=> '管理员ID',
			'match' 	=> 'is_numeric',
			'update'	=> 'text',
			'list'		=> true,
		),

		'role_id'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '角色ID',
			'default' 	=> '',
			'desc' 		=> '角色ID',
			'match' 	=> 'is_numeric',
			'update'	=> 'text',
			'list'		=> true,
		),
		
		'cdate'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '录入时间',
			'match' 	=> array('is_numeric', DEVER_TIME),
			'desc' 		=> '',
			# 只有insert时才生效
			'insert'	=> true,
			'list'		=> 'date("Y-m-d H:i:s", {cdate})',
		),
	),

	# request 请求接口定义
	'request' => array
	(
		'*getTest' => array
		(
			'where' => array
			(
				'id' => 'yes',
			),
			'type' => 'one',

			#join为临时解决方案，不建议用join，建议用relate，join仅支持mysql
			
			# 联表
			'join' => array
			(
				array
				(
					'table' => 'manage/admin',
					'type' => 'left join',
					'on' => array('admin_id','id'),
					'col' => 'username',
				),
			),

			# 检索相关的数据
			'relate' => array
			(
				'manage/admin-one' => array
				(
					'option_id' => 'admin_id'
				),
			),
		),

		# query测试
		'*getTest1' => array
		(
			'query' => 'select * from {table} where id = ?',
			'type' => 'one',
		),
	)
);
