当前位置: 首页 > news >正文

怎么给别人做网站优化维普网

怎么给别人做网站优化,维普网,淘宝网站建设设计模板,社区营销模式文章目录 源码下载测试模块搭建学习博客 源码下载 首先下载mybatis-parent的源码#xff1a;gitee地址 https://gitee.com/callback_lab/mybatis-parent.git 然后下载mybatis的源码#xff1a;gitee地址 https://gitee.com/callback_lab/mybatis-src.git 带中文… 文章目录 源码下载测试模块搭建学习博客 源码下载 首先下载mybatis-parent的源码gitee地址 https://gitee.com/callback_lab/mybatis-parent.git 然后下载mybatis的源码gitee地址 https://gitee.com/callback_lab/mybatis-src.git 带中文注释的三方源码 以下包需要注释否则会报错 org.apache.ibatis.exceptions.PersistenceException: ### Error building SqlSession. ### Cause: java.lang.IllegalStateException: Cannot enable lazy loading because Javassist is not available. Add Javassist to your classpath.dependencygroupIdognl/groupIdartifactIdognl/artifactIdversion3.2.20/version !-- scopecompile/scope-- !-- optionaltrue/optional--/dependencydependencygroupIdorg.javassist/groupIdartifactIdjavassist/artifactIdversion3.27.0-GA/version !-- scopecompile/scope-- !-- optionaltrue/optional--/dependency将mybatis-parent与mybatis导入idea同一个project下。 测试模块搭建 新建一个测试模块这里叫mybatis-gabriel 项目基础架构 实例原博客 pom : dependenciesdependencygroupIdjunit/groupIdartifactIdjunit/artifactIdversion4.11/versionscopetest/scope/dependencydependencygroupIdorg.mybatis/groupIdartifactIdmybatis/artifactIdversion3.3.0-SNAPSHOT/version/dependency/dependencies相关代码 主要测试入口代码 public class TestMain {public static void main(String[] args) {String resource mybatis-config.xml;InputStream inputStream null;try {inputStream Resources.getResourceAsStream(resource);} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}SqlSessionFactory sqlSessionFactory null;sqlSessionFactory new SqlSessionFactoryBuilder().build(inputStream);SqlSession sqlSession null;try {sqlSession sqlSessionFactory.openSession();RoleMapper roleMapper sqlSession.getMapper(RoleMapper.class);Role role roleMapper.getRole(1L);System.out.println(role.getId() : role.getRoleName() : role.getNote());sqlSession.commit();} catch (Exception e) {// TODO Auto-generated catch blocksqlSession.rollback();e.printStackTrace();} finally {sqlSession.close();}} }po /** author gethin* 角色的实体类*/ public class Role {private long id;private String roleName;private String note;public long getId() {return id;}public void setId(long id) {this.id id;}public String getRoleName() {return roleName;}public void setRoleName(String roleName) {this.roleName roleName;}public String getNote() {return note;}public void setNote(String note) {this.note note;} }MyStringHandler MappedTypes({String.class}) MappedJdbcTypes(JdbcType.VARCHAR) public class MyStringHandler implements TypeHandlerString {Logger log Logger.getLogger(MyStringHandler.class.getName());Overridepublic String getResult(ResultSet rs, String colName) throws SQLException {log.info(使用我的TypeHandler,ResultSet列名获取字符串);return rs.getString(colName);}Overridepublic String getResult(ResultSet rs, int index) throws SQLException {log.info(使用我的TypeHandler,ResultSet下标获取字符串);return rs.getString(index);}Overridepublic String getResult(CallableStatement cs, int index) throws SQLException {log.info(使用我的TypeHandler,CallableStatement下标获取字符串);return cs.getString(index);}Overridepublic void setParameter(PreparedStatement ps, int index, String value, JdbcType arg3) throws SQLException {log.info(使用我的TypeHandler);ps.setString(index, value);}}mapper public interface RoleMapper {public Role getRole(Long id);public Role findRole(String roleName);public int deleteRole(Long id);public int insertRole(Role role); }RoleMapper.xml ?xml version1.0 encodingUTF-8 ? !DOCTYPE mapperPUBLIC -//mybatis.org//DTD Mapper 3.0//ENhttp://mybatis.org/dtd/mybatis-3-mapper.dtd mapper namespaceorg.mybatis.debug.mapper.RoleMapperresultMap typeorg.mybatis.debug.po.Role idroleMapid columnid propertyid javaTypelong jdbcTypeBIGINT /result columnrole_name propertyroleName javaTypestringjdbcTypeVARCHAR /result columnnote propertynotetypeHandlerorg.mybatis.debug.handle.MyStringHandler //resultMapselect idgetRole parameterTypelong resultMaproleMapselectid,role_name as roleName,note from role where id#{id}/selectselect idfindRole parameterTypelong resultMaproleMapselectid,role_name,note from role where role_name like CONCAT(%,#{roleNamejavaTypestring,jdbcTypeVARCHAR,typeHandlercom.gethin.handler.MyStringHandler},%)/selectinsert idinsertRole parameterTypeorg.mybatis.debug.po.Roleinsert intorole(role_name,note) value(#{roleName},#{note})/insertdelete iddeleteRole parameterTypelongdelete from role whereid#{id}/delete /mappersql -- ---------------------------- -- Table structure for role -- ---------------------------- DROP TABLE IF EXISTS role; CREATE TABLE role (id int(11) DEFAULT NULL,role_name varchar(255) DEFAULT NULL,note varchar(255) DEFAULT NULL ) ENGINEInnoDB DEFAULT CHARSETutf8;-- ---------------------------- -- Records of role -- ---------------------------- INSERT INTO role VALUES (1, 管理员, 管理员);-- ---------------------------- -- Table structure for role -- ---------------------------- DROP TABLE IF EXISTS user; CREATE TABLE user (id int(11) DEFAULT NULL,role_id int(11) DEFAULT NULL,user_name varchar(255) DEFAULT NULL,user_note varchar(255) DEFAULT NULL ) ENGINEInnoDB DEFAULT CHARSETutf8;-- ---------------------------- -- Records of role -- ---------------------------- INSERT INTO user VALUES (1, 1,张三, 管理员张三);学习博客 调试博客
http://www.hkea.cn/news/14585336/

相关文章:

  • 深圳市网站建设公司排名制作企业网站作业网页模板
  • 国内网站建设公司排名天津网站定制
  • 网站售后维护安徽省住房城乡建设厅网站
  • 医院品牌网站建设贵港网站营销
  • 站台建筑都用什么软件做网站
  • 江西网站建设价格低关键词seo资源
  • 做网站都需要什么人团花都电子商务网站建设
  • 常用网站开发语言嵌入式软件开发和软件开发的区别
  • 站外推广平台有哪些安装wordpress404
  • 哪些网站用c 做的贵州app开发公司
  • 资兴市住房和城乡建设局网站人力外包项目外包
  • 网站出现搜索电子商务网站建设的基本流程
  • 重庆找做墩子网站免费网站空间女人
  • 如何做招聘网站效果评估无锡网络建站
  • 唯品会一家做特卖的网站京东网站建设目标
  • 找别人做淘客网站他能改pid吗网站推广的四个阶段
  • 网站建设一站式服务域名交易域名出售
  • 英语教学网站建设意见标识设计网站
  • 网站ip解析网店运营都要做什么
  • 宛城区建网站网站开发的现状分析
  • 设计网站推荐语做网站公司哪家正规
  • asp.net mvc 企业网站电气工程及其自动化
  • nuxt做多页面网站微网站 微官网的区别
  • 网站子页设计坪山网站开发
  • 帝国建设网站网页设计尺寸多少比较好
  • 西宁网站建设有限公司校园网认证登录入口
  • 织梦的网站数据还原怎么做小程序代理加盟前景
  • 东莞做微网站清远网站建设
  • 网站建设招聘做网站投注代理犯罪吗
  • 汉中网站建设网页开发背景