From 7d4f60e89deb83eec95f9cbe84824bcefcac2929 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期一, 19 七月 2021 18:48:11 +0800
Subject: [PATCH] fix 代码生成 queryType 重复勾选数据库无默认值问题
---
ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java | 77 ++++----------------------------------
1 files changed, 8 insertions(+), 69 deletions(-)
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java
index ebf2376..632c0fb 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java
@@ -1,28 +1,13 @@
package com.ruoyi.common.core.controller;
-import cn.hutool.core.lang.Validator;
import cn.hutool.core.util.StrUtil;
-import cn.hutool.http.HttpStatus;
-import com.github.pagehelper.PageHelper;
-import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.core.page.PageDomain;
-import com.ruoyi.common.core.page.TableDataInfo;
-import com.ruoyi.common.core.page.TableSupport;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.sql.SqlUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.web.bind.WebDataBinder;
-import org.springframework.web.bind.annotation.InitBinder;
-
-import java.beans.PropertyEditorSupport;
-import java.util.Date;
-import java.util.List;
/**
* web灞傞�氱敤鏁版嵁澶勭悊
- *
+ *
* @author ruoyi
*/
public class BaseController
@@ -30,58 +15,12 @@
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
/**
- * 灏嗗墠鍙颁紶閫掕繃鏉ョ殑鏃ユ湡鏍煎紡鐨勫瓧绗︿覆锛岃嚜鍔ㄨ浆鍖栦负Date绫诲瀷
- */
- @InitBinder
- public void initBinder(WebDataBinder binder)
- {
- // Date 绫诲瀷杞崲
- binder.registerCustomEditor(Date.class, new PropertyEditorSupport()
- {
- @Override
- public void setAsText(String text)
- {
- setValue(DateUtils.parseDate(text));
- }
- });
- }
-
- /**
- * 璁剧疆璇锋眰鍒嗛〉鏁版嵁
- */
- protected void startPage()
- {
- PageDomain pageDomain = TableSupport.buildPageRequest();
- Integer pageNum = pageDomain.getPageNum();
- Integer pageSize = pageDomain.getPageSize();
- if (Validator.isNotNull(pageNum) && Validator.isNotNull(pageSize))
- {
- String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
- PageHelper.startPage(pageNum, pageSize, orderBy);
- }
- }
-
- /**
- * 鍝嶅簲璇锋眰鍒嗛〉鏁版嵁
- */
- @SuppressWarnings({ "rawtypes", "unchecked" })
- protected TableDataInfo getDataTable(List<?> list)
- {
- TableDataInfo rspData = new TableDataInfo();
- rspData.setCode(HttpStatus.HTTP_OK);
- rspData.setMsg("鏌ヨ鎴愬姛");
- rspData.setRows(list);
- rspData.setTotal(new PageInfo(list).getTotal());
- return rspData;
- }
-
- /**
* 鍝嶅簲杩斿洖缁撴灉
- *
+ *
* @param rows 褰卞搷琛屾暟
* @return 鎿嶄綔缁撴灉
*/
- protected AjaxResult toAjax(int rows)
+ protected AjaxResult<Void> toAjax(int rows)
{
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
}
@@ -92,7 +31,7 @@
* @param result 缁撴灉
* @return 鎿嶄綔缁撴灉
*/
- protected AjaxResult toAjax(boolean result)
+ protected AjaxResult<Void> toAjax(boolean result)
{
return result ? success() : error();
}
@@ -100,7 +39,7 @@
/**
* 杩斿洖鎴愬姛
*/
- public AjaxResult success()
+ public AjaxResult<Void> success()
{
return AjaxResult.success();
}
@@ -108,7 +47,7 @@
/**
* 杩斿洖澶辫触娑堟伅
*/
- public AjaxResult error()
+ public AjaxResult<Void> error()
{
return AjaxResult.error();
}
@@ -116,7 +55,7 @@
/**
* 杩斿洖鎴愬姛娑堟伅
*/
- public AjaxResult success(String message)
+ public AjaxResult<Void> success(String message)
{
return AjaxResult.success(message);
}
@@ -124,7 +63,7 @@
/**
* 杩斿洖澶辫触娑堟伅
*/
- public AjaxResult error(String message)
+ public AjaxResult<Void> error(String message)
{
return AjaxResult.error(message);
}
--
Gitblit v1.9.3