FieldFill.java 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright (c) 2011-2014, hubin (jobob@qq.com).
  3. * <p>
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of 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,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.baomidou.mybatisplus.annotation;
  17. /**
  18. * <p>
  19. * 字段填充策略枚举类
  20. * </p>
  21. *
  22. * @author hubin
  23. * @Date 2017-06-27
  24. */
  25. public enum FieldFill {
  26. DEFAULT(0, "默认不处理" ),
  27. INSERT(1, "插入填充字段" ),
  28. UPDATE(2, "更新填充字段" ),
  29. INSERT_UPDATE(3, "插入和更新填充字段" );
  30. /**
  31. * 主键
  32. */
  33. private final int key;
  34. /**
  35. * 描述
  36. */
  37. private final String desc;
  38. FieldFill(final int key, final String desc) {
  39. this.key = key;
  40. this.desc = desc;
  41. }
  42. public static FieldFill getIgnore(int key) {
  43. FieldFill[] fis = FieldFill.values();
  44. for (FieldFill fi : fis) {
  45. if (fi.getKey() == key) {
  46. return fi;
  47. }
  48. }
  49. return FieldFill.DEFAULT;
  50. }
  51. public int getKey() {
  52. return this.key;
  53. }
  54. public String getDesc() {
  55. return this.desc;
  56. }
  57. }