From ef6d24682eebebffbb748cc05d58de314c9ed4c8 Mon Sep 17 00:00:00 2001 From: "wei.peng" Date: Thu, 28 Feb 2019 16:24:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=20=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96=20=E8=BD=AF=E9=80=82?= =?UTF-8?q?=E9=85=8D=20=E9=A1=B9=E7=9B=AE=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E5=A2=9E=E5=88=A0=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/i3plus-pojo-softswitch/pom.xml | 6 +++ .../i3plus/pojo/softswitch/bean/TestDataBase.java | 39 +++++++++++++++++++ .../repository/TestDataBaseRepository.java | 14 +++++++ .../pojo/softswitch/sqlpack/SoftswitchHqlPack.java | 44 ++++++++++++++++++++++ 4 files changed, 103 insertions(+) create mode 100644 modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/TestDataBase.java create mode 100644 modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/repository/TestDataBaseRepository.java create mode 100644 modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/sqlpack/SoftswitchHqlPack.java diff --git a/modules/i3plus-pojo-softswitch/pom.xml b/modules/i3plus-pojo-softswitch/pom.xml index 848da05..81fb02b 100644 --- a/modules/i3plus-pojo-softswitch/pom.xml +++ b/modules/i3plus-pojo-softswitch/pom.xml @@ -13,5 +13,11 @@ i3plus-pojo-softswitch jar + + + i3plus.pojo + i3plus-pojo-base + + \ No newline at end of file diff --git a/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/TestDataBase.java b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/TestDataBase.java new file mode 100644 index 0000000..eaa600d --- /dev/null +++ b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/bean/TestDataBase.java @@ -0,0 +1,39 @@ +package cn.estsh.i3plus.pojo.softswitch.bean; + +import cn.estsh.i3plus.pojo.base.bean.BaseBean; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiParam; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.hibernate.annotations.DynamicInsert; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Table; + +/** + * @Description : + * @Reference : + * @Author : Adair Peng + * @CreateDate : 2019-02-28 15:48 + * @Modify: + **/ +@Data +@Entity +@DynamicInsert +@DynamicUpdate +@EqualsAndHashCode(callSuper = true) +@Table(name="TEST_DATA_BASE") +@Api(value="测试数据 DataBase",description = "数据库操作测试") +public class TestDataBase extends BaseBean { + + @Column(name="NAME") + @ApiParam(value ="名称" ) + private String name; + + @Column(name="TYPE") + @ApiParam(value ="测试类型" ) + private Integer type; + +} diff --git a/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/repository/TestDataBaseRepository.java b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/repository/TestDataBaseRepository.java new file mode 100644 index 0000000..3cf2b11 --- /dev/null +++ b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/repository/TestDataBaseRepository.java @@ -0,0 +1,14 @@ +package cn.estsh.i3plus.pojo.softswitch.repository; + +import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository; +import cn.estsh.i3plus.pojo.softswitch.bean.TestDataBase; + +/** + * @Description : + * @Reference : + * @Author : Adair Peng + * @CreateDate : 2019-02-28 15:48 + * @Modify: + **/ +public interface TestDataBaseRepository extends BaseRepository { +} diff --git a/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/sqlpack/SoftswitchHqlPack.java b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/sqlpack/SoftswitchHqlPack.java new file mode 100644 index 0000000..5f721ec --- /dev/null +++ b/modules/i3plus-pojo-softswitch/src/main/java/cn/estsh/i3plus/pojo/softswitch/sqlpack/SoftswitchHqlPack.java @@ -0,0 +1,44 @@ +package cn.estsh.i3plus.pojo.softswitch.sqlpack; + +import cn.estsh.i3plus.pojo.base.tool.HqlPack; +import cn.estsh.i3plus.pojo.softswitch.bean.TestDataBase; +import org.apache.commons.lang3.StringUtils; + +/** + * @Description : + * @Reference : + * @Author : Adair Peng + * @CreateDate : 2019-02-28 16:05 + * @Modify: + **/ +public class SoftswitchHqlPack { + + + /** + * In 参数封装 + * @param columnName + * @return + */ + public static String packHqlIds(String columnName,String[] params){ + StringBuffer result = new StringBuffer(); + + // 参数数组 [1,2,3] -> "1,2,3" + HqlPack.getInPack(String.join(",",params),columnName,result); + return result.toString(); + } + + /** + * 目录查询封装 + * @param testDataBase + * @return + */ + public static String packHqlTestDataBase(TestDataBase testDataBase){ + StringBuffer result = new StringBuffer(); + + // 查询参数封装 + HqlPack.getStringLikerPack(testDataBase.getName(),"name",result); + + return result.toString(); + } + +}