- 博客(21)
- 收藏
- 关注
原创 自动生成数据库实体类和mapper文件 mybatis-generator-maven-plugin
mybatis-generator-maven-plugin
2022-07-27 15:47:09 356 1
原创 Java去除字符串两边的“0“
public class Test1 { public static void main(String[] args) { // 去除字符串左侧的0值 String str = "0000001230"; String str1 = str.replaceAll("^(0+)", ""); System.out.println(str1); // 1230 // 去除字符串右侧的0值 String str2 =
2022-03-22 16:17:48 2271
原创 java中stream的map和mapToInt方法使用
stream()中的map(Function mapping)返回给定函数应用于此流得元素得结果stream()中的maptoint(ToIntFunction mapper)返回一个IntStream其中包含给定函数应用于此流得元素的结果maptoint有sum()求和方法public static void main(String[] args) { List<User> list = new ArrayList<>(); for (int
2022-03-16 13:25:00 22614
原创 Redis序列化报错
现象ERROR com.jingsheng.common.model.exception.ControllerExceptionHandler - Failed to deserialize payload. Is the byte array a result of corresponding serialization for DefaultDeserializer?; nested exception is java.io.EOFException控制台报错redis数据redis序列化
2022-02-18 16:44:30 559
原创 2021/11/17工作日志,查询、修改、增加
Controller@ApiOperation("获取所有盒信息") @GetMapping("/checkQueryBox") public BaseResponse<List<GetBoxInfoResponse>> checkQueryBox(@ModelAttribute GetBoxInfoRequest getBoxInfoRequest) { return new BaseResponse(checkPackService.checkQ
2021-11-18 15:48:52 293
原创 2021/11/9工作日志
Controller @ApiOperation("获取任务单信息") @PostMapping("/queryWorkOrder/{batchNo}") public BaseResponse<Map<String,ProduceBatchCraftstepInfo>> queryWorkOrder(@PathVariable String batchNo) throws ServiceException { Map<String, Prod
2021-11-17 11:26:32 62
原创 easyExcel导出工具类
easyExcel是阿里巴巴的一个Excel导出工具,使用前要导包工具类package com.jingchuang.mes.util;import com.alibaba.excel.EasyExcel;import com.alibaba.excel.support.ExcelTypeEnum;import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;import javax.serv
2021-11-10 11:28:38 382
原创 Stream()流(遍历、bean转List、List转Map、分组)
一、Collectors.toList()现在有个集合:List<User> users = new User();//遍历User集合,取user集合id存入list集合List<Long> idList = users.stream().map(User::getId).collect(Collectors.toList());二、Collectors.toMap()Collectors.toMap(),一般用于将一个List转换为Map。常见用法:list.st
2021-11-02 11:45:06 1631
原创 分页查询,逻辑删除
ackage com.jingsheng.mes.sys.controller;import com.github.pagehelper.PageInfo;import com.jingsheng.common.model.model.BaseResponse;import com.jingsheng.mes.dal.entity.mysql.LcjBoardEfficiency;import com.jingsheng.mes.dal.request.board.LcjBoardEfficien
2021-11-01 16:23:29 145
原创 通用mapper——方法及实例
Iterator与Iterableiterator为Java中的迭代器对象,是能够对List这样的集合进行迭代遍历的底层依赖。而iterable接口里定义了返回iterator的方法,相当于对iterator的封装,同时实现了iterable接口的类可以支持for each循环。andIn():public Example.Criteria andIn(String property, Iterable values) { //column 表字段名 // user.id in(1,2,
2021-11-01 15:50:49 321
原创 异常报错集
1 BUG报错:14:56:37.516 [http-nio-8081-exec-7] ERROR com.jingchuang.mesopenapi.common.exception.AbstractControllerExceptionHandler - Expected one result (or null) to be returned by selectOne(), but found: 2query did not return a unique result: 2问题:qu
2021-10-29 15:17:16 123
原创 Map<String,UserList>集合取一条list数据存入新key
//取map集合中key为Check_before_furnace的list集合List<DeviceCheckContentResponse> deviceCheckContentResponseList = map1.get("Check_before_furnace"); //判断list集合是否有数据 if(deviceCheckContentResponseList.size()>0){ //取list集合中第一条数据
2021-10-29 13:52:45 198
原创 对象转换工具类
对象转换工具类package com.jingchuang.mesopenapi.common;import org.springframework.beans.BeanUtils;import java.util.List;import java.util.Objects;import java.util.stream.Collectors;public class BeanUtil { public static <R, T> List<R> newAn
2021-10-29 13:50:07 70
原创 将List集合内中文字符转换为英文字符
将List集合内中文字符转换为英文字符list.forEach(o->{ o.setContent(o.getContent().replace("(","(").replace(")",")")); });replace();
2021-10-29 13:11:32 292
原创 Example类用法example.createCriteria
逆向工程的Example类用法【没写example.createCriteria();执行selectByExample(example)表示:查询全部】当example没加条件(没写example.createCriteria();)执行查询:selectByExample(example)会查询全部参考:分类:框架Mybatis逆向工程会生成实例及实例对应的example(用于添加条件,相当于where后的部分)xxxExample example = new xxxExample();
2021-09-27 14:45:41 908
原创 MySql基础函数
从它的特性得知date是指定的日期,INTERVAL为关键词,expr是具体的时间间隔,type是时间单位。解读:substring_index(要截取的字段, 根据哪个字符截取, 截到第几个指定的字符位置**[写整数 可以是正整数也可以是负整数,正整数从左向右计算,负整数从右向左计算] **)这里有个值得注意的地方是,d可以是负数,这时是指定小数点左边的d位整数位为0,同时小数位均为0;指定的列进行分组,将同一组的列显示出来,并且用分隔符分隔,由函数参数(字段名)决定要返回的列。
2021-08-31 16:29:21 191
原创 常见问题总结
1.什么是Spring FrameworkSpring是一个轻量级,松散耦合的开源应用框架,旨在降低应用程序的开发的复杂度.它具有分层体系结构,允许用户选择组件,为J2EE应用程序开发提供了一个有凝聚力的框架又因为它可以集成其他框架,如Structs、Hibernate、EJB 等,所以又称为框架的框架。2.什么是Spring配置文件...
2021-08-04 11:52:08 85
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人