private String getCode() {
        List<String> ptypeCodeList = mapper.findCodeList();
        String code = "";
        for(int i=0;i<ptypeCodeList.size();i++) {
            code = "TY"+i;
            if(!ptypeCodeList.contains(code)) {
                return code;
            }
        }
        return "TY"+ptypeCodeList.size();
    }

这种方法需要遍历数据库,仅适用于数据库中的数据量较小的情况。

相关文章:

  • 2021-07-24
  • 2021-10-27
  • 2021-10-28
  • 2021-07-02
  • 2021-06-08
  • 2022-01-11
  • 2021-12-07
  • 2022-02-06
猜你喜欢
  • 2022-02-10
  • 2021-08-25
  • 2021-09-15
  • 2021-08-13
  • 2021-07-21
  • 2022-12-23
  • 2021-06-21
相关资源
相似解决方案