java: framework from BLL、DAL、IDAL、MODEL、Factory, using Ms SQL server
sql:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | /*create database geovindu go use geovindu; go */ --基础数据设置BasicDataSet --书分类目录kind --BookKindForm IF EXISTS ( select * from sysobjects where id = object_id(N '[dbo].BookKindList' ) and OBJECTPROPERTY(id, N 'IsUserTable' ) = 1) DROP TABLE BookKindList GO create table BookKindList ( BookKindID INT IDENTITY(1,1) PRIMARY KEY , BookKindName nvarchar(500) not null , BookKindParent int null , BookKindCode varchar (100) ---編號 ) GO alter table BookKindList add BookKindCode varchar (100) select * from BookKindList insert into BookKindList(BookKindName,BookKindParent) values ( '六福书目录' ,0) insert into BookKindList(BookKindName,BookKindParent) values ( '文学' ,1) insert into BookKindList(BookKindName,BookKindParent) values ( '设计艺术' ,1) insert into BookKindList(BookKindName,BookKindParent) values ( '自然科学' ,1) insert into BookKindList(BookKindName,BookKindParent) values ( '小说' ,2) insert into BookKindList(BookKindName,BookKindParent) values ( '诗词散曲' ,2) IF EXISTS ( SELECT * FROM sysobjects WHERE [ name ] = 'proc_Insert_BookKindList' ) DROP PROCEDURE proc_Insert_BookKindList GO CREATE PROCEDURE proc_Insert_BookKindList ( --@BookKindID Int, @BookKindName NVarChar(1000), @BookKindCode varchar (100), @BookKindParent Int ) AS IF NOT EXISTS ( SELECT * FROM BookKindList WHERE [BookKindName]=@BookKindName) BEGIN INSERT INTO BookKindList ( [BookKindName] , [BookKindCode], [BookKindParent] ) VALUES ( @BookKindName , @BookKindCode, @BookKindParent ) END GO IF EXISTS ( SELECT * FROM sysobjects WHERE [ name ] = 'proc_Insert_BookKindOut' ) DROP PROCEDURE proc_Insert_BookKindOut GO CREATE PROCEDURE proc_Insert_BookKindOut ( @BookKindName NVarChar(1000), @BookKindCode varchar (100), @BookKindParent Int , @BookKindID Int output ) AS IF NOT EXISTS ( SELECT * FROM BookKindList WHERE [BookKindName]=@BookKindName) BEGIN INSERT INTO BookKindList ( [BookKindName] , [BookKindCode], [BookKindParent] ) VALUES ( @BookKindName , @BookKindCode, @BookKindParent ) SELECT @BookKindID=@@IDENTITY END GO IF EXISTS ( SELECT * FROM sysobjects WHERE [ name ] = 'proc_Update_BookKindList' ) DROP PROCEDURE proc_Update_BookKindList GO CREATE PROCEDURE proc_Update_BookKindList ( @BookKindID Int , @BookKindName NVarChar(1000), @BookKindCode varchar (100), @BookKindParent Int ) AS IF NOT EXISTS ( SELECT * FROM BookKindList WHERE [BookKindName]=@BookKindName) BEGIN UPDATE BookKindList SET [BookKindName]=@BookKindName , [BookKindCode]=@BookKindCode, [BookKindParent]=@BookKindParent where [BookKindID]=@BookKindID END ELSE BEGIN UPDATE BookKindList SET --[BookKindName]=@BookKindName , [BookKindCode]=@BookKindCode, [BookKindParent]=@BookKindParent where [BookKindID]=@BookKindID END GO --刪除時,要刪相關的書藉信息 IF EXISTS ( select * from sysobjects where [ name ] = 'proc_Delete_BookKindList' ) DROP PROCEDURE proc_Delete_BookKindList GO CREATE PROCEDURE proc_Delete_BookKindList ( @BookKindID Int ) as DELETE BookKindList WHERE BookKindID = @BookKindID GO IF EXISTS ( SELECT * FROM sysobjects WHERE [ name ] = 'proc_Select_BookKindList' ) DROP PROCEDURE proc_Select_BookKindList GO CREATE PROCEDURE proc_Select_BookKindList ( @BookKindID Int ) AS SELECT * FROM BookKindList WHERE BookKindID = @BookKindID GO IF EXISTS ( SELECT * FROM sysobjects WHERE [ name ] = 'proc_Select_BookKindListAll' ) DROP PROCEDURE proc_Select_BookKindListAll GO CREATE PROCEDURE proc_Select_BookKindListAll AS SELECT * FROM BookKindList GO |
Model
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | /* * 版权所有 2021 涂聚文有限公司 * 许可信息查看: * 描述:实体类,连接MySQL * * 历史版本: JDK 14.02 * 数据库:MSSQL Server 2019 * IDE: IntelliJ IDEA 2021.2.3 * OS: Windows 10 x64 * 2021-12-12 创建者 geovindu * 2021-12-15 添加 Lambda * 2021-12-15 修改:date * 接口类 * 2021-12-15 修改者:Geovin Du * 生成API帮助文档的指令: *javadoc - -encoding Utf-8 -d apidoc BookKind.java * 配置文件: * driver=com.microsoft.sqlserver.jdbc.SQLServerDriver *url=jdbc\:sqlserver\://localhost\:1433;databaseName=geovindu; *user=root *password=root * * */ package Geovin.Model; /** * 实体类 *@author geovindu 涂聚文 Geovin Du * @ * * */ public class BookKind { // private int BookKindID; private String BookKindName; private int BookKindParent; private String BookKindCode; /** * @param * @return 得到ID * */ public int getBookKindID() { return BookKindID; } /** * @param bookKindID 设置输入参数 * * */ public void setBookKindID( int bookKindID) { this .BookKindID = bookKindID; } /** * @param * @return 得到目录名称 * */ public String getBookKindName() { return BookKindName; } /** * @param bookKindName 设置输入参数 * * */ public void setBookKindName(String bookKindName) { this .BookKindName = bookKindName; } /** * @param * @return 得到父节点的值 * */ public int getBookKindParent() { return BookKindParent; } /** * @param bookKindParent 设置输入参数 * * */ public void setBookKindParent( int bookKindParent) { this .BookKindParent = bookKindParent; } /** * * */ public void setBookKindCode(String bookKindCode) { BookKindCode = bookKindCode; } /** * * */ public String getBookKindCode() { return BookKindCode; } } |
DAL:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | /* * 版权所有 2021 涂聚文有限公司 * 许可信息查看: * 描述:DAL数据访问层 数据业务层,连接MySQL * * 历史版本: JDK 14.02 * 数据库:MSSQL Server 2019 * IDE: IntelliJ IDEA 2021.2.3 * OS: Windows 10 x64 * 2021-12-12 创建者 geovindu * 2021-12-15 添加 Geovin Du * 2021-12-15 修改:涂聚文 * 接口类 * 2021-12-15 修改者:Geovin Du * 生成API帮助文档的指令: *javadoc - -encoding Utf-8 -d apidoc BookKindDAL.java * 配置文件: * driver=com.microsoft.sqlserver.jdbc.SQLServerDriver *url=jdbc\:sqlserver\://localhost\:1433;databaseName=geovindu; //jdbc\:mysql\://localhost\:3306/数据库名称 *user=root *password=root * * */ //#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end package Geovin.DAL; import Geovin.Interface.*; import Geovin.Model.*; import Geovin.Model.OutValue; import Geovin.UtilitieDB.*; import java.sql.*; import java.util.ArrayList; /** *#parse("File Header.java") * @apiNote 数据业务层 * @deprecated * @Description * @projectName * @author geovindu 涂聚文 Geovin Du * @date * @version 1.0 * */ public class BookKindDAL implements BookKindInterface { // SqlHelper sqlHelper=new SqlHelper(); /** * @param info 输入一个实体 * @return 返回int 1 是否插入一条记录 * @Description 添加一条记录 * */ public int Add(BookKind info) { int ok= 0 ; ResultSet resultSet = null ; try { String sql = "{call proc_Insert_BookKindList(?,?,?)}" ; String[] parameters = {info.getBookKindName(), String.valueOf(info.getBookKindParent()),info.getBookKindCode() }; SqlHelper.CallProc(sql,parameters); ok= 1 ; } catch (Exception exception) { ok= 0 ; exception.printStackTrace(); } finally { SqlHelper.close(resultSet, SqlHelper.getCs(), SqlHelper.getConnection()); } return ok; } /** * @param info 输入实体 * @return 返回值 * * */ public int AddOut(BookKind info) { int ok= 0 ; ResultSet resultSet = null ; try { String sql = "{call proc_Insert_BookKindOut(?,?,?,?)}" ; //多少个参数,多少个问号,包括输入,输出参数后面,输入,输出的个数量要明晰 String[] parameters = {info.getBookKindName(), String.valueOf(info.getBookKindParent()),info.getBookKindCode() }; Integer[] out = { Types.INTEGER }; CallableStatement cs=(CallableStatement)SqlHelper.CallProcOutInt(sql,parameters,out); ok= cs.getInt( 3 ); } catch (Exception exception) { ok= 0 ; exception.printStackTrace(); } finally { SqlHelper.close(resultSet, SqlHelper.getCs(), SqlHelper.getConnection()); } return ok; } /** * 添加返回值 * @param info 输入实体 * @param outValue 返回值 * @return 返回值 * * */ public int AddOut(BookKind info,OutValue outValue) { int ok= 0 ; ResultSet resultSet = null ; try { String sql = "{call proc_Insert_BookKindOut(?,?,?,?)}" ; String[] parameters = {info.getBookKindName(), String.valueOf(info.getBookKindParent()),info.getBookKindCode() }; Integer[] out = { Types.INTEGER }; CallableStatement cs=(CallableStatement)SqlHelper.CallProcOutInt(sql,parameters,out); outValue.setIntValue(cs.getInt( 3 )); info.setBookKindID(cs.getInt( 3 )); ok=cs.getInt( 3 ); } catch (Exception exception) { ok= 0 ; exception.printStackTrace(); } finally { SqlHelper.close(resultSet, SqlHelper.getCs(), SqlHelper.getConnection()); } return ok; } /** *添加返回值 * @param info 一个实体记录 * @return * * */ public int AddOut2(BookKind info) { int ok= 0 ; ResultSet resultSet = null ; try { String sql = "{call proc_Insert_BookKindOut(?,?,?,?)}" ; String[] parameters = {info.getBookKindName(), String.valueOf(info.getBookKindParent()),info.getBookKindCode(), "" }; Integer out =Types.INTEGER; info.setBookKindParent(out); SqlHelper.callProcInputAndOutPutString(sql,parameters); ok=out; //不是添加的ID值 } catch (Exception exception) { ok= 0 ; exception.printStackTrace(); } finally { SqlHelper.close(resultSet, SqlHelper.getCs(), SqlHelper.getConnection()); } return ok; } /** * #parse("更新记录") * @param info 输入实体 * @return 返回参数 * * */ public int Update(BookKind info) { int ok= 0 ; ResultSet resultSet = null ; try { String sql = "{call proc_Update_BookKindList(?,?,?,?)}" ; String[] parameters = {String.valueOf(info.getBookKindID()), info.getBookKindName(), String.valueOf(info.getBookKindParent()),info.getBookKindCode() }; SqlHelper.CallProc(sql,parameters); ok= 1 ; // } catch (Exception exception) { ok= 0 ; exception.printStackTrace(); } finally { SqlHelper.close(resultSet, SqlHelper.getCs(), SqlHelper.getConnection()); } return ok; } /** * 查询一条记录 * @param id * @return BookKind 指定查找的ID记录 * @author geovindu * @date 2021-12-20 * */ public BookKind SelectSQLBookKindInfo(String id) { BookKind info= null ; String sql = "SELECT * FROM BookKindList where BookKindID=?" ; String[] parameters = { id }; try { info= new BookKind(); ResultSet rs = SqlHelper.DuexecuteQuery(sql, parameters); while (rs.next()) { info.setBookKindID(rs.getInt( "BookKindID" )); info.setBookKindName(rs.getString( "BookKindName" )); info.setBookKindParent(rs.getInt( "BookKindParent" )); info.setBookKindCode(rs.getString( "BookKindCode" )); } //rs.close(); //rs=null; //return info; } catch (SQLException e) { e.printStackTrace(); } finally { SqlHelper.close(SqlHelper.getRs(), SqlHelper.getPs(), SqlHelper .getConnection()); } return info; } /** * 查询所有记录 * @param * @return BookKind 所有记录 * @date 2021-12-20 * @author geovindu * */ public ArrayList<BookKind> SelectSQLBookKindAll() { ArrayList<BookKind> list= new ArrayList<BookKind>(); String sql = "SELECT * FROM BookKindList" ; try { BookKind info= null ; ResultSet rs = (ResultSet)SqlHelper.DuexecuteQuery(sql, null ); while (rs.next()) { info= new BookKind(); info.setBookKindID(rs.getInt( "BookKindID" )); info.setBookKindName(rs.getString( "BookKindName" )); info.setBookKindParent(rs.getInt( "BookKindParent" )); info.setBookKindCode(rs.getString( "BookKindCode" )); list.add(info); } //return info; rs.close(); rs= null ; } catch (SQLException e) { e.printStackTrace(); } finally { SqlHelper.close(SqlHelper.getRs(), SqlHelper.getPs(), SqlHelper .getConnection()); } return list; } /** * 存储过程查询 * @param * * */ public ArrayList<BookKind> SelectSProcBookKindAll() { Connection conn= null ; //大多数情况下用preparedstatement替代statement PreparedStatement ps = null ; ResultSet rs= null ; ArrayList<BookKind> list= new ArrayList<BookKind>(); String sql = "call proc_Select_BookKindListAll()" ; BookKind info= null ; try { //1. //conn =MySqlHelper.getConnection(); //CallableStatement statement = conn.prepareCall(sql); //statement.execute(); //rs =statement.executeQuery(); //2 rs =SqlHelper.ExecuteQueryProcNoneData(sql); if (rs!= null ) { while (rs.next()) { info = new BookKind(); info.setBookKindID(rs.getInt( "BookKindID" )); info.setBookKindName(rs.getString( "BookKindName" )); info.setBookKindParent(rs.getInt( "BookKindParent" )); info.setBookKindCode(rs.getString( "BookKindCode" )); list.add(info); } } //return info; rs.close(); rs= null ; } catch (SQLException e) { e.printStackTrace(); System.out.println( "no" ); } finally { SqlHelper.close(SqlHelper.getRs(), SqlHelper.getPs(), SqlHelper.getConnection()); } return list; } /** * 存储过程查询 * * */ public ArrayList<BookKind> SelectSProcToBookKindAll() { Connection conn= null ; //大多数情况下用preparedstatement替代statement PreparedStatement ps = null ; ResultSet rs= null ; ArrayList<BookKind> list= new ArrayList<BookKind>(); String sql = "{call proc_Select_BookKindListAll()}" ; BookKind info= null ; try { //1 //conn = DriverManager.getConnection(url,userName,password);// //System.out.println("连接成功"); //conn=getConnection(); //2. // conn =MySqlHelper.getConnection(); // CallableStatement statement = conn.prepareCall(sql); // statement.execute(); // rs =statement.executeQuery(); //3. rs =SqlHelper.ExecuteQueryProcNoneData(sql); if (rs!= null ) { while (rs.next()) { info = new BookKind(); info.setBookKindID(rs.getInt( "BookKindID" )); info.setBookKindName(rs.getString( "BookKindName" )); info.setBookKindParent(rs.getInt( "BookKindParent" )); info.setBookKindCode(rs.getString( "BookKindCode" )); list.add(info); } } //return info; rs.close(); rs= null ; } catch (SQLException e) { e.printStackTrace(); System.out.println( "no" ); } finally { SqlHelper.close(SqlHelper.getRs(), SqlHelper.getPs(), SqlHelper.getConnection()); } return list; } } |
IDAL:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | /* * 版权所有 2021 涂聚文有限公司 * 许可信息查看: * 描述:Interface 接口层,连接MySQL * * 历史版本: JDK 14.02 * 数据库:MSSQL Server 2019 * IDE: IntelliJ IDEA 2021.2.3 * OS: Windows 10 x64 * 2021-12-12 创建者 geovindu * 2021-12-15 添加 Lambda * 2021-12-15 修改:date * 接口类 * 2021-12-15 修改者:Geovin Du * 生成API帮助文档的指令: *javadoc - -encoding Utf-8 -d apidoc BookKindInterface.java * 配置文件: * driver=com.microsoft.sqlserver.jdbc.SQLServerDriver *url=jdbc\:sqlserver\://localhost\:1433;databaseName=geovindu; ///jdbc\:mysql\://localhost\:3306/数据库名称 *user=root *password=root * * */ package Geovin.Interface; import Geovin.Model.BookKind; import Geovin.Model.OutValue; import java.util.ArrayList; /** * #parse("接口") * @author geovindu 涂聚文 Geovin Du * @version 1.0 * */ public interface BookKindInterface { /** * @param info * @return * */ public int Add(BookKind info); /** * * @param info * @return * * */ public int AddOut(BookKind info); /** * * * */ public int AddOut(BookKind info, OutValue outValue); /** * * @param info * @return * * */ public int Update(BookKind info); /** * * @param id * @return * * **/ public BookKind SelectSQLBookKindInfo(String id); /** * * @param * @return * * */ public ArrayList<BookKind> SelectSQLBookKindAll(); /** * * @param * @return * * */ public ArrayList<BookKind> SelectSProcBookKindAll(); public ArrayList<BookKind> SelectSProcToBookKindAll(); } |
Factory:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | /* * 版权所有 2021 涂聚文有限公司 * 许可信息查看: * 描述:工厂层,抽象工厂 连接MySQL * * 历史版本: JDK 14.02 * 数据库:MSSQL Server 2019<br><br> * IDE: IntelliJ IDEA 2021.2.3 * OS: Windows 10 x64 * 2021-12-12 创建者 geovindu * 2021-12-15 添加 Lambda * 2021-12-15 修改:date * 接口类 * 2021-12-15 修改者:Geovin Du * 生成API帮助文档的指令: *javadoc - -encoding Utf-8 -d apidoc BookKind.java * 配置文件: * driver=com.microsoft.sqlserver.jdbc.SQLServerDriver *url=jdbc\:sqlserver\://localhost\:1433;databaseName=geovindu; //jdbc\:mysql\://localhost\:3306/数据库名称 *user=root *password=root * * */ package Geovin.Factory; import Geovin.DAL.BookKindDAL; import Geovin.Interface.BookKindInterface; /** * #parse("抽象工厂") * @author geovindu 涂聚文 Geovin Du * @version 1.0 * * */ public class AbstractFactory { /** * * * */ public static BookKindInterface CreateBookKind() { BookKindInterface iBookKindInterface= new BookKindDAL(); return iBookKindInterface; } } |
BLL:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | /* * 版权所有 2021 涂聚文有限公司 * 许可信息查看: * 描述:业务逻辑层,连接MySQL * * 历史版本: JDK 14.02 * 数据库:MSSQL Server 2019 * IDE: IntelliJ IDEA 2021.2.3 * OS: Windows 10 x64 * 2021-12-12 创建者 geovindu * 2021-12-15 添加 Lambda * 2021-12-15 修改:date * 接口类 * 2021-12-15 修改者:Geovin Du * 生成API帮助文档的指令: *javadoc - -encoding Utf-8 -d apidoc BookKind.java * 配置文件: * driver=com.microsoft.sqlserver.jdbc.SQLServerDriver *url=jdbc\:sqlserver\://localhost\:1433;databaseName=geovindu; //jdbc\:mysql\://localhost\:1433/数据库名称 *user=root *password=root * * */ package Geovin.BLL; import Geovin.Factory.AbstractFactory; import Geovin.Model.*; import Geovin.Model.OutValue; import Geovin.Interface.*; import java.util.ArrayList; /** * #parse("业务逻辑层") * @author geovindu 涂聚文 Geovin Du * @ * */ public class BookKindBLL { // private static BookKindInterface dal=AbstractFactory.CreateBookKind(); /** * @param info 输入一个实体 * @return 返回int 1 是否插入一条记录 * */ public int Add(BookKind info) { return dal.Add(info); } /** * @param info 输入实体 * @return 返回值 * */ public int AddOut(BookKind info) { return dal.AddOut(info); } /** * 添加返回值 * @param info 输入实体 * @param outValue 返回值 * @return 返回值 * */ public int AddOut(BookKind info,OutValue outValue){ return dal.AddOut(info,outValue);} /** *添加返回值 * @param info 一个实体记录 * @return * */ public int Update(BookKind info) { return dal.Update(info); } /** * 查询一条记录 * @param id * @return BookKind 指定查找的ID记录 * */ public BookKind SelectSQLBookKindInfo(String id) { return dal.SelectSQLBookKindInfo(id); } /** * 查询所有记录 * @param * @return BookKind 所有记录 * */ public ArrayList<BookKind> SelectSQLBookKindAll() { return dal.SelectSQLBookKindAll(); } /** * 存储过程查询 * @param * */ public ArrayList<BookKind> SelectSProcBookKindAll(){ return dal.SelectSProcBookKindAll();} /** * 存储过程查询 * */ public ArrayList<BookKind> SelectSProcToBookKindAll(){ return dal.SelectSProcToBookKindAll();} } |
测试:
1 2 3 4 5 6 7 8 9 10 11 | BookKindBLL bookKindBLL= new BookKindBLL(); String id= "2" ; BookKind info=bookKindBLL.SelectSQLBookKindInfo(id); System.out.println( "Id:" +id+ ",名称:" +info.getBookKindName()+ "父节点:" +info.getBookKindParent()); ArrayList<BookKind> arrayList= new ArrayList<BookKind>(); arrayList=bookKindBLL.SelectSProcToBookKindAll(); for (BookKind bookKind:arrayList) { System.out.println( "Id:" +bookKind.getBookKindID()+ ",名称:" +bookKind.getBookKindName()+ "父节点:" +bookKind.getBookKindParent()+ "编码:" +bookKind.getBookKindCode()); } |
哲学管理(学)人生, 文学艺术生活, 自动(计算机学)物理(学)工作, 生物(学)化学逆境, 历史(学)测绘(学)时间, 经济(学)数学金钱(理财), 心理(学)医学情绪, 诗词美容情感, 美学建筑(学)家园, 解构建构(分析)整合学习, 智商情商(IQ、EQ)运筹(学)生存.---Geovin Du(涂聚文)
标签:
java
, sql server
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 零经验选手,Compose 一天开发一款小游戏!
· 一起来玩mcp_server_sqlite,让AI帮你做增删改查!!
2012-12-27 sql script: select database select all table