摘要: SpringDataJpa的框架没有线程的更新方法,只能调用save()方法实行保存,如果是只更新一处的话,这个也不太适用。所以楼主尝试着自定义sql语句来写。 service层 @Overridepublic int updateStateById(Integer wid) { return or 阅读全文
posted @ 2019-12-04 13:34 super_胡 阅读(8823) 评论(4) 推荐(0) 编辑
摘要: 代码如下: /* 这里记录一下死锁的概念,意思就是两个线程 ,线程一占用了a锁,去拿b锁,线程二占用了b锁,想拿a锁,两个线程谁也没办法继续 */ static String a = "a"; static String b = "b"; public static void main(String 阅读全文
posted @ 2019-11-26 11:20 super_胡 阅读(257) 评论(0) 推荐(0) 编辑
摘要: 这种情况一般是没有在属性上加@Id注解导致的。 @Entity @Data @Table(name = "hl_role_module") public class RoleModule { @Id private String roleId; private String moduleId; } 阅读全文
posted @ 2019-11-14 10:21 super_胡 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 待定 阅读全文
posted @ 2019-11-13 11:32 super_胡 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 关于位运算,以前也见过,搜过,当时会用了,过后就忘了,今天好好学习一遍,然后整理一下。 Java中的位运算,涉及到计算机的二进制,位用bit表示,1Byte=8bit,根据各种基本数据类型占用的字节空间,可以计算各种数据有多少二进制,可以算出对应的取值范围。 java中的位运算包括:与(&)、或(| 阅读全文
posted @ 2019-11-13 11:09 super_胡 阅读(493) 评论(0) 推荐(0) 编辑
摘要: /**一组数 0 1 1 2 3 5 8 13 21 34 ...... 规律是 一个数是前两个数的和 题:写一个程序求第n个数的值 推理 通过递归求出即可,当然递归要有一个终止条件,就是当n<=1的时候,数字没了,所以应该终止了*/ public static void main(String[] 阅读全文
posted @ 2019-11-11 17:06 super_胡 阅读(408) 评论(0) 推荐(0) 编辑
摘要: 我从网上找的一个Demo,运行的时候报 错误:“找不到或无法加载主类”,百度了一番,都是说在项目目录打开cmd,使用 mvn install、mvn clean complie之类的命令,都成功了,但是问题还是没解决,最终解决办法:使用命令mvn idea:idea,然后再run就可以了。 总结:从 阅读全文
posted @ 2019-11-11 10:37 super_胡 阅读(4072) 评论(0) 推荐(0) 编辑
摘要: select根据后台集合显示下列列表 <select class="form-control" name="parentId" > <option ></option> <option th:each="a : ${menus}" th:text="${a.name}" th:value="${a. 阅读全文
posted @ 2019-11-07 18:13 super_胡 阅读(6633) 评论(0) 推荐(0) 编辑
摘要: 使用jpa查询的时候,如果查询不到数据,就会返回这个错误,下面是处理方法。 @Override public User findByEmail(String email) { User user = new User(); user.setEmail(email); Example<User> ex 阅读全文
posted @ 2019-11-06 16:22 super_胡 阅读(6413) 评论(0) 推荐(0) 编辑
摘要: Thymeleaf是Spring boot推荐使用的模板引擎。 一、th属性 html有的属性,Thymeleaf基本都有,而常用的属性大概有七八个。其中th属性执行的优先级从1~8,数字越低优先级越高。 1、th:insert:代码块引入,类似的还有th:replace,th:include,三者 阅读全文
posted @ 2019-11-06 14:12 super_胡 阅读(754) 评论(0) 推荐(0) 编辑