字典列表页面
查询字典类型列表
/** 查询字典类型列表 */
getList() {
this.loading = true;
listType(this.addDateRange(this.queryParams, this.dateRange)).then(
response => {
this.typeList = response.rows;
this.total = response.total;
this.loading = false;
}
);
}
@PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list")
@ResponseBody
public TableDataInfo list(SysDictType dictType)
{
startPage();
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
return getDataTable(list);
}
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
/**
* 根据条件分页查询字典类型
*
* @param dictType 字典类型信息
* @return 字典类型集合信息
*/
@Override
public List<SysDictType> selectDictTypeList(SysDictType dictType)
{
return dictTypeMapper.selectDictTypeList(dictType);
}
执行sql:
select dict_id, dict_name, dict_type, status, create_by, create_time, remark
from sys_dict_type
<where>
<if test="dictName != null and dictName != ''">
AND dict_name like concat('%', #{dictName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="dictType != null and dictType != ''">
AND dict_type like concat('%', #{dictType}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
</if>
</where>
字典类型跳转链接
<el-table-column label="字典类型" align="center">
<template slot-scope="scope">
<router-link :to="'/dict/type/data/' + scope.row.dictId" class="link-type">
<span>{{ scope.row.dictType }}</span>
</router-link>
</template>
</el-table-column>
传入入参dictId字典id,rest风格跳转到对应的字典详情页面
字典详情页面
const dictId = this.$route.params && this.$route.params.dictId;
this.getType(dictId);
this.getTypeList();
this.getDicts("sys_normal_disable").then(response => {
this.statusOptions = response.data;
});
字典列表数据表
字典详情关联数据表