From 6a194da9319394d6d136b3f3c5bcb77227693cd3 Mon Sep 17 00:00:00 2001 From: WJY Date: Sat, 9 Apr 2022 07:34:55 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9module=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E4=B8=BAmaven-example=EF=BC=8C=E4=B8=8E=E4=BB=93=E5=BA=93?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E5=90=8C=E5=90=8D=EF=BC=8C=E9=98=B2=E6=AD=A2?= =?UTF-8?q?=E6=AD=A7=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 07e3e60..461ca72 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 me.danwi.sqlex - example + maven-example 1.0-SNAPSHOT From 48e18d0b3140c8b7904a1e1dc18a117754da9a10 Mon Sep 17 00:00:00 2001 From: WJY Date: Sat, 9 Apr 2022 07:35:34 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=8D=87=E7=BA=A7sqlex=20maven=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E7=89=88=E6=9C=AC=E4=B8=BA0.0.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 461ca72..e8cfdc8 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ me.danwi.sqlex core - 0.0.3 + 0.0.4 @@ -26,11 +26,10 @@ me.danwi.sqlex sqlex-maven-plugin - 0.0.3 + 0.0.4 - add-source generate From 89fcc2fd1b287413ca3a3c07a314d76720270fe7 Mon Sep 17 00:00:00 2001 From: WJY Date: Sat, 9 Apr 2022 07:36:14 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E9=80=9A=E8=BF=87pom=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=8C=87=E5=AE=9Ajava=E5=92=8Csqlex=E6=BA=90=E7=A0=81=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=EF=BC=8C=E9=98=B2=E6=AD=A2=E7=BC=96=E8=BE=91=E5=99=A8?= =?UTF-8?q?=E4=B8=8D=E8=AF=86=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pom.xml b/pom.xml index e8cfdc8..2f946a5 100644 --- a/pom.xml +++ b/pom.xml @@ -22,6 +22,15 @@ + + + ${basedir}/src/main/java + + + + ${basedir}/src/main/sqlex + + me.danwi.sqlex From e68c50b1bec285ee49611e19334dcc22248cbf8e Mon Sep 17 00:00:00 2001 From: WJY Date: Sat, 9 Apr 2022 07:37:11 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=8D=87=E7=BA=A70.0.4?= =?UTF-8?q?=E5=90=8E=E6=8F=92=E4=BB=B6=E6=8F=90=E7=A4=BA=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=8E=A8=E8=8D=90=E6=96=B9=E6=B3=95=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E9=83=A8=E5=88=86=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/me/danwi/sqlex/example/Main.java | 10 +++++----- src/main/sqlex/me/danwi/sqlex/example/dao/RoleDao.sqlm | 3 ++- src/main/sqlex/me/danwi/sqlex/example/dao/UserDao.sqlm | 9 ++++++--- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main/java/me/danwi/sqlex/example/Main.java b/src/main/java/me/danwi/sqlex/example/Main.java index 1fde133..ea6c7d1 100644 --- a/src/main/java/me/danwi/sqlex/example/Main.java +++ b/src/main/java/me/danwi/sqlex/example/Main.java @@ -15,11 +15,11 @@ public static void main(String[] args) { UserDao userDao = dataSource.getInstance(UserDao.class); RoleDao roleDao = dataSource.getInstance(RoleDao.class); - userDao.getAll(10, "123", null); - userDao.getAll(10, "123", new ArrayList()); - userDao.getAllByRole("123"); - userDao.getCountsByRole(); + userDao.findAll(10, "123", null); + userDao.findAll(10, "123", new ArrayList()); + userDao.findAllByRole("123"); + userDao.findCountsByRole(); - roleDao.getAll("管"); + roleDao.findAll("管"); } } diff --git a/src/main/sqlex/me/danwi/sqlex/example/dao/RoleDao.sqlm b/src/main/sqlex/me/danwi/sqlex/example/dao/RoleDao.sqlm index 8ee28ce..ebc0d62 100644 --- a/src/main/sqlex/me/danwi/sqlex/example/dao/RoleDao.sqlm +++ b/src/main/sqlex/me/danwi/sqlex/example/dao/RoleDao.sqlm @@ -1,4 +1,5 @@ -getAll(name:String) { +# 模糊查询指定名称角色信息 +findAll(name:String) { select * from role where name like concat('?', :name, '?') diff --git a/src/main/sqlex/me/danwi/sqlex/example/dao/UserDao.sqlm b/src/main/sqlex/me/danwi/sqlex/example/dao/UserDao.sqlm index 3ed276c..ed31e98 100644 --- a/src/main/sqlex/me/danwi/sqlex/example/dao/UserDao.sqlm +++ b/src/main/sqlex/me/danwi/sqlex/example/dao/UserDao.sqlm @@ -1,4 +1,5 @@ -getAll(age:Integer, name:String, names:String*) { +# 测试 in 查询 +findAll(age:Integer, name:String, names:String*) { select * from user where age > :age @@ -6,14 +7,16 @@ getAll(age:Integer, name:String, names:String*) { and name in (:names) } -getAllByRole(roleId:String) { +# 根据角色id查询用户 +findAllByRole(roleId:String) { select u.* from user u inner join user_role_mapping m on u.id = m.user where m.role = :roleId } -getCountsByRole() { +# 查询每个用户充当角色数量 +findCountsByRole() { select u.id, count(1) as amount from user u inner join user_role_mapping m on u.id = m.user From 11b2f2a3d66d0a0bd07aac03a61c43a673bf4daf Mon Sep 17 00:00:00 2001 From: WJY Date: Sun, 10 Apr 2022 08:36:21 +0800 Subject: [PATCH 5/5] =?UTF-8?q?1.=20maven=E9=BB=98=E8=AE=A4=E4=BD=BF?= =?UTF-8?q?=E7=94=A8src/main/java=E4=BD=9C=E4=B8=BA=E6=BA=90=E7=A0=81?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=EF=BC=8C=E5=88=A0=E9=99=A4src/main/java?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E7=9B=AE=E5=BD=95=202.=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=8C=87=E5=AE=9Asqlex=E4=B8=BA=E8=B5=84=E6=BA=90=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 2f946a5..5c24957 100644 --- a/pom.xml +++ b/pom.xml @@ -23,10 +23,7 @@ - - ${basedir}/src/main/java - - + ${basedir}/src/main/sqlex