Java开发笔记
List< VO >到List< String >,其中的String为VO中的某一值
List< String >到List< VO >,其中的String为VO中的某一值
// User::new 使用的构造方法是 public User(String name) {}
List<User> users = names.stream().map(User::new).collect(Collectors.toList());
入参中存在List< String >时,mapper写法
雪花算法获取主键id
实体类注解写法
- String
- Integer
- BigDecimal
- LocalDate
queryByWrapper()查询使用
String判空
List< String >判空
List< VO >判空
import org.apache.commons.collections.CollectionUtils;
JAVA中对list使用stream对某个字段求和
Mybatis模糊查询
将实体类VO 转化为List< VO >
获取仓库位置翻译
getBwMeterStorLocation(bmi.meter_warehouse_last_id) as bwMeterStorLocation
LocalDate 转 LocalDateTime
给List中VO的某一字段赋值
baseMapper.queryList();
//判断该物料分类是不是父类,且父类下有没有子类
if(old.getParentId().equals("-1")){
BwMaterialType bwMaterialType = this.queryOne(BwMaterialTypeQuery.build().setParentId(old.getId()));
if(bwMaterialType!=null){
throw new MyRuntimeException(ErrorCode.MATERIALTYPE_HAVE_CHILDREN.getMessage());
}
}
在List中查找某一字段为特定值的数据列
List<SysDictType> children = result.getChildren();
List<SysDictType> collect = children.stream().filter(t -> t.getDictTypeCode().equals(vo.getMeterKind())).collect(Collectors.toList());
在List中查找某一字段为特定值的实体
BasicAbode abode=allAbode.getResultData().stream().filter(t->Objects.equals(t.getAbodeCode(),headerInfo.getBusinessOffice())).findFirst().orElse(null);