>[info] 由于时间原因,只做了视图的自动生成,模型和控制器需要手动创建
###数据库
前往mysql管理工具使用命令或可视化功能创建一个test表,结构如下

* * * *
* * * *
##模型
创建模型
~~~
// 关闭自动写入update_time字段
protected $updateTime = false;
public function getTest($keyword = '', $start = 0, $limit = 10){
$data = $this->where(['title'=>['like','%'.$keyword.'%']])->limit($start, $limit)->order('orders ASC')->select();
return $data;
}
public function getPage($limit = 10){
$page = $this->count();
$page = floor($page / $limit);
return $page;
}
~~~
此处代码作用为控制器可以获取数据和分页做准备。

* * * *
* * * *
##控制器
继承base目录下的system类,添加一个gettest方法以及save方法
~~~
public function gettest($p = 1, $keyword = '') {
$test = new Test();
$p = ($p*10) - 10;
$list = $test->getTest($keyword, $p);
$msg['status'] =200;
$msg['data']['list'] = $list;
$msg['pages'] = $test->getPage();
return $msg;
}
public function save() {
if($this->request->isAjax()){
$post_data = $this->request->param();
if(empty($post_data)){return getMsg("数据不能为空");}
$test = new Test();
$state = $test->allowField(true)->save($post_data,$post_data['id']);
if(false == $state){
return getMsg("操作失败");
}
return getMsg("操作成功");
}
}
~~~

* * * *
* * * *
##视图
点击后台的系统-快捷方式-生成列表
1.选择hello mini的目录 test/index/index
2.表格字段按之前数据表中的字段来填,不需要输入id和排序和状态
~~~
我是标题|title|300
作者|author|200
创建时间|create_time|200
~~~
3.json地址:填上面控制器中的gettest()方法的路径,如: test/index/gettest
4.传递数据:留空
5:模型名:Test
6:列表名:测试数据
填完后点击立即生成(此处需要在模块目录创建文件的权限)

回到hello mini ,右键tab选择刷新

列表已经成功生成

