![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
mybatis
蓦然回首的风度
一张白纸,抒写人生
展开
-
隐藏身份证号码中间部分
SELECT #concat是拼接函数concat(#left(字段名,序号) 这个是代表截取到字段最左边俩位left(t.CARD_NO,2),#这个是截取到去头去尾的字段长度(char_length(t.CARD_NO)-4),#可以将这行去掉#本来想的是用*号乘以上面去头去尾的长度 没想到好的方法'************',#right(字段名,序号) 这个是代表截取到字段最右边俩位right(t.CARD_NO,2)) aa #aa是取得别名from t_uw_cust原创 2021-10-29 11:14:15 · 734 阅读 · 0 评论 -
mybatis中合并俩个字段使用concat函数优美解决
select tuspa.LIST_ID listId, tuss.SUP_NAME supName, #这块使用了concat函数 一般是需要拼接几个 就在中间写几个 concat(tup.PRODUCT_CODE,'-',tup.PRODUCT_NAME) productName, tuspa.SUP_PRODUCT_CODE supProductCode, tuspa.STA...原创 2021-10-29 10:43:27 · 3790 阅读 · 22 评论 -
在yml中配置多数据源
首先在pom中引入jar包<!--配置数据源--><dependency> <groupId>com.baomidou</groupId> <artifactId>dynamic-datasource-spring-boot-starter</artifactId> <version>2.5.6</version></dependency>注释掉其他的数据源例如我的是<dep原创 2021-09-06 14:58:17 · 6831 阅读 · 3 评论 -
使用mybatis进行模糊查询时需要注意(双引号,distinct关键字)
当使用mybatis 进行like 查询时一定要使用 双引号 #这个是使用了distinct 关键字 来进行不同筛选总数 <select id="selectCountBybi" resultType="java.lang.Integer"> SELECT COUNT(DISTINCT identifier) FROM admin_problem <where> <if test="vo.question != '' and vo.quest原创 2021-08-13 14:49:46 · 895 阅读 · 2 评论 -
分页查询的俩种方式(QueryWrapper和xml分页)
1.单表查分页时推荐使用QueryWrapper单表分页查询可以使用这种的,我用的是lambda表达式QueryWrapper<Vergetable> wrapper = new QueryWrapper<>(); Page<table> page = new Page<>(dto.getPageNo(), dto.getPageSize());// page.setOptimizeCountSql(false);原创 2021-04-21 13:50:33 · 7280 阅读 · 0 评论 -
mybatis批量插入或更新(SQL和oracle)
下面是批量插入的代码语法 :insert into 表名(表字段,表字段) values < foreach> (#{},#{})< /foreatch><insert id="insertList" useGeneratedKeys="true" parameterType="java.util.List"> insert into material_files(id,shop_id,file_name,suffix_name,file_s原创 2021-04-08 09:22:01 · 1481 阅读 · 0 评论