根据类似外键的设置关联
然后 创建视图 子视图 结构 什么的
最后生成
每个外键当成字段来看
复杂逻辑还是无法实现
模板 = 可使用的目标内容 = 配置提取处
目标
1.
能用来生成 可使用的目标内容
2.
本身就是 可使用的目标内容
3.
能提取出来带替换项
4.
能提取出来配置
一个最高配,一个最低配 代替if功能
1.
写一个标准的功能, 然后把里边的标准的 包名.类名.方法名
package ${package}.controller;
import $.entity.$Entity;
@RestController
@RequestMapping("$")
public class $Controller extends AbstractController {
@Autowired
private $Service $Service;
/**
* 按页面查询
*/
@RequestMapping("/list")
@RequiresPermissions("${classname}:listMy")
public R list(@RequestParam Map<String, Object> params){
#foreach ($column in $columns)
#if($column.columnName == 'owner_id')
if (!ShiroUtils.getSubject().isPermitted("${classname}:listAll"))
params.put("ownerId", super.getUserId());
#end
#end
//查询列表数据
Query query = new Query(params);
List<${className}Entity> ${classname}List = ${classname}Service.queryList(query);
int total = ${classname}Service.queryTotal(query);
PageUtils pageUtil = new PageUtils(${classname}List, total, query.getLimit(), query.getPage());
return R.ok().put("page", pageUtil);
}
@RequestMapping("/getAllForSelect")
public R getAllForSelect(){
List<SelectEntity> list = $Service.getAllForSelect();
return R.ok().put("list", list );
}
@RequestMapping("/delete")
@RequiresPermissions("$:delete")
public R delete(@RequestBody $[] $s){
$Service.deleteBatch($s);
return R.ok();
}
}
<el-table :data="tableData" :header-cell-class-name="handleTheadAddClass"
@header-click="headerClick"
class="table" style="width: 100%;margin-top:30px;"
v-loading="tableLoading"
>
<el-table-column align="center" label="id" prop="id" />
<el-table-column align="center" label="$:1:inputType=text:title" prop="$:1:inputType=text:name" sort-by="$:1:inputType=text:name" sortable="custom" />
<el-table-column align="center" label="$:1:inputType=dict:title" prop="$:1:inputType=dict:name" sort-by="$:1:inputType=dict:name" sortable="custom" >
<template slot-scope="scope">
{{ dict(scope.row.$:1:inputType=dict:name, '$:1:inputType=dict:dictName') }}
</template>
</el-table-column>
<el-table-column align="center" label="到期时间" prop="addTime" />
<el-table-column align="center" label="到期时间" prop="endTime" />
<el-table-column align="center" label="操作" width="150px">
<el-button-group slot-scope="scope">
<el-button @click="showUpdate(scope)" icon="el-icon-edit" size="mini"></el-button>
<el-popconfirm
@onConfirm="Delete(scope)"
cancelButtonText='不用了'
confirmButtonText='好的'
icon="el-icon-info"
iconColor="red"
title="这是一段内容确定删除吗?"
>
<el-button icon="el-icon-delete" size="mini" slot="reference" type="danger"></el-button>
</el-popconfirm>
</el-button-group>
</el-table-column>
</el-table>
<el-table :data="tableData" :header-cell-class-name="handleTheadAddClass"
@header-click="headerClick"
class="table" style="width: 100%;margin-top:30px;"
v-loading="tableLoading"
>
<el-table-column align="center" label="id" prop="id" />
<el-table-column align="center" n-type="text" label="$title1" prop="$name1" sort-by="$name1" sortable="custom" />
<el-table-column align="center" n-type="dict" label="$title2" prop="$name2" sort-by="$name2" sortable="custom" >
<template slot-scope="scope">
{{ dict(scope.row.$name2, '$dictName2') }}
</template>
</el-table-column>
<el-table-column align="center" label="title3" prop="name3" />
<el-table-column align="center" label="操作" width="150px">
<el-button-group slot-scope="scope">
<el-button @click="showUpdate(scope)" icon="el-icon-edit" size="mini"></el-button>
<el-popconfirm
@onConfirm="Delete(scope)"
cancelButtonText='不用了'
confirmButtonText='好的'
icon="el-icon-info"
iconColor="red"
title="这是一段内容确定删除吗?"
>
<el-button icon="el-icon-delete" size="mini" slot="reference" type="danger"></el-button>
</el-popconfirm>
</el-button-group>
</el-table-column>
</el-table>
2.
都用模板语法替换.
3.
这样改起来方便多了,也不用一变模板就要重新生成然后测试.
分支也可以用写多个标准功能,然后 if 和 for 伺候
评论区