MyBatis-Spring-Boot
MyBatis-Spring-Boot copied to clipboard
Spring Boot集成MyBatis的基础项目
如题。当用在一些设计不完美的数据库上时,会有sql关键字冲突,如果加上 ` 包裹字段,就可以解决此问题。
@GeneratedValue(strategy = GenerationType.IDENTITY,generator = "select REPLACE(uuid(),'-','')") 在springboot 中要使用这个的话需要做怎样的配置呢
2017-06-19 14:51:20.754 [restartedMain] ERROR org.springframework.boot.SpringApplication - Application startup failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.github.pagehelper.autoconfigure.MapperAutoConfiguration': Invocation of init method failed; nested exception is tk.mybatis.mapper.MapperException: tk.mybatis.mapper.provider.EmptyProvider中缺少selectOne方法! at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:137) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:409)...
INSERT INTO t_sys_user(id,create_time,account,name,memo,phone,email,sort,state) VALUES ( #{id}这个Id是自动生成的32uuid,这个有好的方法么,#{user.createTime},#{user.account},#{user.name},#{user.memo},#{user.phone},#{user.email},#{user.sort},#{user.state})
@abel533,前辈您好! --- 使用您的分页插件时出现了问题.以下是出现的问题和自己的配置以及代码 报错信息  Spring boot的application.properties  改成Javaconfig的方式配置Pagehelper可以注册这个Pagehelper但是调用时依然会报空指针异常,请大神看下是什么原因 代码块:  --- 2017-11-29 00:10:33 更新 采用spring配置SqlSessionFactoryBean获取sessionfactory依然可以,但是仍然报以上的错. pagehelper拦截器  sessionfactory  Springboot启动类  resources下和mybatis相关的只有MBG了  折腾了一晚上实在不知道到底哪里出了问题了,前辈求指导,谢谢您~.~
通用分页有问题
1.2.3 1.1.5  生成的sql不对~不知道还需要设置那里? SELECT id,create_time,status,system_order_id,actual_payment_amount,sub_order_number,sub_order_status,payment_amount,product_count,payment_method,buyer_user_id,seller_user_id,shop_title,seller_appkey,buyer_appkey,delivery_method,delivery_method_money,apply_account,invoice,invoice_type,invoice_title_type,personal_name,enterprise_name,enterprise_ein,invoice_content,buyer_message,payment_day,payment_money,payment_status,logistics_number FROM system_sub_order WHERE ( buyer_user_id = ? and sub_order_status = ? ) order by id desc LIMIT ? 56(Integer), 05(String), 10(Integer)
public PageInfo getAll( City city ) { List countryList = cityService.getAll( city ); return new PageInfo( countryList ); } 比如我想每页显示5条, 在查出list以后, 返回之前设置怎么搞?
遇到了奇怪的报错: Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to java.lang.Class at tk.mybatis.mapper.mapperhelper.MapperHelper.setSqlSource(MapperHelper.java:247) at tk.mybatis.mapper.mapperhelper.MapperHelper.processConfiguration(MapperHelper.java:310) at tk.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:54) at org.springframework.dao.support.DaoSupport.afterPropertiesSet(DaoSupport.java:44) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ... 52 more Caused by: java.lang.RuntimeException:...