# java-1-task-1 **Repository Path**: jhhe66/java-1-task-1 ## Basic Information - **Project Name**: java-1-task-1 - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-05-12 - **Last Updated**: 2021-05-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 一、编程题 请完善自定义持久层框架IPersistence,在现有代码基础上添加、修改及删除功能。【需要采用getMapper方式】 ## 题目分析 已经有select样例,增加update,insert,delete。 ## 实现思路 1、在已经解析xml的基础上,我们要增加enum SqlCommandType{INSERT, UPDATE, DELETE, SELECT;}支持这4种操作。 2、执行器Executor中,增加update接口,其他的insert,delete均通过update来实现。 public int update(Configuration configuration, MappedStatement ms, Object... params) throws SQLException, ClassNotFoundException, NoSuchFieldException, IllegalAccessException; 3、在simpleExecutor中实现update方法。 4、在SqlSession中增加insert,update,delete接口,如下: int update(String statementId, Object... params) throws Exception; int delete(String statementId, Object... params) throws Exception; int insert(String statementId, Object... params) throws Exception; 5、在DefaultSqlSession中实现SqlSession中的接口;修正getMapper函数,通过解析xml获取到的statementId,通过configuration获取出MappedStatement,根据SqlCommandType执行相应的方法。 6、在IPersistenceTest测试打印结果。 ## 代码讲解。 # 二、作业资料说明: 1、提供资料:代码工程、验证及讲解视频。 2、讲解内容包含:题目分析、实现思路、代码讲解。 3、效果视频验证 请完善自定义持久层框架IPersistence,在现有代码基础上添加、修改及删除功能。【需要采用getMapper方式】。