From b7ab9f397ef2322fa0e79ab51fc16cbd77399835 Mon Sep 17 00:00:00 2001 From: E1ED922C1E9526DD63272D7EC5C6CB77 <E1ED922C1E9526DD63272D7EC5C6CB77@i-search.com.cn> Date: 星期五, 16 四月 2021 11:53:32 +0800 Subject: [PATCH] 添加小程序红包接口 --- src/main/java/com/hx/mybatisTool/SqlSentence.java | 47 ++++++++++++++++++++++++++--------------------- 1 files changed, 26 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/hx/mybatisTool/SqlSentence.java b/src/main/java/com/hx/mybatisTool/SqlSentence.java index 280ef0a..e0705c9 100644 --- a/src/main/java/com/hx/mybatisTool/SqlSentence.java +++ b/src/main/java/com/hx/mybatisTool/SqlSentence.java @@ -1,6 +1,7 @@ package com.hx.mybatisTool; import com.hx.exception.TipsException; +import com.hx.util.SimpleTool; import com.hx.util.StringUtils; import java.util.Map; @@ -15,8 +16,6 @@ private String sqlSentence; private Map<String,Object> m; - /**绫诲瀷*/ - private Integer type = TYPE_NORMAL; /**鎺掑簭*/ private String orderBy; /**寮�濮嬮〉鏁�*/ @@ -25,10 +24,6 @@ private Integer pageNum = 0; ////////////////////////////////////////////////////////////// - /**姝e父*/ - public static final int TYPE_NORMAL = 0; - /**鍔ㄦ��*/ - public static final int TYPE_DYN = 1; /********************mother****************************/ @@ -91,13 +86,32 @@ } /** - * 璁剧疆鍔ㄦ�佹煡璇� - * @param map 鏌ヨ + * 鏌ヨ鐨勮鍙� + * @param sql 濡傦細id = #{m.userId} order by age DESC + * @param values 瀛樻斁鐨勫�煎锛歷alues.put("userId","123456") */ - public void setDynSql(Map<String, Object> map) - { - this.type = TYPE_DYN; - this.m = map; + public void sqlWhere(String sql,Map<String,Object> values) { + if(!SimpleTool.checkNotNull(values)){ + throw new TipsException("values is null"); + } + if(!SimpleTool.checkNotNull(sql)) { + sql = "1=1"; + } + sqlSentence = sql; + m = values; + } + + /** + * 鏇存柊璇彞鐨勮鍙� + * @param sql 濡傦細name = #{m.name},age = ? WHERE id = #{m.id} + * @param values 瀛樻斁鐨勫�� + */ + public void sqlUpdate(String sql,Map<String,Object> values) { + if(!SimpleTool.checkNotNull(values)){ + throw new TipsException("values is null"); + } + m = values; + sqlSentence = sql; } @@ -117,14 +131,6 @@ public void setSqlSentence(String sqlSentence) { this.sqlSentence = sqlSentence; - } - - public Integer getType() { - return type; - } - - public void setType(Integer type) { - this.type = type; } public String getOrderBy() { @@ -155,7 +161,6 @@ { return (startPage - 1) * pageNum; } - } -- Gitblit v1.8.0