
mybatis
左之右
努力前行的Programmer.
展开
-
Mybatis查询数据时间区间是否存在交集
需求需求 : 有时候项目需要插入的数据不能出现时间区间的重合SQL查询SELECT *FROM table_1WHERE active=1AND (start_time >= ? AND start_time <= ? OR (start_time <= ? AND end_time >= ?) OR (end_time >= ? AND end_time <= ?)) limit 1MybatisPlus实现PS: 可根据mp的语法可原创 2021-03-10 11:02:02 · 964 阅读 · 0 评论 -
Mybatis 批处理
批量处理方式原生的JDBC : 这种方式最快,代码比较麻烦Mybatis 的 ExecutorType.BATCH :代码编写比较简单,数据库连接需要添加allowMultiQueries=trueMybatis 动态 sql拼接方式以上3种的优劣:参考文章: 关于Mybatis批量插入使用JDBC原生batch批处理以及mybatis的ExecutorType.BATCH的批...原创 2020-01-22 14:51:37 · 426 阅读 · 0 评论 -
Mybatis例子
1.批处理的操作,操作的时候需要设置连接信息带上参数:allowMultiQueries=true<!--批量处理的操作:更新用户的属性内容--> <insert id="batchUpdateUserInfoData"> <foreach collection="userIdList" item="userid" index="inde.原创 2018-06-29 15:49:10 · 248 阅读 · 0 评论 -
Mybatis Generator最完整配置详解(转)
本文来自:Mybatis Generator最完整配置详解<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN""http://mybatis....转载 2018-07-01 14:28:34 · 157 阅读 · 0 评论 -
Mysql Update BIGINT UNSIGNED value is out of range
Mysql :update oneTab set num = num - #{count,jdbcType=INTEGER} where id = 1 num是int类型,但如果num=0时,则会报出相应 BIGINT UNSIGNED value is out of range in (xx.num字段)解决方法:update oneTab set num = CAST(n...原创 2018-10-17 15:53:15 · 938 阅读 · 0 评论 -
Mybatis的SaveOrUpdate
批量的saveOrupdate:<!--批量的插入 or 更新的操作--> <insert id="batchInsertStaff"> insert into xxxTable ( merchant_id, app_id, department_id, `name`, mobile, token, created_...原创 2018-10-29 11:39:34 · 21734 阅读 · 2 评论 -
MyBatis Example And与Or例子
需求 : (条件1 and 条件2) or ( 条件3 and 条件4) xxxExample example = new xxxExample(); xxxExample.Criteria c1 = example.createCriteria(); c1.andOne(one).andTwo(two); ...原创 2019-09-12 16:21:27 · 16516 阅读 · 3 评论