Vue前端字段排序,Spring Boot 集成Mybatis-plus 使用Oracle/MySQL,驼峰映射(下划线)问题

  • Post author:
  • Post category:mysql


问题描述:实现Vue前端页面表格内,各字段都能自定义降序或升序排列展示。

即各字段名后附上小箭头,可用来控制升序或降序排列。

若使用MySQL数据库,只需在Vue前端代码data中,加上 sortable: “custom”

若使用Oracle数据库,除了Vue前端代码中,加上 sortable: “custom”,由于Mybatis映射字段不能将驼峰形式自动转换为下划线形式,如userName—>USER_NAME,则可以考虑后台工具类文件 ‘StringUtil.java’ 加入一个用来转换的方法。

之后在查询获取列表的controller中调用

@GetMapping("/list")
public ResultSet list(MngSysCorpFeeItemInfoQueryRequest request) {

    request.setSidx(StringUtil.toUnderlineCase(request.getSidx()));
    PageInfo<ScsCorpFeeitemInfo> list = sysCorpFeeItemInfoService.queryPage(request);

    return ResultSet.success().put(ParamConstant.PAGE_KEY, list);
}



版权声明:本文为m0_56218757原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。