17 changed files with 758 additions and 19 deletions
-
5pom.xml
-
3tp-admin/src/main/java/com/inscloudtech/web/controller/system/ToolManageController.java
-
6tp-admin/src/main/resources/application-dev.yml
-
39tp-admin/src/main/resources/application.yml
-
34tp-framework/src/main/java/com/inscloudtech/framework/config/ApiDecryptAutoConfiguration.java
-
36tp-framework/src/main/java/com/inscloudtech/framework/config/properties/ApiDecryptProperties.java
-
20tp-framework/src/main/java/com/inscloudtech/framework/encrypt/ApiEncrypt.java
-
112tp-framework/src/main/java/com/inscloudtech/framework/filter/CryptoFilter.java
-
95tp-framework/src/main/java/com/inscloudtech/framework/filter/DecryptRequestBodyWrapper.java
-
125tp-framework/src/main/java/com/inscloudtech/framework/filter/EncryptResponseBodyWrapper.java
-
5tp-functional/pom.xml
-
169tp-functional/src/main/java/com/inscloudtech/functional/controller/CpuInfoController.java
-
72tp-functional/src/main/java/com/inscloudtech/functional/domain/CpuInfo.java
-
18tp-functional/src/main/java/com/inscloudtech/functional/mapper/CpuInfoMapper.java
-
16tp-functional/src/main/java/com/inscloudtech/functional/service/CpuInfoService.java
-
21tp-functional/src/main/java/com/inscloudtech/functional/service/impl/CpuInfoServiceImpl.java
-
1tp-system/src/main/java/com/inscloudtech/system/service/impl/ToolManageServiceImpl.java
@ -0,0 +1,34 @@ |
|||
package com.inscloudtech.framework.config; |
|||
|
|||
import com.inscloudtech.framework.config.properties.ApiDecryptProperties; |
|||
import com.inscloudtech.framework.filter.CryptoFilter; |
|||
import org.springframework.boot.autoconfigure.AutoConfiguration; |
|||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
|||
import org.springframework.boot.context.properties.EnableConfigurationProperties; |
|||
import org.springframework.boot.web.servlet.FilterRegistrationBean; |
|||
import org.springframework.context.annotation.Bean; |
|||
|
|||
import javax.servlet.DispatcherType; |
|||
|
|||
|
|||
/** |
|||
* api 解密自动配置 |
|||
* |
|||
* @author wdhcr |
|||
*/ |
|||
@AutoConfiguration |
|||
@EnableConfigurationProperties(ApiDecryptProperties.class) |
|||
@ConditionalOnProperty(value = "api-decrypt.enabled", havingValue = "true") |
|||
public class ApiDecryptAutoConfiguration { |
|||
|
|||
@Bean |
|||
public FilterRegistrationBean<CryptoFilter> cryptoFilterRegistration(ApiDecryptProperties properties) { |
|||
FilterRegistrationBean<CryptoFilter> registration = new FilterRegistrationBean<>(); |
|||
registration.setDispatcherTypes(DispatcherType.REQUEST); |
|||
registration.setFilter(new CryptoFilter(properties)); |
|||
registration.addUrlPatterns("/*"); |
|||
registration.setName("cryptoFilter"); |
|||
registration.setOrder(FilterRegistrationBean.HIGHEST_PRECEDENCE); |
|||
return registration; |
|||
} |
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.inscloudtech.framework.config.properties; |
|||
|
|||
import lombok.Data; |
|||
import org.springframework.boot.context.properties.ConfigurationProperties; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* api解密属性配置类 |
|||
* @author wdhcr |
|||
*/ |
|||
@Data |
|||
@Component |
|||
@ConfigurationProperties(prefix = "api-decrypt") |
|||
public class ApiDecryptProperties { |
|||
|
|||
/** |
|||
* 加密开关 |
|||
*/ |
|||
private Boolean enabled; |
|||
|
|||
/** |
|||
* 头部标识 |
|||
*/ |
|||
private String headerFlag; |
|||
|
|||
/** |
|||
* 响应加密公钥 |
|||
*/ |
|||
private String publicKey; |
|||
|
|||
/** |
|||
* 请求解密私钥 |
|||
*/ |
|||
private String privateKey; |
|||
|
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.inscloudtech.framework.encrypt; |
|||
|
|||
import java.lang.annotation.*; |
|||
|
|||
/** |
|||
* 强制加密注解 |
|||
* |
|||
* @author Michelle.Chung |
|||
*/ |
|||
@Documented |
|||
@Target({ElementType.METHOD}) |
|||
@Retention(RetentionPolicy.RUNTIME) |
|||
public @interface ApiEncrypt { |
|||
|
|||
/** |
|||
* 响应加密忽略,默认不加密,为 true 时加密 |
|||
*/ |
|||
boolean response() default false; |
|||
|
|||
} |
@ -0,0 +1,112 @@ |
|||
package com.inscloudtech.framework.filter; |
|||
|
|||
import cn.hutool.core.util.ObjectUtil; |
|||
|
|||
import com.inscloudtech.common.exception.ServiceException; |
|||
import com.inscloudtech.common.utils.StringUtils; |
|||
import com.inscloudtech.common.utils.spring.SpringUtils; |
|||
import com.inscloudtech.framework.config.properties.ApiDecryptProperties; |
|||
import com.inscloudtech.framework.encrypt.ApiEncrypt; |
|||
import org.springframework.http.HttpMethod; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.web.method.HandlerMethod; |
|||
import org.springframework.web.servlet.HandlerExceptionResolver; |
|||
import org.springframework.web.servlet.HandlerExecutionChain; |
|||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; |
|||
|
|||
import javax.servlet.*; |
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.io.IOException; |
|||
|
|||
|
|||
/** |
|||
* Crypto 过滤器 |
|||
* |
|||
* @author wdhcr |
|||
*/ |
|||
public class CryptoFilter implements Filter { |
|||
private final ApiDecryptProperties properties; |
|||
|
|||
public CryptoFilter(ApiDecryptProperties properties) { |
|||
this.properties = properties; |
|||
} |
|||
|
|||
@Override |
|||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { |
|||
HttpServletRequest servletRequest = (HttpServletRequest) request; |
|||
HttpServletResponse servletResponse = (HttpServletResponse) response; |
|||
// 获取加密注解 |
|||
ApiEncrypt apiEncrypt = this.getApiEncryptAnnotation(servletRequest); |
|||
boolean responseFlag = apiEncrypt != null && apiEncrypt.response(); |
|||
ServletRequest requestWrapper = null; |
|||
ServletResponse responseWrapper = null; |
|||
EncryptResponseBodyWrapper responseBodyWrapper = null; |
|||
|
|||
// 是否为 put 或者 post 请求 |
|||
if (HttpMethod.PUT.matches(servletRequest.getMethod()) || HttpMethod.POST.matches(servletRequest.getMethod())) { |
|||
// 是否存在加密标头 |
|||
String headerValue = servletRequest.getHeader(properties.getHeaderFlag()); |
|||
if (StringUtils.isNotBlank(headerValue)) { |
|||
// 请求解密 |
|||
requestWrapper = new DecryptRequestBodyWrapper(servletRequest, properties.getPrivateKey(), properties.getHeaderFlag()); |
|||
} else { |
|||
// 是否有注解,有就报错,没有放行 |
|||
if (ObjectUtil.isNotNull(apiEncrypt)) { |
|||
HandlerExceptionResolver exceptionResolver = SpringUtils.getBean("handlerExceptionResolver", HandlerExceptionResolver.class); |
|||
exceptionResolver.resolveException( |
|||
servletRequest, servletResponse, null, |
|||
new ServiceException("没有访问权限,请联系管理员授权", HttpStatus.FORBIDDEN.value())); |
|||
return; |
|||
} |
|||
} |
|||
} |
|||
|
|||
// 判断是否响应加密 |
|||
if (responseFlag) { |
|||
responseBodyWrapper = new EncryptResponseBodyWrapper(servletResponse); |
|||
responseWrapper = responseBodyWrapper; |
|||
} |
|||
|
|||
chain.doFilter( |
|||
ObjectUtil.defaultIfNull(requestWrapper, request), |
|||
ObjectUtil.defaultIfNull(responseWrapper, response)); |
|||
|
|||
if (responseFlag) { |
|||
servletResponse.reset(); |
|||
// 对原始内容加密 |
|||
String encryptContent = responseBodyWrapper.getEncryptContent( |
|||
servletResponse, properties.getPublicKey(), properties.getHeaderFlag()); |
|||
// 对加密后的内容写出 |
|||
servletResponse.getWriter().write(encryptContent); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 获取 ApiEncrypt 注解 |
|||
*/ |
|||
private ApiEncrypt getApiEncryptAnnotation(HttpServletRequest servletRequest) { |
|||
RequestMappingHandlerMapping handlerMapping = SpringUtils.getBean("requestMappingHandlerMapping", RequestMappingHandlerMapping.class); |
|||
// 获取注解 |
|||
try { |
|||
HandlerExecutionChain mappingHandler = handlerMapping.getHandler(servletRequest); |
|||
if (ObjectUtil.isNotNull(mappingHandler)) { |
|||
Object handler = mappingHandler.getHandler(); |
|||
if (ObjectUtil.isNotNull(handler)) { |
|||
// 从handler获取注解 |
|||
if (handler instanceof HandlerMethod) { |
|||
HandlerMethod handlerMethod = (HandlerMethod)handler; |
|||
return handlerMethod.getMethodAnnotation(ApiEncrypt.class); |
|||
} |
|||
} |
|||
} |
|||
} catch (Exception e) { |
|||
throw new RuntimeException(e); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public void destroy() { |
|||
} |
|||
} |
@ -0,0 +1,95 @@ |
|||
package com.inscloudtech.framework.filter; |
|||
|
|||
import cn.hutool.core.io.IoUtil; |
|||
|
|||
import com.inscloudtech.common.constant.Constants; |
|||
import com.inscloudtech.common.utils.EncryptUtils; |
|||
import org.springframework.http.MediaType; |
|||
|
|||
import javax.servlet.ReadListener; |
|||
import javax.servlet.ServletInputStream; |
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletRequestWrapper; |
|||
import java.io.BufferedReader; |
|||
import java.io.ByteArrayInputStream; |
|||
import java.io.IOException; |
|||
import java.io.InputStreamReader; |
|||
import java.nio.charset.StandardCharsets; |
|||
|
|||
/** |
|||
* 解密请求参数工具类 |
|||
* |
|||
* @author wdhcr |
|||
*/ |
|||
public class DecryptRequestBodyWrapper extends HttpServletRequestWrapper { |
|||
|
|||
private final byte[] body; |
|||
|
|||
public DecryptRequestBodyWrapper(HttpServletRequest request, String privateKey, String headerFlag) throws IOException { |
|||
super(request); |
|||
// 获取 AES 密码 采用 RSA 加密 |
|||
String headerRsa = request.getHeader(headerFlag); |
|||
String decryptAes = EncryptUtils.decryptByRsa(headerRsa, privateKey); |
|||
// 解密 AES 密码 |
|||
String aesPassword = EncryptUtils.decryptByBase64(decryptAes); |
|||
request.setCharacterEncoding(Constants.UTF8); |
|||
byte[] readBytes = IoUtil.readBytes(request.getInputStream(), false); |
|||
String requestBody = new String(readBytes, StandardCharsets.UTF_8); |
|||
// 解密 body 采用 AES 加密 |
|||
String decryptBody = EncryptUtils.decryptByAes(requestBody, aesPassword); |
|||
body = decryptBody.getBytes(StandardCharsets.UTF_8); |
|||
} |
|||
|
|||
@Override |
|||
public BufferedReader getReader() { |
|||
return new BufferedReader(new InputStreamReader(getInputStream())); |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public int getContentLength() { |
|||
return body.length; |
|||
} |
|||
|
|||
@Override |
|||
public long getContentLengthLong() { |
|||
return body.length; |
|||
} |
|||
|
|||
@Override |
|||
public String getContentType() { |
|||
return MediaType.APPLICATION_JSON_VALUE; |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public ServletInputStream getInputStream() { |
|||
final ByteArrayInputStream bais = new ByteArrayInputStream(body); |
|||
return new ServletInputStream() { |
|||
@Override |
|||
public int read() { |
|||
return bais.read(); |
|||
} |
|||
|
|||
@Override |
|||
public int available() { |
|||
return body.length; |
|||
} |
|||
|
|||
@Override |
|||
public boolean isFinished() { |
|||
return false; |
|||
} |
|||
|
|||
@Override |
|||
public boolean isReady() { |
|||
return false; |
|||
} |
|||
|
|||
@Override |
|||
public void setReadListener(ReadListener readListener) { |
|||
|
|||
} |
|||
}; |
|||
} |
|||
} |
@ -0,0 +1,125 @@ |
|||
package com.inscloudtech.framework.filter; |
|||
|
|||
import cn.hutool.core.util.RandomUtil; |
|||
import com.inscloudtech.common.utils.EncryptUtils; |
|||
|
|||
|
|||
import javax.servlet.ServletOutputStream; |
|||
import javax.servlet.WriteListener; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import javax.servlet.http.HttpServletResponseWrapper; |
|||
import java.io.ByteArrayOutputStream; |
|||
import java.io.IOException; |
|||
import java.io.OutputStreamWriter; |
|||
import java.io.PrintWriter; |
|||
import java.nio.charset.StandardCharsets; |
|||
|
|||
/** |
|||
* 加密响应参数包装类 |
|||
* |
|||
* @author Michelle.Chung |
|||
*/ |
|||
public class EncryptResponseBodyWrapper extends HttpServletResponseWrapper { |
|||
|
|||
private final ByteArrayOutputStream byteArrayOutputStream; |
|||
private final ServletOutputStream servletOutputStream; |
|||
private final PrintWriter printWriter; |
|||
|
|||
public EncryptResponseBodyWrapper(HttpServletResponse response) throws IOException { |
|||
super(response); |
|||
this.byteArrayOutputStream = new ByteArrayOutputStream(); |
|||
this.servletOutputStream = this.getOutputStream(); |
|||
this.printWriter = new PrintWriter(new OutputStreamWriter(byteArrayOutputStream)); |
|||
} |
|||
|
|||
@Override |
|||
public PrintWriter getWriter() { |
|||
return printWriter; |
|||
} |
|||
|
|||
@Override |
|||
public void flushBuffer() throws IOException { |
|||
if (servletOutputStream != null) { |
|||
servletOutputStream.flush(); |
|||
} |
|||
if (printWriter != null) { |
|||
printWriter.flush(); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void reset() { |
|||
byteArrayOutputStream.reset(); |
|||
} |
|||
|
|||
public byte[] getResponseData() throws IOException { |
|||
flushBuffer(); |
|||
return byteArrayOutputStream.toByteArray(); |
|||
} |
|||
|
|||
public String getContent() throws IOException { |
|||
flushBuffer(); |
|||
return byteArrayOutputStream.toString(); |
|||
} |
|||
|
|||
/** |
|||
* 获取加密内容 |
|||
* |
|||
* @param servletResponse response |
|||
* @param publicKey RSA公钥 (用于加密 AES 秘钥) |
|||
* @param headerFlag 请求头标志 |
|||
* @return 加密内容 |
|||
* @throws IOException |
|||
*/ |
|||
public String getEncryptContent(HttpServletResponse servletResponse, String publicKey, String headerFlag) throws IOException { |
|||
// 生成秘钥 |
|||
String aesPassword = RandomUtil.randomString(32); |
|||
// 秘钥使用 Base64 编码 |
|||
String encryptAes = EncryptUtils.encryptByBase64(aesPassword); |
|||
// Rsa 公钥加密 Base64 编码 |
|||
String encryptPassword = EncryptUtils.encryptByRsa(encryptAes, publicKey); |
|||
|
|||
// 设置响应头 |
|||
servletResponse.addHeader("Access-Control-Expose-Headers", headerFlag); |
|||
servletResponse.setHeader(headerFlag, encryptPassword); |
|||
servletResponse.setHeader("Access-Control-Allow-Origin", "*"); |
|||
servletResponse.setHeader("Access-Control-Allow-Methods", "*"); |
|||
servletResponse.setCharacterEncoding(StandardCharsets.UTF_8.toString()); |
|||
|
|||
// 获取原始内容 |
|||
String originalBody = this.getContent(); |
|||
// 对内容进行加密 |
|||
return EncryptUtils.encryptByAes(originalBody, aesPassword); |
|||
} |
|||
|
|||
@Override |
|||
public ServletOutputStream getOutputStream() throws IOException { |
|||
return new ServletOutputStream() { |
|||
@Override |
|||
public boolean isReady() { |
|||
return false; |
|||
} |
|||
|
|||
@Override |
|||
public void setWriteListener(WriteListener writeListener) { |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void write(int b) throws IOException { |
|||
byteArrayOutputStream.write(b); |
|||
} |
|||
|
|||
@Override |
|||
public void write(byte[] b) throws IOException { |
|||
byteArrayOutputStream.write(b); |
|||
} |
|||
|
|||
@Override |
|||
public void write(byte[] b, int off, int len) throws IOException { |
|||
byteArrayOutputStream.write(b, off, len); |
|||
} |
|||
}; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,169 @@ |
|||
package com.inscloudtech.functional.controller; |
|||
|
|||
/***/ |
|||
|
|||
|
|||
import cn.hutool.core.util.StrUtil; |
|||
import cn.hutool.http.HttpUtil; |
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.inscloudtech.common.annotation.Log; |
|||
import com.inscloudtech.common.annotation.RepeatSubmit; |
|||
import com.inscloudtech.common.core.domain.PageQuery; |
|||
import com.inscloudtech.common.core.domain.R; |
|||
import com.inscloudtech.common.core.page.TableDataInfo; |
|||
import com.inscloudtech.common.enums.BusinessType; |
|||
import com.inscloudtech.functional.domain.CpuInfo; |
|||
import com.inscloudtech.functional.service.CpuInfoService; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.jsoup.Jsoup; |
|||
import org.jsoup.nodes.Document; |
|||
import org.jsoup.nodes.Element; |
|||
import org.jsoup.select.Elements; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* CPU性能数据库 |
|||
* |
|||
* @author zfcf |
|||
* @date 2024-08-28 |
|||
*/ |
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@RequestMapping("/functional/info") |
|||
public class CpuInfoController { |
|||
|
|||
private final CpuInfoService cpuInfoService; |
|||
|
|||
/** |
|||
* 分页查询 |
|||
* @param |
|||
* @param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page" ) |
|||
public TableDataInfo<CpuInfo> getCpuInfoPage(PageQuery pageQuery, CpuInfo cpuInfo) { |
|||
Page page = new Page(); |
|||
page.setSize(pageQuery.getPageSize()); |
|||
page.setCurrent(pageQuery.getPageNum()); |
|||
Page result = cpuInfoService.page(page, Wrappers.query(cpuInfo)); |
|||
TableDataInfo dataInfo = new TableDataInfo(); |
|||
dataInfo.setTotal(result.getTotal()); |
|||
dataInfo.setRows(result.getRecords()); |
|||
return dataInfo; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 通过id查询cpu信息 |
|||
* @param id id |
|||
* @return R |
|||
*/ |
|||
@GetMapping("/{id}" ) |
|||
public R getById(@PathVariable("id" ) Long id) { |
|||
return R.ok(cpuInfoService.getById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增cpu信息 |
|||
* @param |
|||
* @return R |
|||
*/ |
|||
@Log(title = "cpu信息", businessType = BusinessType.EXPORT) |
|||
@RepeatSubmit() |
|||
@PostMapping |
|||
public R save(@RequestBody CpuInfo cpuInfo) { |
|||
return R.ok(cpuInfoService.save(cpuInfo)); |
|||
} |
|||
|
|||
/** |
|||
* 修改cpu信息 |
|||
* @param |
|||
* @return R |
|||
*/ |
|||
@Log(title = "cpu信息", businessType = BusinessType.EXPORT) |
|||
@RepeatSubmit() |
|||
@PutMapping |
|||
public R updateById(@RequestBody CpuInfo cpuInfo) { |
|||
return R.ok(cpuInfoService.updateById(cpuInfo)); |
|||
} |
|||
|
|||
/** |
|||
* 通过id删除cpu信息 |
|||
* @param id id |
|||
* @return R |
|||
*/ |
|||
@DeleteMapping("/{id}" ) |
|||
public R removeById(@PathVariable Long id) { |
|||
return R.ok(cpuInfoService.removeById(id)); |
|||
} |
|||
|
|||
@GetMapping("/updateOtherInfo" ) |
|||
public void updateOtherInfo() { |
|||
List<CpuInfo> list = cpuInfoService.list(); |
|||
int i = 0; |
|||
for (CpuInfo info : list) { |
|||
updateByURL(info); |
|||
System.out.println(i++); |
|||
try { |
|||
cpuInfoService.updateById(info); |
|||
}catch (Exception e){ |
|||
System.out.println("e.getMessage() = " + e.getMessage()); |
|||
} |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
static String url = "https://cpu.bmcx.com/{}__cpu/"; |
|||
|
|||
public static void main(String[] args) { |
|||
CpuInfo info = new CpuInfo(); |
|||
info.setId("5493"); |
|||
updateByURL(info); |
|||
} |
|||
|
|||
static void updateByURL(CpuInfo cpuInfo){ |
|||
|
|||
String id = cpuInfo.getId(); |
|||
String _url = StrUtil.format(url,id); |
|||
String html = HttpUtil.get(_url); |
|||
Document document = Jsoup.parse(html); |
|||
Element mainContent = document.getElementById("main_content"); |
|||
Elements tables = mainContent.getElementsByTag("table"); |
|||
Elements tds = tables.get(1).getElementsByTag("td"); |
|||
for(int i = 0; i < tds.size(); i++){ |
|||
if (i < 6) { |
|||
continue; |
|||
} |
|||
|
|||
Element td = tds.get(i); |
|||
if(i + 1 == tds.size()){ |
|||
break; |
|||
} |
|||
Element valTd = tds.get(i + 1); |
|||
String field = td.text(); |
|||
String val = valTd.text(); |
|||
if(field.equals("TDP")){ |
|||
cpuInfo.setTdp(val); |
|||
}else if(field.equals("插槽类型")){ |
|||
cpuInfo.setSocketType(val); |
|||
}else if(field.equals("核心数")){ |
|||
cpuInfo.setCoreCount(val); |
|||
}else if(field.equals("线程数")){ |
|||
cpuInfo.setThreadCount(val); |
|||
}else if(field.equals("主频")){ |
|||
cpuInfo.setBaseFrequency(val); |
|||
}else if(field.equals("睿频")){ |
|||
cpuInfo.setBoostFrequency(val); |
|||
}else if(field.equals("发布时间")){ |
|||
cpuInfo.setReleaseDate(val); |
|||
} |
|||
} |
|||
// System.out.println("cpuInfo = " + cpuInfo); |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,72 @@ |
|||
package com.inscloudtech.functional.domain; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
|
|||
/** |
|||
* cpu信息对象 cpu_info |
|||
* |
|||
* @author zfcf |
|||
* @date 2024-08-28 |
|||
*/ |
|||
@Data |
|||
@TableName("cpu_info") |
|||
public class CpuInfo { |
|||
|
|||
private static final long serialVersionUID=1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
@TableId(value = "id") |
|||
private String id; |
|||
/** |
|||
* 性能排名 |
|||
*/ |
|||
private String paiMing; |
|||
/** |
|||
* 名称 |
|||
*/ |
|||
@TableField(condition = SqlCondition.LIKE) |
|||
private String mingCheng; |
|||
/** |
|||
* |
|||
*/ |
|||
private String baiFenBi; |
|||
/** |
|||
*得分 |
|||
*/ |
|||
private String shuZhi; |
|||
/** |
|||
* TDP |
|||
*/ |
|||
private String tdp; |
|||
/** |
|||
* 插槽类型 |
|||
*/ |
|||
private String socketType; |
|||
/** |
|||
* 核心数 |
|||
*/ |
|||
private String coreCount; |
|||
/** |
|||
* 线程数 |
|||
*/ |
|||
private String threadCount; |
|||
/** |
|||
* 主频 |
|||
*/ |
|||
private String baseFrequency; |
|||
/** |
|||
* 睿频 |
|||
*/ |
|||
private String boostFrequency; |
|||
/** |
|||
* 发布时间 |
|||
*/ |
|||
private String releaseDate; |
|||
|
|||
} |
|||
|
@ -0,0 +1,18 @@ |
|||
package com.inscloudtech.functional.mapper; |
|||
|
|||
|
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.inscloudtech.functional.domain.CpuInfo; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* cpu信息 |
|||
* |
|||
* @author zfcf |
|||
* @date 2024-08-28 |
|||
*/ |
|||
@Mapper |
|||
public interface CpuInfoMapper extends BaseMapper<CpuInfo> { |
|||
|
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.inscloudtech.functional.service; |
|||
|
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.inscloudtech.functional.domain.CpuInfo; |
|||
|
|||
|
|||
/** |
|||
* cpu信息Service接口 |
|||
* @author zfcf |
|||
* @date 2024-08-28 |
|||
*/ |
|||
public interface CpuInfoService extends IService<CpuInfo> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,21 @@ |
|||
package com.inscloudtech.functional.service.impl; |
|||
|
|||
|
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
|
|||
import com.inscloudtech.functional.domain.CpuInfo; |
|||
import com.inscloudtech.functional.mapper.CpuInfoMapper; |
|||
import com.inscloudtech.functional.service.CpuInfoService; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* cpu信息 |
|||
* |
|||
* @author zfcf |
|||
* @date 2024-08-28 |
|||
*/ |
|||
@Service |
|||
public class CpuInfoServiceImpl extends ServiceImpl<CpuInfoMapper, CpuInfo> implements CpuInfoService { |
|||
|
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue