瀏覽代碼

客户转移&客户转移申请

xdd 2 周之前
父節點
當前提交
37adbd8ef1

+ 7 - 0
fs-company/src/main/java/com/fs/core/exception/FSExceptionHandler.java

@@ -21,6 +21,8 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
 import org.springframework.web.bind.annotation.RestControllerAdvice;
 import org.springframework.web.servlet.NoHandlerFoundException;
 
+import java.sql.SQLSyntaxErrorException;
+
 
 /**
  * 异常处理器
@@ -53,6 +55,11 @@ public class FSExceptionHandler {
 		return R.error("数据库中已存在该记录");
 	}
 
+	@ExceptionHandler(SQLSyntaxErrorException.class)
+	public R handleSQLSyntaxErrorException(SQLSyntaxErrorException e){
+		logger.error(e.getMessage(), e);
+		return R.error("SQL语法错误,请联系管理员!");
+	}
 
 	@ExceptionHandler(Exception.class)
 	public R handleException(Exception e){

+ 13 - 13
fs-service-system/src/main/resources/mapper/store/FsUserMapper.xml

@@ -188,15 +188,15 @@
         fs_user `user` join (
         select user_id from fs_user
         <where>
-            <if test="companyId != null">
-                company_id = #{companyId}
+            <if test="companyId != null and companyId != ''">
+                AND company_id = #{companyId}
             </if>
-            <if test="companyUserId != null">
-                company_user_id = #{companyUserId}
+            <if test="companyUserId != null and companyUserId != ''">
+                AND company_user_id = #{companyUserId}
+            </if>
+            <if test="phone != null and phone != ''">
+                AND phone = #{phone}
             </if>
-           <if test="phone != null">
-               phone = #{phone}
-           </if>
         </where>
         order by user_id desc
         limit ${(pageNum-1)*pageSize},${pageSize}
@@ -206,14 +206,14 @@
         SELECT COUNT(user_id)
         FROM fs_user
         <where>
-            <if test="companyId != null">
-                company_id = #{companyId}
+            <if test="companyId != null and companyId != ''">
+                AND company_id = #{companyId}
             </if>
-            <if test="companyUserId != null">
-                company_user_id = #{companyUserId}
+            <if test="companyUserId != null and companyUserId != ''">
+                AND company_user_id = #{companyUserId}
             </if>
-            <if test="phone != null">
-                phone = #{phone}
+            <if test="phone != null and phone != ''">
+                AND phone = #{phone}
             </if>
         </where>
     </select>