{"id":91866,"date":"2026-08-08T16:16:48","date_gmt":"2026-08-08T08:16:48","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/91866.html"},"modified":"2026-08-08T16:16:48","modified_gmt":"2026-08-08T08:16:48","slug":"sql-first-%e8%8c%83%e5%bc%8f%ef%bc%9a%e4%b8%80%e7%a7%8d%e9%9d%a2%e5%90%91%e4%b8%9a%e5%8a%a1%e7%bb%93%e6%9e%9c%e7%9a%84%e6%8c%81%e4%b9%85%e5%b1%82%e8%ae%be%e8%ae%a1","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/91866.html","title":{"rendered":"SQL-First \u8303\u5f0f\uff1a\u4e00\u79cd\u9762\u5411\u4e1a\u52a1\u7ed3\u679c\u7684\u6301\u4e45\u5c42\u8bbe\u8ba1"},"content":{"rendered":"<h2>SQL-First \u8303\u5f0f&#xff1a;\u4e00\u79cd\u9762\u5411\u4e1a\u52a1\u7ed3\u679c\u7684\u6301\u4e45\u5c42\u8bbe\u8ba1<\/h2>\n<h3>\u524d\u8a00<\/h3>\n<p>\u5728 Java \u540e\u7aef\u6301\u4e45\u5c42\u9886\u57df&#xff0c;ORM&#xff08;JPA\/Hibernate&#xff09;\u3001MyBatis \u957f\u671f\u5360\u636e\u4e3b\u6d41&#xff0c;\u4f46\u5f00\u53d1\u8005\u5728\u957f\u671f\u5b9e\u6218\u4e2d\u5e38\u9047\u5230\u4e00\u4e2a\u6838\u5fc3\u77db\u76fe&#xff1a;\u9762\u5411\u5bf9\u8c61\u7684\u7f16\u7a0b\u8bed\u8a00&#xff08;3GL&#xff09;\u548c\u58f0\u660e\u5f0f SQL&#xff08;4GL&#xff09;\u5b58\u5728\u5929\u7136\u8bed\u4e49\u9e3f\u6c9f\u3002\u5f3a\u884c\u7528\u5bf9\u8c61\u601d\u7ef4\u5c01\u88c5 SQL&#xff0c;\u6216\u662f\u7528\u591a\u5c42\u6807\u7b7e\u9694\u79bb SQL&#xff0c;\u90fd\u4f1a\u5728\u4e0d\u540c\u573a\u666f\u4e0b\u5e26\u6765\u5197\u4f59\u4ee3\u7801\u3001\u80fd\u529b\u53d7\u9650\u6216\u8c03\u8bd5\u56f0\u96be\u7b49\u95ee\u9898\u3002<\/p>\n<p>\u672c\u6587\u4ece\u5e95\u5c42\u7406\u8bba\u6839\u6e90\u51fa\u53d1&#xff0c;\u4ecb\u7ecd SQL-First \u6301\u4e45\u5c42\u8bbe\u8ba1\u8303\u5f0f&#xff0c;\u5256\u6790 3GL \u4e0e 4GL \u7684\u672c\u8d28\u5dee\u5f02\u3001ORM\/MyBatis \u7684\u8bbe\u8ba1\u8fb9\u754c&#xff0c;\u5e76\u7ed3\u5408 simple-dao \u8fd9\u7c7b\u5178\u578b\u843d\u5730\u6846\u67b6&#xff0c;\u8bb2\u89e3\u8303\u5f0f\u67b6\u6784\u3001\u8bbe\u8ba1\u539f\u5219\u3001\u5de5\u7a0b\u4f18\u52bf\u4e0e\u8de8\u8bed\u8a00\u5b9e\u8df5\u3002<\/p>\n<p>\u76f8\u5173\u5f00\u6e90\u5730\u5740&#xff1a;<\/p>\n<li>\u6838\u5fc3\u6846\u67b6\u6e90\u7801&#xff1a;https:\/\/gitee.com\/gao_zhenzhong\/simple-dao<\/li>\n<li>\u7cfb\u7edf\u5e95\u5ea7&#xff1a;https:\/\/gitee.com\/gao_zhenzhong\/simple-dao-starter<\/li>\n<li>\u4ee3\u7801\u751f\u6210\u5668&#xff1a;https:\/\/gitee.com\/gao_zhenzhong\/simple-dao-coder<\/li>\n<li>\u5b9e\u6218\u6848\u4f8b&#xff1a;https:\/\/gitee.com\/gao_zhenzhong\/simple-dao-demo<\/li>\n<hr \/>\n<h3>\u4e00\u3001\u5e95\u5c42\u6839\u57fa&#xff1a;3GL \u4e0e 4GL \u7684\u672c\u8d28\u4ee3\u9645\u5dee\u5f02<\/h3>\n<h4>1.1 \u4e24\u5927\u6280\u672f\u5b87\u5b99&#xff1a;\u56fe\u8bba VS \u96c6\u5408\u8bba<\/h4>\n<p>\u8f6f\u4ef6\u5f00\u53d1\u5b58\u5728\u4e24\u7c7b\u5b8c\u5168\u4e0d\u540c\u7684\u8bed\u8a00\u4f53\u7cfb&#xff0c;\u4e8c\u8005\u6570\u5b66\u6839\u57fa\u3001\u601d\u7ef4\u6a21\u5f0f\u3001\u62bd\u8c61\u76ee\u6807\u622a\u7136\u4e0d\u540c&#xff0c;\u8fd9\u4e5f\u662f\u6240\u6709\u6301\u4e45\u5c42\u6846\u67b6\u8bbe\u8ba1\u53d6\u820d\u7684\u6e90\u5934&#xff1a;<\/p>\n<p>\u7b2c\u4e09\u4ee3\u8bed\u8a00&#xff08;3GL&#xff09;<\/p>\n<ul>\n<li>\u4ee3\u8868&#xff1a;Java\u3001C#\u3001Go\u3001Python\u3001C&#043;&#043; \u7b49\u901a\u7528\u7f16\u7a0b\u8bed\u8a00<\/li>\n<li>\u6570\u5b66\u57fa\u7840&#xff1a;\u56fe\u8bba<\/li>\n<li>\u6838\u5fc3\u7279\u5f81&#xff1a;\u547d\u4ee4\u5f0f\/\u9762\u5411\u5bf9\u8c61&#xff0c;\u6838\u5fc3\u5143\u7d20\u4e3a\u5bf9\u8c61\u3001\u5f15\u7528\u3001\u65b9\u6cd5\u3001\u7ee7\u627f\u3001\u591a\u6001&#xff1b;\u4f9d\u9760\u5faa\u73af\u3001\u5224\u65ad\u3001\u8d4b\u503c\u5b8c\u6210\u6d41\u7a0b&#xff1b;\u805a\u7126\u7b97\u6cd5 &#043; \u6570\u636e\u7ed3\u6784\u3002<\/li>\n<\/ul>\n<p>\u7b2c\u56db\u4ee3\u8bed\u8a00&#xff08;4GL&#xff09;<\/p>\n<ul>\n<li>\u4ee3\u8868&#xff1a;SQL&#xff08;\u5173\u7cfb\u578b\u6570\u636e\u5e93\u6807\u51c6\u8bed\u8a00&#xff09;<\/li>\n<li>\u6570\u5b66\u57fa\u7840&#xff1a;\u96c6\u5408\u8bba &#043; \u8c13\u8bcd\u903b\u8f91<\/li>\n<li>\u6838\u5fc3\u7279\u5f81&#xff1a;\u58f0\u660e\u5f0f&#xff0c;\u6838\u5fc3\u5143\u7d20\u4e3a\u8868\u3001\u884c\u3001\u5217\u3001\u5173\u7cfb&#xff1b;\u7531\u6570\u636e\u5e93\u5f15\u64ce\u81ea\u4e3b\u89c4\u5212\u6267\u884c\u903b\u8f91&#xff1b;\u805a\u7126\u96c6\u5408\u4e0e\u5173\u7cfb\u8fd0\u7b97\u3002<\/li>\n<\/ul>\n<h4>1.2 \u4e0d\u53ef\u6d88\u9664\u7684\u8bed\u4e49\u9e3f\u6c9f<\/h4>\n<p>3GL \u548c 4GL \u4e4b\u95f4\u4e0d\u5b58\u5728\u5b8c\u7f8e\u7684\u4e00\u4e00\u6620\u5c04\u5173\u7cfb&#xff0c;\u8fd9\u662f\u6570\u5b66\u5c42\u9762\u7684\u56fa\u6709\u58c1\u5792&#xff1a;<\/p>\n<ul>\n<li>\u5bf9\u8c61\u7ee7\u627f\u3001\u591a\u6001\u7b49 OOP \u7279\u6027&#xff0c;\u5728\u5173\u7cfb\u8868\u4e2d\u6ca1\u6709\u539f\u751f\u5bf9\u5e94\u7ed3\u6784&#xff1b;<\/li>\n<li>Java \u5bf9\u8c61\u5f15\u7528\u5bfc\u822a&#xff08;user.getOrderList()&#xff09;\u7b49\u4ef7\u4e8e\u6570\u636e\u5e93\u591a\u8868 JOIN&#xff0c;\u4f46\u6267\u884c\u903b\u8f91\u3001\u6027\u80fd\u6a21\u578b\u5b8c\u5168\u4e0d\u540c&#xff1b;<\/li>\n<li>\u5185\u5b58\u5bf9\u8c61\u6807\u8bc6&#xff08;\u5f15\u7528\u5730\u5740&#xff09;\u2260 \u6570\u636e\u5e93\u4e3b\u952e\u7ea6\u675f\u3002<\/li>\n<\/ul>\n<p>\u6838\u5fc3\u7ed3\u8bba&#xff1a;\u4efb\u4f55\u8bd5\u56fe\u5f3a\u884c\u62b9\u5e73\u4e8c\u8005\u5dee\u5f02\u3001\u505a&#034;\u5168\u53cc\u5411\u7ffb\u8bd1&#034;\u7684\u6846\u67b6&#xff0c;\u90fd\u5fc5\u7136\u5728\u590d\u6742\u573a\u666f\u4e0b\u4ed8\u51fa \u8bed\u4e49\u626d\u66f2\u3001\u6027\u80fd\u5931\u63a7\u3001\u5b66\u4e60\u6210\u672c\u98d9\u5347 \u7684\u4ee3\u4ef7\u3002<\/p>\n<hr \/>\n<h3>\u4e8c\u3001\u5173\u7cfb\u578b\u6570\u636e\u5e93\u4e0e SQL&#xff1a;\u81f3\u4eca\u4e0d\u53ef\u66ff\u4ee3<\/h3>\n<h4>2.1 \u5173\u7cfb\u578b\u6570\u636e\u5e93\u662f\u6570\u636e\u4f53\u7cfb\u57fa\u77f3<\/h4>\n<p>\u5f53\u4e0b\u4e3b\u6d41\u6570\u636e\u5e93&#xff08;KV\u5e93\u3001\u65f6\u5e8f\u5e93\u3001\u5411\u91cf\u5e93\u3001\u56fe\u5e93&#xff09;\u672c\u8d28\u90fd\u662f\u5173\u7cfb\u578b\u6570\u636e\u5e93\u7684\u7279\u5316\u5f62\u6001\u3002\u4f01\u4e1a\u6838\u5fc3\u4e1a\u52a1&#xff08;\u7528\u6237\u3001\u8ba2\u5355\u3001\u6743\u9650\u3001\u6821\u56ed\/\u653f\u4f01\u4e1a\u52a1\u7b49&#xff09;\u6c38\u8fdc\u4ee5\u5173\u7cfb\u578b\u6570\u636e\u5e93\u4e3a\u8f7d\u4f53&#xff0c;\u4e2d\u95f4\u4ef6&#xff08;Redis\u3001ES\u3001ClickHouse&#xff09;\u4ec5\u4f5c\u4e3a\u7f13\u5b58\u3001\u7d22\u5f15\u3001\u5206\u6790\u8f85\u52a9\u5de5\u5177\u3002<\/p>\n<h4>2.2 SQL&#xff1a;\u8de8\u8bed\u8a00\u3001\u8de8\u5e73\u53f0\u7684\u901a\u7528\u6570\u636e\u8bed\u8a00<\/h4>\n<li>\u6807\u51c6\u5316\u6781\u5f3a&#xff1a;SQL \u6838\u5fc3\u8bed\u6cd5\u6570\u5341\u5e74\u57fa\u672c\u7a33\u5b9a&#xff0c;\u4ec5\u5404\u6570\u636e\u5e93\u5b58\u5728\u5c11\u91cf\u65b9\u8a00&#xff1b;<\/li>\n<li>\u8868\u8fbe\u80fd\u529b\u5168\u8986\u76d6&#xff1a;\u4ece\u7b80\u5355\u589e\u5220\u6539\u67e5\u5230\u590d\u6742\u8054\u8868\u3001\u5b50\u67e5\u8be2\u3001\u5206\u7ec4\u3001\u805a\u5408\u3001\u7a97\u53e3\u51fd\u6570&#xff0c;\u5747\u53ef\u539f\u751f\u5b9e\u73b0&#xff1b;<\/li>\n<li>\u5168\u8bed\u8a00\u517c\u5bb9&#xff1a;Java\/Spring JDBC\u3001Python\/DB-API\u3001C#\/Dapper\u3001Go\/sqlx \u7b49\u6240\u6709\u4e3b\u6d41\u7f16\u7a0b\u8bed\u8a00&#xff0c;\u5747\u63d0\u4f9b\u6807\u51c6 SQL \u4ea4\u4e92\u63a5\u53e3\u3002<\/li>\n<p>SQL \u4e0d\u6b7b&#xff0c;\u5173\u7cfb\u578b\u6570\u636e\u5e93\u4e0d\u6b7b&#xff0c;\u57fa\u4e8e SQL \u7684\u8bbe\u8ba1\u8303\u5f0f\u5c31\u6c38\u8fdc\u5177\u5907\u751f\u547d\u529b\u3002<\/p>\n<hr \/>\n<h3>\u4e09\u3001\u4e3b\u6d41\u6846\u67b6\u6df1\u5ea6\u5256\u6790&#xff1a;\u8bbe\u8ba1\u8fb9\u754c\u4e0e\u9002\u7528\u57df<\/h3>\n<h4>3.1 ORM \u6846\u67b6&#xff08;JPA\/Hibernate&#xff09;&#xff1a;\u5355\u8868\u5bf9\u8c61\u5316\u7684\u4ef7\u503c\u4e0e\u590d\u6742\u67e5\u8be2\u7684\u5c40\u9650<\/h4>\n<p>ORM \u7684\u8bbe\u8ba1\u76ee\u6807&#xff1a;\u7528 3GL \u5bf9\u8c61\u6a21\u578b\u6620\u5c04 4GL \u5173\u7cfb\u6570\u636e\u3002<\/p>\n<p>\u8fd9\u4e00&#034;\u5b8c\u5168\u53cc\u5411\u65e0\u7f1d\u6620\u5c04&#034;\u7684\u76ee\u6807\u5728\u6570\u5b66\u5c42\u9762\u96be\u4ee5\u5b8c\u7f8e\u5b9e\u73b0&#xff0c;\u4f46\u5728\u5355\u8868\u5bf9\u8c61\u5316\u7ba1\u7406\u57df&#xff08;\u7ea7\u8054\u4fdd\u5b58\u3001\u810f\u68c0\u67e5\u3001\u5bf9\u8c61\u751f\u547d\u5468\u671f\u7ba1\u7406&#xff09;\u6709\u660e\u786e\u4ef7\u503c\u3002\u5176\u5c40\u9650\u5728\u4e8e&#xff1a;<\/p>\n<li>\u590d\u6742\u67e5\u8be2\u80fd\u529b\u53d7\u9650&#xff1a;\u591a\u8868\u8054\u67e5\u3001\u62a5\u8868\u3001\u5b50\u67e5\u8be2\u3001\u7a97\u53e3\u51fd\u6570\u7b49\u573a\u666f&#xff0c;HQL\/JPQL \u80fd\u529b\u8fdc\u4e0d\u53ca\u539f\u751f SQL&#xff1b;<\/li>\n<li>SQL \u4e0d\u53ef\u63a7&#xff1a;\u6846\u67b6\u81ea\u52a8\u751f\u6210 SQL&#xff0c;\u590d\u6742\u573a\u666f\u4e0b\u8bed\u53e5\u81c3\u80bf\u3001\u7d22\u5f15\u5931\u6548\u95ee\u9898\u9891\u53d1&#xff1b;<\/li>\n<li>N&#043;1 \u67e5\u8be2\u95ee\u9898&#xff1a;\u5bf9\u8c61\u904d\u5386\u5929\u7136\u89e6\u53d1\u591a\u6b21\u6570\u636e\u5e93\u8bf7\u6c42&#xff1b;<\/li>\n<li>\u53cc\u91cd\u5b66\u4e60\u6210\u672c&#xff1a;\u5f00\u53d1\u8005\u9700\u540c\u65f6\u638c\u63e1 Java\/OOP \u4e0e\u6846\u67b6\u4e13\u5c5e\u67e5\u8be2\u8bed\u8a00\u3002<\/li>\n<p>\u603b\u7ed3&#xff1a;ORM \u5728\u5355\u8868 CRUD \u548c\u5bf9\u8c61\u5173\u7cfb\u7ba1\u7406\u573a\u666f\u4e0b\u6548\u7387\u6781\u9ad8&#xff0c;\u4f46\u5728\u590d\u6742\u67e5\u8be2\u57df&#xff0c;\u5f00\u53d1\u8005\u5f80\u5f80\u9700\u8981\u9000\u56de\u539f\u751f SQL\u3002<\/p>\n<h4>3.2 MyBatis&#xff1a;SQL \u81ea\u7531\u7684\u4ee3\u4ef7\u662f\u5de5\u7a0b\u5316\u5197\u4f59<\/h4>\n<p>MyBatis \u6838\u5fc3\u5b9a\u4f4d&#xff1a;\u505a\u300cSQL \u53c2\u6570\u7ed1\u5b9a &#043; \u7ed3\u679c\u96c6\u6620\u5c04\u300d\u3002<\/p>\n<p>\u5b83\u4fdd\u7559\u4e86 SQL \u81ea\u7531&#xff0c;\u4f46\u4e3a\u4e86\u5b9e\u73b0\u8fd9\u4e00\u57fa\u7840\u80fd\u529b&#xff0c;\u5f15\u5165\u4e86\u989d\u5916\u7684\u5de5\u7a0b\u5316\u5c42\u7ea7&#xff1a;<\/p>\n<ul>\n<li>\u5f3a\u5236\u62c6\u5206 Mapper\u63a5\u53e3 &#043; XML\/\u6ce8\u89e3 \u53cc\u6587\u4ef6&#xff1b;<\/li>\n<li>\u8bbe\u8ba1\u5927\u91cf\u52a8\u6001\u6807\u7b7e&#xff08;&lt;if&gt;\/&lt;where&gt;\/&lt;foreach&gt;&#xff09;\u3001OGNL \u8868\u8fbe\u5f0f&#xff1b;<\/li>\n<li>\u62e6\u622a\u5668\u4f53\u7cfb\u590d\u6742&#xff0c;\u81ea\u5b9a\u4e49\u6269\u5c55\u95e8\u69db\u8f83\u9ad8\u3002<\/li>\n<\/ul>\n<p>\u8fd9\u4e9b\u7ec4\u4ef6\u5bf9\u4e8e\u9700\u8981\u590d\u6742\u5d4c\u5957\u5bf9\u8c61\u6620\u5c04&#xff08;association\/collection&#xff09;\u3001\u6216\u56e2\u961f\u5df2\u719f\u6089 XML \u5de5\u4f5c\u6d41\u7684\u573a\u666f\u6709\u4ef7\u503c&#xff1b;\u4f46\u5bf9\u4e8e\u8ffd\u6c42\u6781\u7b80\u3001\u538c\u6076\u6587\u4ef6\u5207\u6362\u3001SQL \u80fd\u529b\u8f83\u5f3a\u7684\u5f00\u53d1\u8005&#xff0c;\u8fd9\u4e9b\u7ec4\u4ef6\u6784\u6210\u989d\u5916\u8d1f\u62c5\u3002<\/p>\n<p>\u53cd\u89c2 Spring JDBC&#xff0c;\u4ec5\u9760 RowMapper \u5373\u53ef\u5b8c\u6210\u7ed3\u679c\u6620\u5c04&#xff0c;\u4f46\u7f3a\u5c11\u5355\u8868\u81ea\u52a8\u5316\u548c\u52a8\u6001\u6761\u4ef6\u7ba1\u7406\u80fd\u529b\u3002<\/p>\n<hr \/>\n<h3>\u56db\u3001SQL-First \u8303\u5f0f&#xff1a;\u9876\u5c42\u8bbe\u8ba1\u4e0e\u843d\u5730\u67b6\u6784<\/h3>\n<h4>4.1 \u6838\u5fc3\u8bbe\u8ba1\u601d\u60f3&#xff1a;\u57fa\u4e8e SQL \u52a8\u6001\u6027\u68af\u5ea6\u62bd\u8c61<\/h4>\n<p>\u4e00\u6761\u6807\u51c6 SQL \u53ef\u62c6\u5206\u4e3a\u4e03\u5927\u5b50\u53e5&#xff0c;\u4e0d\u540c\u5b50\u53e5\u7684\u4e1a\u52a1\u53d8\u66f4\u9891\u7387&#xff08;\u52a8\u6001\u6027&#xff09;\u5b58\u5728\u660e\u663e\u68af\u5ea6&#xff1a;<\/p>\n<table>\n<tr>SQL \u5b50\u53e5\u52a8\u6001\u7b49\u7ea7\u7279\u5f81\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>SELECT \/ FROM \/ JOIN \/ GROUP BY<\/td>\n<td>\u7a33\u5b9a<\/td>\n<td>\u8868\u7ed3\u6784\u3001\u67e5\u8be2\u5b57\u6bb5\u3001\u5173\u8054\u5173\u7cfb\u6781\u5c11\u53d8\u66f4<\/td>\n<\/tr>\n<tr>\n<td>HAVING \/ ORDER<\/td>\n<td>\u4e2d\u7b49\u52a8\u6001<\/td>\n<td>\u5206\u7ec4\u8fc7\u6ee4\u3001\u6392\u5e8f\u5076\u5c14\u8c03\u6574<\/td>\n<\/tr>\n<tr>\n<td>WHERE \/ LIMIT<\/td>\n<td>\u9ad8\u5ea6\u52a8\u6001<\/td>\n<td>\u7b5b\u9009\u6761\u4ef6\u3001\u5206\u9875\u662f\u4e1a\u52a1\u6700\u9891\u7e41\u53d8\u52a8\u7684\u90e8\u5206<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u57fa\u4e8e\u52a8\u6001\u68af\u5ea6&#xff0c;SQL-First \u5b9a\u4e0b\u6838\u5fc3\u8bbe\u8ba1\u7b56\u7565&#xff1a;<\/p>\n<li>\u7a33\u5b9a\u90e8\u5206&#xff08;SELECT\/FROM\/JOIN\/GROUP BY&#xff09;&#xff1a;\u5b8c\u5168\u4ea4\u7ed9\u539f\u751f SQL&#xff0c;\u6846\u67b6\u4e0d\u505a\u4efb\u4f55\u5c01\u88c5&#xff0c;100% \u4fdd\u7559\u6570\u636e\u5e93\u8868\u8fbe\u80fd\u529b&#xff1b;<\/li>\n<li>\u9ad8\u52a8\u6001\u90e8\u5206&#xff08;WHERE\/\u5206\u9875\/\u6392\u5e8f&#xff09;&#xff1a;\u4f7f\u7528 3GL&#xff08;Java&#xff09;\u5de5\u7a0b\u5316\u5c01\u88c5&#xff0c;\u7edf\u4e00\u7ba1\u7406\u3001\u590d\u7528\u3001\u8c03\u8bd5\u3002<\/li>\n<p>\u6838\u5fc3\u5b9a\u4f4d&#xff1a;\u4e0d\u5c1d\u8bd5\u7ffb\u8bd1 3GL \u4e0e 4GL&#xff0c;\u53ea\u505a\u62fc\u63a5\u6865\u6881&#xff1b;SQL \u4f9d\u65e7\u662f SQL&#xff0c;Java \u4f9d\u65e7\u662f Java&#xff0c;\u4e8c\u8005\u5404\u53f8\u5176\u804c&#xff0c;\u65e0\u8bed\u4e49\u7be1\u6539\u3002<\/p>\n<h4>4.2 \u4e24\u5927\u94c1\u5f8b&#xff1a;\u53cc\u4e0d\u5c01\u88c5\u539f\u5219<\/h4>\n<p>\u8fd9\u662f SQL-First \u8303\u5f0f\u4e0d\u53ef\u7a81\u7834\u7684\u5e95\u7ebf&#xff1a;<\/p>\n<li>\n<p>\u4e0d\u5c01\u88c5 SQL \u5173\u952e\u5b57\u4e0e\u539f\u751f\u8bed\u6cd5 \u6846\u67b6\u4e0d\u81ea\u5b9a\u4e49 eq()\/like() \u7b49\u79c1\u6709 DSL&#xff0c;\u5f00\u53d1\u8005\u76f4\u63a5\u4e66\u5199 AND field &#061; ? \u6807\u51c6 SQL \u7247\u6bb5\u3002 \u4f18\u52bf&#xff1a;\u96f6\u989d\u5916\u8bed\u6cd5\u5b66\u4e60\u3001\u517c\u5bb9\u6240\u6709\u6570\u636e\u5e93\u51fd\u6570\/\u65b9\u8a00\u3001\u8de8\u6846\u67b6\u8fc1\u79fb\u65e0\u6210\u672c\u3002<\/p>\n<\/li>\n<li>\n<p>\u4e0d\u5c4f\u853d\u6570\u636e\u5e93\u539f\u751f\u80fd\u529b\u4e0e\u5f02\u5e38 \u6846\u67b6\u4e0d\u62e6\u622a\u3001\u4e0d\u6539\u5199\u6570\u636e\u5e93\u539f\u751f\u884c\u4e3a&#xff1a;\u5b58\u50a8\u8fc7\u7a0b\u3001DDL\u3001\u6d41\u5f0f\u67e5\u8be2\u3001\u6570\u636e\u5e93\u72ec\u6709\u8bed\u6cd5\u5747\u53ef\u76f4\u63a5\u4f7f\u7528&#xff1b;SQL \u5f02\u5e38\u3001\u6570\u636e\u5e93\u9519\u8bef\u76f4\u63a5\u900f\u4f20&#xff0c;\u4e0d\u505a\u591a\u5c42\u5305\u88c5\u3002 \u4f18\u52bf&#xff1a;\u80fd\u529b\u65e0\u9609\u5272&#xff0c;\u6392\u67e5\u95ee\u9898\u76f4\u89c2\u3002<\/p>\n<\/li>\n<h4>4.3 \u4e09\u5c42\u6807\u51c6\u67b6\u6784&#xff08;SimpleDAO \u843d\u5730\u5b9e\u73b0&#xff09;<\/h4>\n<p>\u4ee5 simple-dao \u4e3a\u5178\u578b\u5b9e\u73b0&#xff0c;SQL-First \u8303\u5f0f\u843d\u5730\u4e3a\u4e09\u5c42\u89e3\u8026\u67b6\u6784&#xff1a;<\/p>\n<h5>\u7b2c\u4e00\u5c42&#xff1a;BaseCondition \u6761\u4ef6\u5c42&#xff08;\u9ad8\u52a8\u6001\u533a\u57df\u4e13\u5c5e&#xff09;<\/h5>\n<p>\u804c\u8d23&#xff1a;\u7edf\u4e00\u7ba1\u7406 WHERE \u6761\u4ef6\u3001\u5206\u9875\u3001\u6392\u5e8f\u3002<\/p>\n<li>\u6838\u5fc3\u80fd\u529b&#xff1a;\n<ul>\n<li>\u5c06\u96f6\u6563\u7684\u5b57\u7b26\u4e32\u62fc\u63a5&#xff0c;\u5347\u7ea7\u4e3a\u8bed\u4e49\u5355\u5143\u7ec4\u88c5&#xff0c;\u5185\u7f6e and()\/in()\/like()\/\u5e03\u5c14\u6761\u4ef6\u7b49\u901a\u7528\u65b9\u6cd5&#xff1b;<\/li>\n<li>\u81ea\u52a8\u6536\u96c6 SQL \u5360\u4f4d\u7b26\u53c2\u6570&#xff0c;\u5f7b\u5e95\u544a\u522b\u624b\u52a8\u7ef4\u62a4\u53c2\u6570\u96c6\u5408&#xff1b;<\/li>\n<li>\u6240\u6709\u6761\u4ef6\u6536\u655b\u5230 addCondition() \u5355\u4e00\u65b9\u6cd5&#xff0c;\u5168\u5c40\u7f16\u7801\u89c4\u8303\u7edf\u4e00\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u6838\u5fc3\u4ef7\u503c&#xff1a;\n<ul>\n<li>\u62b9\u5e73\u5355\u8868\/\u8054\u8868\u67e5\u8be2\u7684\u5272\u88c2\u611f&#xff1a;\u65e0\u8bba\u5355\u8868\u3001\u591a\u8868\u3001\u5b50\u67e5\u8be2\u3001\u62a5\u8868&#xff0c;\u5171\u7528\u4e00\u5957\u6761\u4ef6\u4f53\u7cfb\u3001\u4e00\u5957\u8c03\u7528 API&#xff1b;<\/li>\n<li>\u589e\u5220\u7b5b\u9009\u6761\u4ef6\u4ec5\u9700\u4fee\u6539\u5355\u884c\u4ee3\u7801&#xff1b;<\/li>\n<li>\u652f\u6301\u591a\u6761\u4ef6\u62c6\u5206 &#043; \u53c2\u6570\u5408\u5e76&#xff08;mergeParams&#xff09;&#xff0c;\u590d\u6742\u4e1a\u52a1\u53ef\u6a21\u5757\u5316\u62c6\u5206\u3002<\/li>\n<\/ul>\n<\/li>\n<h5>\u7b2c\u4e8c\u5c42&#xff1a;BaseSql \u6267\u884c\u5c42&#xff08;\u6865\u6881\u5c42&#xff09;<\/h5>\n<p>\u804c\u8d23&#xff1a;\u7eaf\u6267\u884c\u901a\u9053&#xff0c;\u63a5\u6536\u300c\u9759\u6001SQL &#043; \u52a8\u6001\u6761\u4ef6 &#043; \u53c2\u6570\u300d&#xff0c;\u57fa\u4e8e Spring JDBC \u6267\u884c\u8bed\u53e5\u3002<\/p>\n<ul>\n<li>\u4e0d\u89e3\u6790\u3001\u4e0d\u7be1\u6539 SQL&#xff0c;\u4e25\u683c\u9075\u5faa\u53cc\u4e0d\u5c01\u88c5\u539f\u5219&#xff1b;<\/li>\n<li>\u5c01\u88c5\u591a\u6570\u636e\u5e93\u65b9\u8a00\u5206\u9875\u3001SQL \u65e5\u5fd7\u6253\u5370\u3001\u53c2\u6570\u66ff\u6362\u7b49\u901a\u7528\u80fd\u529b&#xff1b;<\/li>\n<li>\u5b8c\u5168\u590d\u7528 Spring \u4e8b\u52a1\u3001\u8fde\u63a5\u6c60\u7b49\u539f\u751f\u80fd\u529b&#xff0c;\u65e0\u4e8c\u6b21\u5c01\u88c5\u3002<\/li>\n<\/ul>\n<h5>\u7b2c\u4e09\u5c42&#xff1a;BaseDao \u5355\u8868\u8f85\u52a9\u5c42&#xff08;\u7a33\u5b9a\u533a\u57df\u589e\u5f3a&#xff09;<\/h5>\n<p>\u804c\u8d23&#xff1a;\u4f9d\u6258\u6ce8\u89e3 &#043; \u542f\u52a8\u4e00\u6b21\u6027\u53cd\u5c04\u89e3\u6790\u5b9e\u4f53\u5143\u6570\u636e&#xff0c;\u81ea\u52a8\u5316\u5355\u8868 CRUD\u3002<\/p>\n<li>\u80fd\u529b&#xff1a;\u81ea\u52a8\u5904\u7406\u4e3b\u952e\u7b56\u7565\u3001\u5ba1\u8ba1\u5b57\u6bb5&#xff08;\u521b\u5efa\u4eba\/\u65f6\u95f4&#xff09;\u3001\u5168\u5c40\u903b\u8f91\u5220\u9664&#xff1b;<\/li>\n<li>\u8bbe\u8ba1&#xff1a;\u5b8c\u5168\u590d\u7528\u4e0a\u5c42 BaseCondition &#043; BaseSql \u80fd\u529b&#xff0c;\u4e0d\u91cd\u590d\u9020\u8f6e\u5b50&#xff1b;<\/li>\n<li>\u5143\u6570\u636e\u7f13\u5b58&#xff1a;BaseDao \u91c7\u7528\u5355\u4f8b\u6a21\u5f0f&#xff0c;\u5143\u6570\u636e\u5728\u5bb9\u5668\u542f\u52a8\u9636\u6bb5\u4e00\u6b21\u6027\u89e3\u6790\u5e76\u7f13\u5b58\u81f3 Class \u7ea7\u522b&#xff0c;\u8fd0\u884c\u671f\u65e0\u91cd\u590d\u53cd\u5c04\u5f00\u9500&#xff1b;<\/li>\n<li>\u6548\u679c&#xff1a;\u5355\u8868\u573a\u666f\u96f6\u624b\u5199 SQL&#xff0c;\u4f53\u9a8c\u5bf9\u6807\u4e3b\u6d41 ORM\u3002<\/li>\n<h4>4.4 \u6838\u5fc3\u65b9\u6cd5&#xff1a;\u4ece\u5b57\u7b26\u4e32\u62fc\u63a5\u5230\u8bed\u4e49\u5355\u5143<\/h4>\n<p>\u4f20\u7edf JDBC\/MyBatis \u4f9d\u9760\u786c\u62fc\u63a5\u5b57\u7b26\u4e32\u3001XML \u6807\u7b7e\u5b9e\u73b0\u6761\u4ef6&#xff0c;\u7f3a\u9677\u6781\u591a\u3002 SQL-First \u901a\u8fc7\u6807\u51c6\u5316\u65b9\u6cd5&#xff0c;\u5b9e\u73b0\u6761\u4ef6\u8bed\u4e49\u5316\u7ba1\u7406&#xff1a;<\/p>\n<ul>\n<li>and(\u5b57\u6bb5SQL, \u503c)&#xff1a;\u901a\u7528\u7b49\u503c\u6761\u4ef6&#xff0c;\u81ea\u52a8\u62fc\u63a5 AND &#043; \u5360\u4f4d\u7b26&#xff1b;<\/li>\n<li>and(\u5b57\u6bb5SQL, \u503c, \u6a21\u7cca\u7c7b\u578b)&#xff1a;\u5185\u7f6e\u524d\u7f00\/\u540e\u7f00\/\u5168\u6a21\u7cca\u6863\u4f4d&#xff1b;<\/li>\n<li>in(\u5b57\u6bb5SQL, \u6570\u7ec4)&#xff1a;\u81ea\u52a8\u62fc\u63a5 IN(?,?,?)&#xff1b;<\/li>\n<li>add(SQL\u7247\u6bb5, \u5e03\u5c14\u5f00\u5173)&#xff1a;\u6309\u9700\u62fc\u63a5\u6761\u4ef6&#xff0c;\u7b80\u5316\u5206\u652f\u5224\u65ad&#xff1b;<\/li>\n<li>mergeParams(BaseCondition&#8230;)&#xff1a;\u591a\u6761\u4ef6\u7c7b\u53c2\u6570\u6309\u5e8f\u5408\u5e76&#xff0c;\u652f\u6301\u590d\u6742\u62a5\u8868\u573a\u666f\u3002<\/li>\n<\/ul>\n<p>\u5bf9\u6bd4\u4f20\u7edf\u5199\u6cd5&#xff1a;<\/p>\n<ul>\n<li>\u4f20\u7edf&#xff1a;\u5927\u91cf if \u5224\u7a7a\u3001\u5b57\u7b26\u4e32\u62fc\u63a5\u3001\u53c2\u6570\u624b\u52a8\u5bf9\u9f50&#xff1b;<\/li>\n<li>\u8bed\u4e49\u5355\u5143\u5199\u6cd5&#xff1a;\u4e00\u884c\u5bf9\u5e94\u4e00\u4e2a\u4e1a\u52a1\u6761\u4ef6&#xff0c;\u4ee3\u7801\u6574\u6d01\u3001\u8c03\u8bd5\u53cb\u597d\u3002<\/li>\n<\/ul>\n<hr \/>\n<h3>\u4e94\u3001\u5de5\u7a0b\u5b9e\u6218&#xff1a;\u7ec6\u8282\u9009\u578b\u4e0e\u6027\u80fd\u8bf4\u660e<\/h3>\n<h4>5.1 SQL \u5b58\u653e\u4f4d\u7f6e&#xff1a;\u5e38\u91cf VS \u65b9\u6cd5\u5185<\/h4>\n<p>\u7ed3\u5408 SQL \u52a8\u6001\u6027\u68af\u5ea6&#xff0c;\u7ed9\u51fa\u5de5\u7a0b\u5316\u9009\u578b\u5efa\u8bae&#xff1a;<\/p>\n<li>\n<p>\u9759\u6001 SQL&#xff08;\u8868\u5173\u8054\u3001\u5b57\u6bb5\u56fa\u5b9a&#xff09; \u63a8\u8350\u62bd\u53d6\u4e3a static final \u5e38\u91cf\u3002\u4f5c\u7528&#xff1a;\u4ee3\u7801\u6574\u6d01\u3001\u591a\u5904\u590d\u7528\u3001\u7edf\u4e00\u7ef4\u62a4&#xff1b;\u6027\u80fd\u65e0\u660e\u663e\u5dee\u5f02&#xff08;JVM \u5b57\u7b26\u4e32\u4f18\u5316 &#043; JDBC \u9884\u7f16\u8bd1 &#043; \u6570\u636e\u5e93\u6267\u884c\u8ba1\u5212\u7f13\u5b58&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u52a8\u6001 SQL&#xff08;\u5b58\u5728\u5206\u652f\u3001\u4e34\u65f6\u62fc\u63a5&#xff09; \u76f4\u63a5\u5199\u5728 DAO \u65b9\u6cd5\u5185\u90e8&#xff0c;\u5229\u7528 Java \u539f\u751f\u903b\u8f91\u5b9e\u73b0\u52a8\u6001\u7ec4\u88c5\u3002Java \u7684\u52a8\u6001\u80fd\u529b\u8fdc\u5f3a\u4e8e XML \u6807\u7b7e\u4f53\u7cfb&#xff0c;\u903b\u8f91\u66f4\u7075\u6d3b\u3001\u53ef\u8bfb\u6027\u66f4\u9ad8\u3002<\/p>\n<\/li>\n<h4>5.2 \u7f16\u7801\u4f53\u91cf<\/h4>\n<p>SQL-First \u8303\u5f0f\u4ece\u67b6\u6784\u5c42\u9762\u780d\u6389\u975e\u4e1a\u52a1\u5197\u4f59\u4ee3\u7801&#xff1a;<\/p>\n<li>\u780d\u6389 XML \u788e\u7247\u5316\u6587\u4ef6\u3001\u5927\u91cf\u52a8\u6001\u6807\u7b7e\u3001OGNL \u8868\u8fbe\u5f0f&#xff1b;<\/li>\n<li>\u780d\u6389 ORM \u6d77\u91cf\u6ce8\u89e3\u3001\u94fe\u5f0f DSL\u3001\u5bf9\u8c61\u5173\u7cfb\u914d\u7f6e&#xff1b;<\/li>\n<li>\u7edf\u4e00\u6761\u4ef6\u5199\u6cd5&#xff0c;\u6d88\u706d\u91cd\u590d\u5224\u7a7a\u3001\u53c2\u6570\u62fc\u63a5\u6837\u677f\u4ee3\u7801&#xff1b;<\/li>\n<li>\u5355\u8868 CRUD \u81ea\u52a8\u5316&#xff0c;DAO \u53ef\u7a7a\u7ee7\u627f\u3002<\/li>\n<p>\u5728\u590d\u6742\u67e5\u8be2&#xff08;\u591a\u8868\u8054\u67e5\u3001\u52a8\u6001\u6761\u4ef6\u3001\u5b50\u67e5\u8be2&#xff09;\u573a\u666f\u4e0b&#xff0c;\u6301\u4e45\u5c42\u4ee3\u7801\u91cf\u663e\u8457\u4f4e\u4e8e\u4f20\u7edf\u6846\u67b6&#xff1b;\u5728\u7b80\u5355\u5355\u8868\u573a\u666f\u4e0b&#xff0c;DAO \u5c42\u4ee3\u7801\u8d8b\u8fd1\u4e8e\u96f6\u3002<\/p>\n<h4>5.3 \u8fd0\u884c\u4e0e\u542f\u52a8\u6027\u80fd<\/h4>\n<li>\u53cd\u5c04\u8bf4\u660e&#xff1a;BaseDao \u4ec5\u5728\u5bb9\u5668\u542f\u52a8\u9636\u6bb5\u4e00\u6b21\u6027\u53cd\u5c04\u89e3\u6790\u5b9e\u4f53\u3001\u8868\u3001\u5b57\u6bb5\u5143\u6570\u636e\u5e76\u7f13\u5b58\u81f3 Class \u7ea7\u522b&#xff0c;\u8fd0\u884c\u671f\u65e0\u91cd\u590d\u53cd\u5c04\u5f00\u9500&#xff1b;<\/li>\n<li>\u6279\u91cf\u3001\u5206\u9875&#xff1a;\u6846\u67b6\u63d0\u4f9b\u57fa\u7840\u80fd\u529b&#xff0c;\u8d85\u5927\u6279\u91cf\u4ea4\u7531\u4e1a\u52a1\u5c42\u5206\u6279&#xff08;\u884c\u4e1a\u901a\u7528\u65b9\u6848&#xff09;&#xff0c;\u4e0d\u5f3a\u884c\u5c01\u88c5\u907f\u514d\u98ce\u9669\u3002<\/li>\n<h4>5.4 \u6269\u5c55\u80fd\u529b&#xff1a;\u4f9d\u6258 Spring \u539f\u751f\u751f\u6001<\/h4>\n<p>SQL-First \u6846\u67b6\u4e0d\u81ea\u5b9a\u4e49\u590d\u6742\u63d2\u4ef6\u4f53\u7cfb&#xff0c;\u7edf\u4e00\u4f7f\u7528 Spring AOP \u5b9e\u73b0\u6570\u636e\u6743\u9650\u3001\u5b57\u6bb5\u8131\u654f\u3001SQL \u5ba1\u8ba1\u7b49\u6a2a\u5207\u903b\u8f91&#xff1a;<\/p>\n<ul>\n<li>\u6269\u5c55\u65b9\u5f0f\u4e3a Java \u901a\u7528\u6280\u80fd&#xff0c;\u65e0\u6846\u67b6\u79c1\u6709\u5b66\u4e60\u6210\u672c&#xff1b;<\/li>\n<li>\u7f13\u5b58\u3001\u8bfb\u5199\u5206\u79bb\u3001\u591a\u6570\u636e\u6e90\u3001\u5206\u5e03\u5f0f\u80fd\u529b&#xff0c;\u5168\u90e8\u590d\u7528 Spring \u53ca\u4e3b\u6d41\u4e2d\u95f4\u4ef6\u3002<\/li>\n<\/ul>\n<hr \/>\n<h3>\u516d\u3001\u8303\u5f0f\u666e\u9002\u6027&#xff1a;\u8de8\u8bed\u8a00\u843d\u5730\u9a8c\u8bc1<\/h3>\n<p>SQL \u662f\u8de8\u8bed\u8a00\u901a\u7528\u6807\u51c6&#xff0c;\u56e0\u6b64 SQL-First \u8303\u5f0f\u4e0d\u5c40\u9650\u4e8e Java&#xff0c;\u76ee\u524d\u5df2\u5728 8 \u79cd\u4e3b\u6d41\u540e\u7aef\u8bed\u8a00\u5b8c\u6210\u6807\u51c6\u5316\u843d\u5730&#xff1a;<\/p>\n<table>\n<tr>\u7f16\u7a0b\u8bed\u8a00\u5e95\u5c42\u4f9d\u8d56\u8303\u5f0f\u5b9e\u73b0\u5f62\u6001<\/tr>\n<tbody>\n<tr>\n<td>Java<\/td>\n<td>Spring JDBC<\/td>\n<td>simple-dao \u7b49\u5f00\u6e90\/\u81ea\u7814\u6846\u67b6<\/td>\n<\/tr>\n<tr>\n<td>C#<\/td>\n<td>Dapper<\/td>\n<td>\u540c\u6b3e Condition &#043; Dao \u5206\u5c42<\/td>\n<\/tr>\n<tr>\n<td>Go \/ Rust<\/td>\n<td>sqlx<\/td>\n<td>\u6761\u4ef6\u7ec4\u88c5 &#043; \u539f\u751fSQL\u6a21\u5f0f<\/td>\n<\/tr>\n<tr>\n<td>Python<\/td>\n<td>SQLAlchemy Core<\/td>\n<td>\u8bed\u4e49\u5316\u6761\u4ef6\u5355\u5143<\/td>\n<\/tr>\n<tr>\n<td>PHP \/ Node.js \/ C&#043;&#043;<\/td>\n<td>\u539f\u751f\u6570\u636e\u5e93\u9a71\u52a8<\/td>\n<td>\u7edf\u4e00\u5206\u5c42\u601d\u60f3<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6240\u6709\u8de8\u8bed\u8a00\u5b9e\u73b0\u5747\u9075\u5b88\u540c\u4e00\u5957\u6838\u5fc3\u89c4\u5219&#xff1a;<\/p>\n<li>\u6761\u4ef6\u5c42\u8bed\u4e49\u65b9\u6cd5\u547d\u540d\u3001\u903b\u8f91\u4e00\u81f4&#xff1b;<\/li>\n<li>SQL \u5b8c\u5168\u900f\u660e&#xff0c;\u5f02\u5e38\u539f\u751f\u900f\u4f20&#xff1b;<\/li>\n<li>\u5355\u8868\u80fd\u529b\u81ea\u52a8\u5316&#xff0c;\u590d\u6742SQL\u624b\u5199\u3002<\/li>\n<p>\u8fd9\u8db3\u4ee5\u8bc1\u660e&#xff1a;SQL-First \u4e0d\u662f\u67d0\u4e00\u6b3e\u6846\u67b6&#xff0c;\u800c\u662f\u4e00\u5957\u901a\u7528\u8f6f\u4ef6\u5de5\u7a0b\u7406\u8bba\u3002<\/p>\n<hr \/>\n<h3>\u4e03\u3001\u8303\u5f0f\u9009\u578b\u4e0e\u9002\u7528\u573a\u666f<\/h3>\n<h4>7.1 \u9002\u7528\u573a\u666f<\/h4>\n<li>\u653f\u4f01\u3001\u6821\u56ed\u3001ERP\u3001\u540e\u52e4\u3001\u5fae\u670d\u52a1\u7b49\u591a\u8868\u8054\u67e5\u3001\u62a5\u8868\u3001\u7edf\u8ba1\u7c7b\u7cfb\u7edf&#xff1b;<\/li>\n<li>\u56e2\u961f\u8ffd\u6c42\u4ee3\u7801\u7edf\u4e00\u3001\u4f4e\u7ef4\u62a4\u6210\u672c&#xff0c;\u538c\u6076 XML \u548c\u590d\u6742\u6846\u67b6\u8bed\u6cd5&#xff1b;<\/li>\n<li>\u957f\u671f\u8fed\u4ee3\u3001\u591a\u4eba\u534f\u4f5c\u7684\u4f20\u7edf\u4e1a\u52a1\u5e73\u53f0&#xff0c;\u9700\u8981\u517c\u987e\u5355\u8868 CRUD \u4e0e\u590d\u6742\u67e5\u8be2&#xff1b;<\/li>\n<li>\u6280\u672f\u6808\u4ee5 Spring \u751f\u6001\u4e3a\u4e3b&#xff0c;\u5e0c\u671b\u5c3d\u91cf\u5c11\u5f15\u5165\u7b2c\u4e09\u65b9\u63d2\u4ef6\u3002<\/li>\n<h4>7.2 \u6a2a\u5411\u9009\u578b\u603b\u7ed3<\/h4>\n<table>\n<tr>\u65b9\u6848\u6838\u5fc3\u7279\u5f81\u4e0e SQL-First \u7684\u5dee\u5f02<\/tr>\n<tbody>\n<tr>\n<td>ORM (JPA\/Hibernate)<\/td>\n<td>\u5355\u8868\u5bf9\u8c61\u5316\u3001\u7ea7\u8054\u3001\u810f\u68c0\u67e5<\/td>\n<td>SQL-First \u4e0d\u7ba1\u7406\u5bf9\u8c61\u751f\u547d\u5468\u671f&#xff0c;\u590d\u6742\u67e5\u8be2\u76f4\u63a5\u5199 SQL<\/td>\n<\/tr>\n<tr>\n<td>MyBatis<\/td>\n<td>SQL \u81ea\u7531\u3001XML\/OGNL \u52a8\u6001\u6761\u4ef6\u3001resultMap<\/td>\n<td>SQL-First \u53bb\u6389 XML \u5c42\u548c OGNL&#xff0c;\u6761\u4ef6\u7528 Java \u8bed\u4e49\u5355\u5143\u7ba1\u7406<\/td>\n<\/tr>\n<tr>\n<td>\u539f\u751f Spring JDBC<\/td>\n<td>\u80fd\u529b\u6700\u5f3a\u3001\u767d\u76d2\u900f\u660e<\/td>\n<td>SQL-First \u5728 Spring JDBC \u57fa\u7840\u4e0a\u8865\u9f50\u5355\u8868\u81ea\u52a8\u5316\u548c\u6761\u4ef6\u6807\u51c6\u5316<\/td>\n<\/tr>\n<tr>\n<td>SQL-First (simple-dao)<\/td>\n<td>\u7ee7\u627f Spring JDBC \u5168\u90e8\u80fd\u529b&#xff0c;\u7edf\u4e00\u5355\u8868\/\u8054\u8868 API<\/td>\n<td>\u9762\u5411\u4e1a\u52a1\u7ed3\u679c\u8bbe\u8ba1&#xff0c;\u6781\u7b80\u3001\u767d\u76d2\u3001\u96f6\u989d\u5916\u8bed\u6cd5\u5b66\u4e60<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>\u516b\u3001\u603b\u7ed3&#xff1a;\u56de\u5230\u6301\u4e45\u5c42\u8bbe\u8ba1\u7684\u672c\u8d28<\/h3>\n<li>\u5e95\u5c42\u8ba4\u77e5&#xff1a;3GL&#xff08;\u7f16\u7a0b\u8bed\u8a00&#xff09;\u4e0e 4GL&#xff08;SQL&#xff09;\u5b58\u5728\u5929\u7136\u9e3f\u6c9f&#xff0c;\u5f3a\u884c\u4e92\u76f8\u7ffb\u8bd1\u7684\u6846\u67b6\u5b58\u5728\u5148\u5929\u8fb9\u754c&#xff0c;\u591a\u5c42\u5305\u88c5\u7684\u5de5\u7a0b\u4f53\u7cfb\u8fc7\u4e8e\u81c3\u80bf&#xff1b;<\/li>\n<li>\u8303\u5f0f\u6838\u5fc3&#xff1a;SQL-First \u627f\u8ba4\u4e24\u7c7b\u8bed\u8a00\u7684\u5dee\u5f02&#xff0c;\u4e0d\u505a\u7ffb\u8bd1&#xff0c;\u53ea\u505a\u8f7b\u91cf\u5316\u6865\u6881\u3002\u7a33\u5b9a SQL \u7247\u6bb5\u624b\u5199&#xff0c;\u52a8\u6001\u6761\u4ef6\u7528 Java \u5de5\u7a0b\u5316\u7ba1\u7406&#xff0c;\u5404\u53f8\u5176\u804c&#xff1b;<\/li>\n<li>\u67b6\u6784\u4ef7\u503c&#xff1a;\u4e09\u5c42\u67b6\u6784 &#043; \u8bed\u4e49\u5316\u6761\u4ef6\u5355\u5143&#xff0c;\u7edf\u4e00\u5355\u8868\/\u8054\u8868\u5199\u6cd5&#xff0c;\u6d88\u706d\u5272\u88c2\u611f&#xff0c;\u4ee3\u7801\u7cbe\u7b80\u3001\u89c4\u8303\u7edf\u4e00&#xff1b;<\/li>\n<li>\u8bbe\u8ba1\u76ee\u6807&#xff1a;<\/li>\n<p>\u6700\u597d\u7684\u6301\u4e45\u5c42\u6846\u67b6&#xff0c;\u662f\u5f00\u53d1\u8005\u5199\u5b8c\u4e1a\u52a1\u4ee3\u7801\u540e&#xff0c;\u51e0\u4e4e\u611f\u53d7\u4e0d\u5230\u6846\u67b6\u7684\u5b58\u5728\u3002 \u8ba9 SQL \u56de\u5f52 SQL&#xff0c;\u8ba9 Java \u56de\u5f52 Java&#xff0c;\u8fd9\u5c31\u662f SQL-First \u8303\u5f0f\u7684\u8ffd\u6c42\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SQL-First \u8303\u5f0f&#xff1a;\u4e00\u79cd\u9762\u5411\u4e1a\u52a1\u7ed3\u679c\u7684\u6301\u4e45\u5c42\u8bbe\u8ba1<br \/>\n\u524d\u8a00<br \/>\n\u5728 Java \u540e\u7aef\u6301\u4e45\u5c42\u9886\u57df&#xff0c;ORM&#xff08;JPA\/Hibernate&#xff09;\u3001MyBatis \u957f\u671f\u5360\u636e\u4e3b\u6d41&#xff0c;\u4f46\u5f00\u53d1\u8005\u5728\u957f\u671f\u5b9e\u6218\u4e2d\u5e38\u9047\u5230\u4e00\u4e2a\u6838\u5fc3\u77db\u76fe&#xff1a;\u9762\u5411\u5bf9\u8c61\u7684\u7f16\u7a0b\u8bed\u8a00&#xff08;3GL&#xff09;\u548c\u58f0\u660e\u5f0f SQL&#xff08;4GL&#xff09;\u5b58\u5728\u5929\u7136\u8bed\u4e49\u9e3f\u6c9f\u3002\u5f3a\u884c\u7528\u5bf9\u8c61\u601d\u7ef4\u5c01\u88c5 SQL&#xff0c;\u6216\u662f\u7528\u591a\u5c42\u6807\u7b7e\u9694\u79bb S<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99,101,768,292,100],"topic":[],"class_list":["post-91866","post","type-post","status-publish","format-standard","hentry","category-server","tag-java","tag-spring","tag-sql","tag-292","tag-100"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SQL-First \u8303\u5f0f\uff1a\u4e00\u79cd\u9762\u5411\u4e1a\u52a1\u7ed3\u679c\u7684\u6301\u4e45\u5c42\u8bbe\u8ba1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/91866.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL-First \u8303\u5f0f\uff1a\u4e00\u79cd\u9762\u5411\u4e1a\u52a1\u7ed3\u679c\u7684\u6301\u4e45\u5c42\u8bbe\u8ba1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"SQL-First \u8303\u5f0f&#xff1a;\u4e00\u79cd\u9762\u5411\u4e1a\u52a1\u7ed3\u679c\u7684\u6301\u4e45\u5c42\u8bbe\u8ba1 \u524d\u8a00 \u5728 Java \u540e\u7aef\u6301\u4e45\u5c42\u9886\u57df&#xff0c;ORM&#xff08;JPA\/Hibernate&#xff09;\u3001MyBatis \u957f\u671f\u5360\u636e\u4e3b\u6d41&#xff0c;\u4f46\u5f00\u53d1\u8005\u5728\u957f\u671f\u5b9e\u6218\u4e2d\u5e38\u9047\u5230\u4e00\u4e2a\u6838\u5fc3\u77db\u76fe&#xff1a;\u9762\u5411\u5bf9\u8c61\u7684\u7f16\u7a0b\u8bed\u8a00&#xff08;3GL&#xff09;\u548c\u58f0\u660e\u5f0f SQL&#xff08;4GL&#xff09;\u5b58\u5728\u5929\u7136\u8bed\u4e49\u9e3f\u6c9f\u3002\u5f3a\u884c\u7528\u5bf9\u8c61\u601d\u7ef4\u5c01\u88c5 SQL&#xff0c;\u6216\u662f\u7528\u591a\u5c42\u6807\u7b7e\u9694\u79bb S\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/91866.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-08T08:16:48+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/91866.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/91866.html\",\"name\":\"SQL-First \u8303\u5f0f\uff1a\u4e00\u79cd\u9762\u5411\u4e1a\u52a1\u7ed3\u679c\u7684\u6301\u4e45\u5c42\u8bbe\u8ba1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-08T08:16:48+00:00\",\"dateModified\":\"2026-08-08T08:16:48+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/91866.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/91866.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/91866.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL-First \u8303\u5f0f\uff1a\u4e00\u79cd\u9762\u5411\u4e1a\u52a1\u7ed3\u679c\u7684\u6301\u4e45\u5c42\u8bbe\u8ba1\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SQL-First \u8303\u5f0f\uff1a\u4e00\u79cd\u9762\u5411\u4e1a\u52a1\u7ed3\u679c\u7684\u6301\u4e45\u5c42\u8bbe\u8ba1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/91866.html","og_locale":"zh_CN","og_type":"article","og_title":"SQL-First \u8303\u5f0f\uff1a\u4e00\u79cd\u9762\u5411\u4e1a\u52a1\u7ed3\u679c\u7684\u6301\u4e45\u5c42\u8bbe\u8ba1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"SQL-First \u8303\u5f0f&#xff1a;\u4e00\u79cd\u9762\u5411\u4e1a\u52a1\u7ed3\u679c\u7684\u6301\u4e45\u5c42\u8bbe\u8ba1 \u524d\u8a00 \u5728 Java \u540e\u7aef\u6301\u4e45\u5c42\u9886\u57df&#xff0c;ORM&#xff08;JPA\/Hibernate&#xff09;\u3001MyBatis \u957f\u671f\u5360\u636e\u4e3b\u6d41&#xff0c;\u4f46\u5f00\u53d1\u8005\u5728\u957f\u671f\u5b9e\u6218\u4e2d\u5e38\u9047\u5230\u4e00\u4e2a\u6838\u5fc3\u77db\u76fe&#xff1a;\u9762\u5411\u5bf9\u8c61\u7684\u7f16\u7a0b\u8bed\u8a00&#xff08;3GL&#xff09;\u548c\u58f0\u660e\u5f0f SQL&#xff08;4GL&#xff09;\u5b58\u5728\u5929\u7136\u8bed\u4e49\u9e3f\u6c9f\u3002\u5f3a\u884c\u7528\u5bf9\u8c61\u601d\u7ef4\u5c01\u88c5 SQL&#xff0c;\u6216\u662f\u7528\u591a\u5c42\u6807\u7b7e\u9694\u79bb S","og_url":"https:\/\/www.wsisp.com\/helps\/91866.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-08T08:16:48+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/91866.html","url":"https:\/\/www.wsisp.com\/helps\/91866.html","name":"SQL-First \u8303\u5f0f\uff1a\u4e00\u79cd\u9762\u5411\u4e1a\u52a1\u7ed3\u679c\u7684\u6301\u4e45\u5c42\u8bbe\u8ba1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-08T08:16:48+00:00","dateModified":"2026-08-08T08:16:48+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/91866.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/91866.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/91866.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"SQL-First \u8303\u5f0f\uff1a\u4e00\u79cd\u9762\u5411\u4e1a\u52a1\u7ed3\u679c\u7684\u6301\u4e45\u5c42\u8bbe\u8ba1"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/91866","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=91866"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/91866\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=91866"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=91866"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=91866"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=91866"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}