随笔分类 -  java

java 基础
摘要:redis的工具类 import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Component; import javax.annotation.Res 阅读全文
posted @ 2022-08-08 09:35 阅读(281) 评论(0) 推荐(1)
摘要:BigDecimal可以表示任意精度的小数,并对它们进行精确的计算。由于 BigDecimal 对象是不可变的,这些方法中的每一个计算都会产生新的 BigDecimal 对象。因此就会产生创建对象的开销,BigDecimal 就不适合于大量的数学计算,但设计它的目的是用来精确地表示小数。 impor 阅读全文
posted @ 2022-08-08 09:24 阅读(44) 评论(0) 推荐(0)
摘要:LocalDateTime前后端传递转时间戳注解 @JsonDeserialize(using = LocalDateTimeDeserializer.class) @JsonSerialize(using = LocalDateTimeSerializer.class) 实体类加上这两个注解的作用 阅读全文
posted @ 2022-07-22 15:42 阅读(881) 评论(0) 推荐(0)
摘要:@RequestMapping(value = "save", method = RequestMethod.POST) public R save(@RequestParam("imgFile") MultipartFile file) { String fileName = file.getOr 阅读全文
posted @ 2022-07-21 09:58 阅读(510) 评论(0) 推荐(0)
摘要:我这里提供的是mybatis plus 和 xml配置文件结合的方式:直接从service层开始写: service //这是service层,多表分页的简单逻辑处理,重点是IPage 和 Map, // IPage 就是分页,把分页的参数传进来进行使用 // Map 是用来传参数使用的,携带你需要 阅读全文
posted @ 2022-07-20 16:06 阅读(3462) 评论(1) 推荐(0)
摘要:集合转为数组 List<Long> chargeIds =new ArrayList<Long>(); Long [] ids=(Long[])chargeIds.toArray(); List<Map<String,Object>>转List<T> list map对象转list对象 List<M 阅读全文
posted @ 2022-07-20 11:31 阅读(2110) 评论(0) 推荐(0)
摘要:java8中时间的各种转换(LocalDateTime) 1.将LocalDateTime转为自定义的时间格式的字符串 public static String getDateTimeAsString(LocalDateTime localDateTime, String format) { Dat 阅读全文
posted @ 2022-07-18 08:50 阅读(5397) 评论(0) 推荐(0)
摘要:List<Map<String, Object>> 去出重复 public static void main(String[] args) { String [] array= {"name","age"}; List<Map<String, Object>> oldList = getTestDa 阅读全文
posted @ 2022-07-13 08:48 阅读(635) 评论(0) 推荐(0)
摘要:1.集合中获取指定的一个属性值 List<String> items = li.stream().map(ScdCostChargeItemEntity::getItem).collect(Collectors.toList()); 2.集合分组 Map<String, List<T>> yearD 阅读全文
posted @ 2022-07-13 08:48 阅读(203) 评论(0) 推荐(0)
摘要:/** * request转字符串 * @param request * @param charset 编码格式 (UTF-8) * @return * @see [类、类#方法、类#成员] */ public static String parseRequst(HttpServletRequest 阅读全文
posted @ 2022-07-13 08:48 阅读(294) 评论(0) 推荐(0)
摘要:public class MenuTree1 { /** * 构建结束的树 */ private static List<Menu> menuList ; /** * 构建树 * @param menuId 树的根节点id 0:代表顶级节点 * @param nodeList 要构建的数据 * @r 阅读全文
posted @ 2022-07-12 16:41 阅读(80) 评论(0) 推荐(0)
摘要:方式一: List<String> listTemp = new ArrayList<String>(); for(int i=0;i<list.size();i++){ if(!listTemp.contains(list.get(i))){ listTemp.add(list.get(i)); 阅读全文
posted @ 2022-07-12 16:39 阅读(406) 评论(0) 推荐(0)
摘要:@Test public void test10(){ //根据device_code去重,取出重复值 List<Employee> emps =new ArrayList<>(); List<String> dupList = emps.stream().collect(Collectors.gr 阅读全文
posted @ 2022-07-12 16:39 阅读(84) 评论(0) 推荐(0)
摘要:@Test public void test12(){ // 需要过滤的集合 List<Employee> first = Arrays.asList( new Employee(102, "李四", 79, 6666.66, Status.BUSY), new Employee(101, "张三" 阅读全文
posted @ 2022-07-06 09:22 阅读(2849) 评论(0) 推荐(0)