init_object,增加了不完全的登录API,完善数据库设计

This commit is contained in:
guo
2024-06-28 22:31:21 +08:00
parent b0deeb58af
commit f1dc42fce5
14 changed files with 417 additions and 0 deletions
@@ -0,0 +1,37 @@
package com.guo.learningprogresstracker.controller;
import com.guo.learningprogresstracker.domain.entity.CommonResult;
import com.guo.learningprogresstracker.domain.entity.TestTableEntity;
import com.guo.learningprogresstracker.exception.AppException;
import com.guo.learningprogresstracker.exception.ErrorParameterException;
import com.guo.learningprogresstracker.exception.NotFindEntitiesException;
import com.guo.learningprogresstracker.exception.OperationFailedException;
import com.guo.learningprogresstracker.service.TestTableService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
@RestController
@Slf4j
public class TestController {
@Autowired
TestTableService testTableService;
@GetMapping("/test/{id}")
public CommonResult<TestTableEntity> getTestEntityById(@PathVariable("id") String id) throws Exception {
log.info("testGet请求访问");
if ("1".equals(id)) {
throw new AppException("测试AppException");
} else if ("2".equals(id)) {
throw new ErrorParameterException("测试ErrorParameterException");
}else if ("3".equals(id)) {
throw new NotFindEntitiesException("测试NotFindEntitiesException");
}else if ("4".equals(id)) {
throw new OperationFailedException("测试OperationFailedException");
}
TestTableEntity testTableEntity = testTableService.getTestEntityById(id);
return CommonResult.success(testTableEntity);
}
}