From db7fc9f145beb76bbef19b1812d63d2ffc2d0df9 Mon Sep 17 00:00:00 2001
From: ChenJiaHe <763432473@qq.com>
Date: 星期三, 25 十一月 2020 18:25:48 +0800
Subject: [PATCH] 优化

---
 src/main/java/com/hx/mybatisTool/SqlSentence.java |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/hx/mybatisTool/SqlSentence.java b/src/main/java/com/hx/mybatisTool/SqlSentence.java
index a888e46..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;
@@ -84,6 +85,35 @@
 		m = values;
 	}
 
+	/**
+	 * 鏌ヨ鐨勮鍙�
+	 * @param sql 濡傦細id = #{m.userId} order by age DESC
+	 * @param values 瀛樻斁鐨勫�煎锛歷alues.put("userId","123456")
+	 */
+	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;
+	}
+
 	
 	/************************************************************************/
 
@@ -131,7 +161,6 @@
     {
         return (startPage - 1) * pageNum;
     }
-
 }
 
 

--
Gitblit v1.8.0