Optimize.java 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /**
  2. * Copyright (c) 2011-2014, hubin (jobob@qq.com).
  3. * <p>
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. * <p>
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. * <p>
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.baomidou.mybatisplus.enums;
  17. /**
  18. * <p>
  19. * Count优化枚举
  20. * </p>
  21. *
  22. * @author Caratacus
  23. * @Date 2016-11-30
  24. */
  25. public enum Optimize {
  26. /**
  27. * 默认支持方式
  28. */
  29. DEFAULT("default", "默认方式"),
  30. /**
  31. * aliDruid,需添加相关依赖jar包
  32. */
  33. ALI_DRUID("aliDruid", "依赖aliDruid模式"),
  34. /**
  35. * jsqlparser方式,需添加相关依赖jar包
  36. */
  37. JSQLPARSER("jsqlparser", "jsqlparser方式");
  38. private final String optimize;
  39. private final String desc;
  40. Optimize(final String optimize, final String desc) {
  41. this.optimize = optimize;
  42. this.desc = desc;
  43. }
  44. /**
  45. * <p>
  46. * 获取优化类型.如果没有找到默认DEFAULT
  47. * </p>
  48. *
  49. * @param optimizeType
  50. * 优化方式
  51. * @return
  52. */
  53. public static Optimize getOptimizeType(String optimizeType) {
  54. for (Optimize optimize : Optimize.values()) {
  55. if (optimize.getOptimize().equalsIgnoreCase(optimizeType)) {
  56. return optimize;
  57. }
  58. }
  59. return DEFAULT;
  60. }
  61. public String getOptimize() {
  62. return this.optimize;
  63. }
  64. public String getDesc() {
  65. return this.desc;
  66. }
  67. }