|
|
|
@ -2,6 +2,8 @@ package cc.niushuai.projects.demo.aspectlock.student.controller;
@@ -2,6 +2,8 @@ package cc.niushuai.projects.demo.aspectlock.student.controller;
|
|
|
|
|
|
|
|
|
|
import cc.niushuai.projects.demo.aspectlock.common.anno.AopLock; |
|
|
|
|
import cc.niushuai.projects.demo.aspectlock.student.entity.Student; |
|
|
|
|
import cn.hutool.core.util.IdUtil; |
|
|
|
|
import cn.hutool.core.util.RandomUtil; |
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable; |
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
@ -20,12 +22,14 @@ public class StudentController {
@@ -20,12 +22,14 @@ public class StudentController {
|
|
|
|
|
@AopLock(enableReflect = true, key = {"student.namex", "student.age"}, keySeparator = "_", value = "age") |
|
|
|
|
@GetMapping("/query/{age}") |
|
|
|
|
public Student query(@PathVariable Long age, Student student) { |
|
|
|
|
return new Student(); |
|
|
|
|
student.setId(IdUtil.simpleUUID()); |
|
|
|
|
return student; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping("/query2/{age}") |
|
|
|
|
public Student query2(@PathVariable Long age, Student student) { |
|
|
|
|
|
|
|
|
|
return new Student(); |
|
|
|
|
student.setId(IdUtil.simpleUUID()); |
|
|
|
|
student.setStuNo(RandomUtil.randomString(64)); |
|
|
|
|
return student; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|