AbstractSqlParser.java 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /**
  2. * Copyright (c) 2011-2020, 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.parser;
  17. import org.apache.ibatis.logging.Log;
  18. import org.apache.ibatis.logging.LogFactory;
  19. /**
  20. * <p>
  21. * 抽象 SQL 解析类
  22. * </p>
  23. *
  24. * @author hubin
  25. * @Date 2017-06-20
  26. */
  27. public abstract class AbstractSqlParser {
  28. // 日志
  29. protected static final Log logger = LogFactory.getLog(AbstractSqlParser.class);
  30. private String sql;// SQL 语句
  31. private String dbType; // 数据库类型
  32. public AbstractSqlParser(String sql, String dbType) {
  33. this.sql = sql;
  34. this.dbType = dbType;
  35. }
  36. /**
  37. * <p>
  38. * 获取优化 SQL 方法
  39. * </p>
  40. *
  41. * @return SQL 信息
  42. */
  43. public abstract SqlInfo optimizeSql();
  44. public String getSql() {
  45. return sql;
  46. }
  47. public void setSql(String sql) {
  48. this.sql = sql;
  49. }
  50. public String getDbType() {
  51. return dbType;
  52. }
  53. public void setDbType(String dbType) {
  54. this.dbType = dbType;
  55. }
  56. }