chore: 移除测试控制器与测试表相关代码
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
package com.guo.learningprogresstracker.controller;
|
||||
|
||||
import com.guo.learningprogresstracker.entity.CommonResult;
|
||||
import com.guo.learningprogresstracker.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);
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
package com.guo.learningprogresstracker.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 测试表
|
||||
* @author Guo
|
||||
* @TableName test_table
|
||||
*/
|
||||
@TableName(value ="test_table")
|
||||
@Data
|
||||
public class TestTableEntity implements Serializable {
|
||||
/**
|
||||
* 测试主键
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* id名字
|
||||
*/
|
||||
private String idName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (that == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != that.getClass()) {
|
||||
return false;
|
||||
}
|
||||
TestTableEntity other = (TestTableEntity) that;
|
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
||||
&& (this.getIdName() == null ? other.getIdName() == null : this.getIdName().equals(other.getIdName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
||||
result = prime * result + ((getIdName() == null) ? 0 : getIdName().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", id=").append(id);
|
||||
sb.append(", idName=").append(idName);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.guo.learningprogresstracker.mapper;
|
||||
|
||||
import com.guo.learningprogresstracker.entity.TestTableEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【test_table(测试表)】的数据库操作Mapper
|
||||
* @createDate 2024-04-28 18:01:21
|
||||
* @Entity generator.domain.TestTable
|
||||
*/
|
||||
@Mapper
|
||||
public interface TestTableMapper extends BaseMapper<TestTableEntity> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.guo.learningprogresstracker.service;
|
||||
|
||||
import com.guo.learningprogresstracker.entity.TestTableEntity;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【test_table(测试表)】的数据库操作Service
|
||||
* @createDate 2024-04-28 18:01:21
|
||||
*/
|
||||
//@Service
|
||||
public interface TestTableService extends IService<TestTableEntity> {
|
||||
|
||||
TestTableEntity getTestEntityById(String id);
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.guo.learningprogresstracker.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.guo.learningprogresstracker.entity.TestTableEntity;
|
||||
import com.guo.learningprogresstracker.mapper.TestTableMapper;
|
||||
import com.guo.learningprogresstracker.service.TestTableService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【test_table(测试表)】的数据库操作Service实现
|
||||
* @createDate 2024-04-28 18:01:21
|
||||
*/
|
||||
@Service
|
||||
public class TestTableServiceImpl extends ServiceImpl<TestTableMapper, TestTableEntity>
|
||||
implements TestTableService {
|
||||
|
||||
@Override
|
||||
public TestTableEntity getTestEntityById(String id) {
|
||||
return this.getById(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user