您的位置:首页 > Web前端 > HTML

html页面中使用thymeleaf模板直接访问后台service

2019-01-16 18:11 585 查看
版权声明:若要转载,请注明出处,谢谢。 https://blog.csdn.net/qq_27985607/article/details/86512326

html部分代码

[code]<li>
活动类型:
<select name="matchRuleType" th:with="type=${@dict.getType('match_rule_type')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictValue}">
</option>
</select>
</li>

 java代码

[code]@Service("dict")
public class DictService
{
@Autowired
private ISysDictDataService dictDataService;

/**
* 根据字典类型查询字典数据信息
*
* @param dictType 字典类型
* @return 参数键值
*/
public List<SysDictData> getType(String dictType)
{
return dictDataService.selectDictDataByType(dictType);
}

/**
* 根据字典类型和字典键值查询字典数据信息
*
* @param dictType 字典类型
* @param dictValue 字典键值
* @return 字典标签
*/
public String getLabel(String dictType, String dictValue)
{
return dictDataService.selectDictLabel(dictType, dictValue);
}
}

 

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐