随笔分类 - java
摘要:1:浅copy 有一个对象A,在某一时刻A中已经包含了一些有效值,此时可能 会需要一个和A完全相同新对象B,并且此后对B任何改动都不会影响到A中的值,也就是说,A与B是两个独立的对象,但B的初始值是由A对象确定的 class Student { private int number; public
阅读全文
摘要:修改yml etwork.host: 0.0.0.0 node.name: node-1 cluster.initial_master_nodes: ["node-1"] View Code elasticsearch用户拥有的可创建文件描述的权限太低,至少需要65536, vim /etc/sec
阅读全文
摘要:/* package com.dict.business.esinit; import com.dict.business.domain.ESHomeSearch; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.
阅读全文
摘要:private List<ESHomeSearchTreeVo> tree(List<ESHomeSearchTreeVo> allList){ // 构建的整个树数据 List<TreeNode<String>> treeNodeList = allList.stream().map(x -> {
阅读全文
摘要:判断条件放在key中 对应的业务逻辑放在value中 这样子写的好处是非常直观,能直接看到判断条件对应的业务逻辑 代码: import com.wing.service.QueryGrantTypeService; import org.springframework.beans.factory.a
阅读全文
摘要:一:int类型 表: CREATE TABLE `test1` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(2) NOT NULL DEFAULT '', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO
阅读全文
摘要:一:属性注解 1 import java.lang.annotation.*; 2 3 /** 4 * @author 陆伟 5 * 6 */ 7 @Target(ElementType.FIELD) //使用到字段上 8 @Retention(RetentionPolicy.RUNTIME) 9
阅读全文
摘要:一:静态转换方法 1 public static <T> ApiResponse<T> parseResultV2(String json, Class<T> clazz) { 2 return JSONObject.parseObject(json, new TypeReference<ApiRe
阅读全文
摘要:一:""也进行复制 package com.wing.ihome.cloud.core.util; import org.springframework.beans.BeanWrapper; import org.springframework.beans.BeanWrapperImpl; impo
阅读全文
摘要:一:工具 screw 二:使用 <dependency> <groupId>cn.smallbun.screw</groupId> <artifactId>screw-core</artifactId> <version>1.0.3</version> </dependency> package c
阅读全文
摘要:一:Unchecked Exception Unchecked exception也叫做RuntimeException,出现RuntimeException通常是因为我们的代码有问题。RuntimeException是不需要被捕获的。也就是说如果有RuntimeException,没有捕获也可以通
阅读全文
摘要:一:判断集合是否为空 if (CollectionUtils.isEmpty(equConnectTimeEverydays)) { } 二:判断字符串,对象是否为空 if (StringUtils.isEmpty(equConnectTimeDay)) { } 三:list分组 Map<Strin
阅读全文
摘要:1 //往前推一天 2 String ss = DateTimeFormatter.ofPattern("MM/dd").format(LocalDateTime.now().minusDays(1)); 3 System.out.println(ss); 4 5 //往前推一个月 6 String
阅读全文
摘要://对象的泛型。public static <T> void testT(T val) { System.out.println(val.getClass()); }//集合的泛型 public static void test11(Collection<?> collection) { List<
阅读全文
摘要:package com.wing.mall.cloud.activity.modular.service.impl; /** * 解法: 双指针 * * 首先注意数组是有序的,那么重复的元素一定会相邻。 * * 要求删除重复元素,实际上就是将不重复的元素移到数组的左侧。 * * 考虑用 2 个指针,
阅读全文
摘要:1:在实体类上加上注解 /** * 产品名称 */ @TableField("product_name") @NotBlank private String productName; 2:service的校验方法 @Override public void validationOrderRelati
阅读全文
摘要:一:CollectionUtils 例1: 判断集合是否为空: CollectionUtils.isEmpty(null): true CollectionUtils.isEmpty(new ArrayList()): true CollectionUtils.isEmpty({a,b}): fal
阅读全文
摘要:一:RocketMQ 1:下载RocketMQ http://rocketmq.apache.org/release_notes/release-notes-4.7.0/ 2:配置 2. 配置2.1 系统环境变量配置变量名:ROCKETMQ_HOME变量值:MQ解压路径\MQ文件夹名eg、ROCKE
阅读全文
摘要:package com.wing.mall.cloud.base.test.json; import com.alibaba.druid.support.json.JSONUtils; import com.alibaba.fastjson.JSON; import com.alibaba.fast
阅读全文
摘要:一:controller请求 /** * 多线程文件导出 * * @param response * @throws Exception */ @ApiOperation("文件导出") @ApiImplicitParams({ @ApiImplicitParam(name = "babyInsur
阅读全文