Mybatis
Mybatis
蛋焊工
搬砖小学生
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
MySQL关于时间范围内重合的数据查询
2个时间:a_start, a_endb_start, b_end公式:a_start <= b_end and a_end >= b_startMybatis条件 <if test="onlineTime != null and offlineTime != null" > <![CDATA...原创 2020-03-09 20:24:25 · 1517 阅读 · 0 评论 -
nested exception is org.apache.ibatis.binding.BindingException: Parameter 'ids' not found. Available
接口List<OperationalLocation> getByIds(List<String> ids);xml配置文件<select id="getByIds" parameterType="java.util.List" resultMap="BaseResultMap"> SELECT <include refid...原创 2019-06-03 11:18:16 · 5232 阅读 · 0 评论 -
使用mybatis-generatorMaven插件生成Mapper、Model、XML
在pom.xml配置MAVENmybatis-generator插件<!-- GeneratorConfig生成pojo、mapper、xml --> <plugin> <groupId>org.mybatis.generator</groupId> <artifac...原创 2018-07-06 19:46:01 · 327 阅读 · 0 评论 -
mybatis中#{}和${}符号的区别
#{} 使用#{}意味着使用的预编译的语句,即在使用jdbc时的preparedStatement,sql语句中如果存在参数则会使用?作占位符,我们知道这种方式可以防止sql注入,并且在使用#{}时形成的sql语句,已经带有引号,例,select * from table where id=#{id} 在调用这个sql时我们可以通过后台看到打印出的sql为:select * from tabl...原创 2019-01-17 13:44:20 · 5096 阅读 · 1 评论 -
TkMapper扫描包的坑
Exception :tk.mybatis.mapper.provider.base.BaseSelectProvider:xxxxxxxxx使用tkMapper通用mapper时,必须修改MapperScannerConfigurer的扫描类,使用tk.mybatis下的tk.mybatis.spring.mapper.MapperScannerConfigurer <!--...原创 2018-08-10 15:01:59 · 2764 阅读 · 0 评论 -
使用通用TkMapper时开启Mybatis的二级缓存
开启Mybatis的二级缓存在applcation.properties中mybatis.configuration.cache-enabled=true在Mapper接口上使用@CacheNamespace注解在实体类需要序列化 public class User implements Serializable { private static final lo...原创 2018-07-24 19:00:53 · 2481 阅读 · 0 评论 -
使用TKMapper主键的坑
使用TKMapper通用Mapper时一定声明主键,否则selectByPrimaryKey会查询所有的实体参数,一定要导入import javax.persistence.Id;不要导成import org.springframework.data.annotation.Id;...原创 2018-07-23 10:40:51 · 4224 阅读 · 0 评论 -
Mybatis报错 Result Maps collection already contains value for com.xxxxxd.mapper.AddressInfoMappe
Mybatis报错:Caused by: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.xiaoyun.main.mapper.AddressInfoMapper.BaseResultMap 在mapper.xml文件中存在一样的方法,去除一个即可。...原创 2018-05-11 17:32:37 · 838 阅读 · 0 评论 -
集成tk.mybatis.mapper
集成tk.mybatis.mapper时,注意不能在basePackage下扫入通用Mapper,也就是在下面value="com.xiaoyun.main.mapper"包com.xiaoyun.main.mapper下不能出现通用Mapper <bean class="tk.mybatis.spring.mapper.MapperScannerConfigurer"> ...原创 2018-05-10 15:04:46 · 1112 阅读 · 0 评论 -
MyBatis报错 Parameter '0' not found. Available parameters are [arg1, arg0, param1, param2]
<update id="updateStatusById" parameterType="java.lang.Integer"> update nic_techsupport set status_id = #{0} where techsupport_id =#{1} </update>修改为 <update...原创 2017-07-25 15:53:28 · 15966 阅读 · 3 评论 -
eclipse中安装mybatis generator插件自动生成dao、xml、pojo
1.下载mybatis generator.zip插件2.解压—>打开找到eclipse文件,把UpdateSie文件中features和plugins文件拷贝到eclipse中对应的features和plugins文件即可3.打开eclipse,新建other 输入mybatis可以看到就说明成功了。原创 2017-07-20 17:43:20 · 789 阅读 · 0 评论
分享