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(); + } + +}