<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ``` /** * @author 張躍帥 * @Description: 數據庫DML-執行器 * @date 2020/08/12 */ public class DmlRun { private static final DmlMapper dmlMapper = SpringUtil.getBean(DmlMapper.class); /** * 通用查詢-獲取List列表 */ public static List<Dict> selectList(String sql) { // 變量創建ArrayList List<Dict> resultDictList = CollectionUtil.newArrayList(); // 判斷 if (StrUtil.isNotBlank(sql)) { // 執行SQL resultDictList = dmlMapper.selectList(sql); } else { // 拋出異常 throw new MyException(DmlExceptionEnum.SQL_NOT_NULL); } // 返回 return resultDictList; } /** * 通用查詢-獲取一條數據 */ public static Dict selectOne(String sql) { // 變量創建Dict Dict resultDict = Dict.create(); // 判斷 if (StrUtil.isNotBlank(sql)) { // 執行SQL resultDict = dmlMapper.selectOne(sql); } else { // 拋出異常 throw new MyException(DmlExceptionEnum.SQL_NOT_NULL); } // 返回 return resultDict; } /** * 通用查詢-獲取總記錄數 */ public static long selectCount(String sql) { // 變量 long resultCount = 0L; // 判斷 if (StrUtil.isNotBlank(sql)) { // 執行SQL resultCount = dmlMapper.selectCount(sql); } else { // 拋出異常 throw new MyException(DmlExceptionEnum.SQL_NOT_NULL); } // 返回 return resultCount; } /** * 通用新增 */ public static boolean insert(String sql) { // 執行結果 boolean result = false; // 判斷 if (StrUtil.isNotBlank(sql)) { // 執行SQL result = dmlMapper.insert(sql); } else { // 拋出異常 throw new MyException(DmlExceptionEnum.SQL_NOT_NULL); } // 返回 return result; } /** * 通用-批量新增 */ public static void saveBatch(String tableName, List<Dict> formDataList) { // 判斷 if (StrUtil.isNotBlank(tableName) && formDataList != null && formDataList.size() > 0) { // 獲取List第一條數據 Dict tableDcit = formDataList.get(0); // 判斷 if (MapUtil.isNotEmpty(tableDcit)) { // 變量參數 String tableColumnStr = ""; // Dict轉set集合 Set<String> tableSet = tableDcit.keySet(); // 遍歷 for (String key : tableSet) { // 添加 tableColumnStr += StrUtil.toUnderlineCase(key) + StrUtil.COMMA + StrUtil.SPACE; } // 判斷 if (StrUtil.isNotBlank(tableColumnStr)) { // 參數截取 String tableColumn = tableColumnStr.substring(0, tableColumnStr.length() - 2); // 創建Dict Dict tableDataMap = Dict.create(); // 添加 tableDataMap.put("tableName", tableName); tableDataMap.put("tableColumn", tableColumn); tableDataMap.put("tableDataList", formDataList); // 執行SQL dmlMapper.saveBatch(tableDataMap); } } } else { // 拋出異常 throw new MyException(DmlExceptionEnum.SQL_NOT_NULL); } } /** * 通用更新 */ public static boolean update(String sql) { // 執行結果 boolean result = false; // 判斷 if (StrUtil.isNotBlank(sql)) { // 執行SQL result = dmlMapper.update(sql); } else { // 拋出異常 throw new MyException(DmlExceptionEnum.SQL_NOT_NULL); } // 返回 return result; } /** * 通用刪除 */ public static boolean delete(String sql) { // 執行結果 boolean result = false; // 判斷 if (StrUtil.isNotBlank(sql)) { // 執行SQL result = dmlMapper.delete(sql); } else { // 拋出異常 throw new MyException(DmlExceptionEnum.SQL_NOT_NULL); } // 返回 return result; } /** * 通用執行任意Sql-返回true或false */ public static boolean runAnySql(String sql) { // 執行結果 Boolean result = false; // 判斷 if (StrUtil.isNotBlank(sql)) { // 執行SQL Boolean currentResult = dmlMapper.runAnySql(sql); // 判斷 if (null == currentResult) { // 賦值 result = true; } else { // 賦值 result = currentResult; } } else { // 拋出異常 throw new MyException(DmlExceptionEnum.SQL_NOT_NULL); } // 返回 return result; } /** * 通用執行任意Sql-返回String */ public static String runAnySqlToStr(String sql) { // 執行結果 String result = null; // 判斷 if (StrUtil.isNotBlank(sql)) { // 執行SQL String currentResult = dmlMapper.runAnySqlToStr(sql); // 判斷 if (StrUtil.isNotBlank(currentResult)) { // 賦值 result = currentResult; } } else { // 拋出異常 throw new MyException(DmlExceptionEnum.SQL_NOT_NULL); } // 返回 return result; } }
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看