Browse Source

添加一些介绍,完善了License文件

huangluyu 10 months ago
parent
commit
da6ed6c7bd
2 changed files with 50 additions and 17 deletions
  1. 4 4
      LICENSE
  2. 46 13
      README.md

+ 4 - 4
LICENSE

@@ -1,8 +1,8 @@
-MIT License
-Copyright (c) <year> <copyright holders>
+The MIT License (MIT)
+Copyright © 2018 huangluyu
 
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 
 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 46 - 13
README.md

@@ -1,15 +1,24 @@
 # Bdm ORM
 
-一个功能简单的 ORM 框架 by 大仙
+一个功能简单的小型 SQL 生成器 by 大仙
 
 ### 功能介绍
 
-1. 链式 SQL 查询。
-2. 多库联合操作。(正在实现)
+1. 链式 SQL 拼接
 
-### 使用简介
+    传统的 SQL 拼接,无论是 SQL 还是 HQL,都需要大量的字符串合并操作,代码较为凌乱,逻辑散落各处,很难看清楚完整的逻辑内涵。链式查询的意义在于,使用一条语句完成所有的 SQL 拼接操作,比起传统的 SQL 字符串拼接来说,链式查询的查询逻辑看上去更加完整,一目了然。
+    
+2. 导出 SQL
+
+    提供了一系列 API 用于导出SQL,与其他 ORM 框架结合。
+    
+2. Model字段限制(开发中)
 
-1. 设置 Model 类,在注解中配置其数据库、数据表及字段,并继承自 BaseModel,且 package 中需要包含 model。如 Person 类所示:
+    通过注解,从逻辑层面进行对数据表的指定字段进行一系列的限制。包括,限制读取,限制修改,限制长度等。
+
+### 开始一个查询
+
+1. 设置 Model 类,在注解中配置其数据库、数据表及字段,并继承自 BaseModel,且 package 中需要包含 model 或者 models。如 Person 类所示:
 
     ```
     package com.huangluyu.test.model;
@@ -41,7 +50,7 @@
     
     你会得到一个返回值组成的的 HashMap。
     
-3. 支持子查询。如:
+3. 支持链式子查询。如:
 
     ```
     List<BaseModel> sql = Table.select("person.*")
@@ -58,13 +67,37 @@
             .get();
     ```
     
-(完)
-
-The MIT License (MIT)
-Copyright © 2018 huangluyu
+    你会得到下列查询 SQL 产生的结果(MySQL)。
+    
+    ```
+    SELECT 
+        person.* 
+    FROM ( 
+        SELECT 
+            name, id 
+        FROM person 
+        WHERE null.id != '666' 
+    ) person 
+    LEFT JOIN person_info pi ON person.id = pi.id 
+    WHERE ( 
+        person.name = 'xiaoMing' 
+        AND person.id = '1' 
+    ) 
+    AND pi.password IS NOT NULL 
+    AND person.id = ( 
+        SELECT 
+            id 
+        FROM person 
+        WHERE person.id = '1' 
+    )
+    ```
 
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+### 使用简介
 
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 
-THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+1. 开始
+    
+    使用``Table.from()`` 或者 ``Table.select("*").from()``开始一段查询,如果未指定``select``的字段,将默认以``select("*")``来执行,可以将``select``语句放到``from``语句的后面,如``Table.from().select()``。
+    
+    该方法会返回一个 BaseConstructor 对象,用于拼接操作。
+