7 changed files with 132 additions and 26 deletions
-
79src/main/java/com/example/demo/controller/coin/HistoryRecordController.java
-
38src/main/java/com/example/demo/domain/vo/coin/HistoryRecord.java
-
1src/main/java/com/example/demo/domain/vo/coin/Page.java
-
2src/main/java/com/example/demo/mapper/coin/HistoryRecordMapper.java
-
9src/main/java/com/example/demo/service/coin/HistoryRecordService.java
-
27src/main/java/com/example/demo/serviceImpl/coin/HistoryRecordServiceImpl.java
-
2src/main/resources/sqlServiceMapper/HistoryRecordMapper.xml
@ -0,0 +1,79 @@ |
|||||
|
package com.example.demo.controller.coin; |
||||
|
|
||||
|
import com.example.demo.Util.JWTUtil; |
||||
|
import com.example.demo.domain.entity.Admin; |
||||
|
import com.example.demo.domain.vo.coin.HistoryRecord; |
||||
|
import com.example.demo.domain.vo.coin.Page; |
||||
|
import com.example.demo.domain.vo.coin.Result; |
||||
|
import com.example.demo.service.coin.HistoryRecordService; |
||||
|
import jakarta.servlet.http.HttpServletRequest; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.util.ObjectUtils; |
||||
|
import org.springframework.web.bind.annotation.CrossOrigin; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
import org.springframework.web.context.request.RequestContextHolder; |
||||
|
import org.springframework.web.context.request.ServletRequestAttributes; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @program: gold-java |
||||
|
* @ClassName HistoryRecordController |
||||
|
* @description: |
||||
|
* @author: Double |
||||
|
* @create: 2025−08-18 15:32 |
||||
|
* @Version 1.0 |
||||
|
**/ |
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("/history") |
||||
|
@RequiredArgsConstructor |
||||
|
@Slf4j |
||||
|
@CrossOrigin |
||||
|
public class HistoryRecordController { |
||||
|
@Autowired |
||||
|
private HistoryRecordService historyRecordService; |
||||
|
|
||||
|
//获取旧的历史记录 |
||||
|
@RequestMapping("/getOldHistoryRecord") |
||||
|
public Result getOldHistoryRecord(Page page){ |
||||
|
try { |
||||
|
//页码校验 |
||||
|
if (ObjectUtils.isEmpty(page.getPageNum())) { |
||||
|
return Result.error("页码数为空!"); |
||||
|
} |
||||
|
//页面大小校验 |
||||
|
if (ObjectUtils.isEmpty(page.getPageSize())) { |
||||
|
return Result.error("页大小为空!"); |
||||
|
} else { |
||||
|
return Result.success(historyRecordService.getOldHistoryRecord(page.getPageNum(), page.getPageSize(),page.getHistoryRecord())); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return Result.error("请检查筛选数据的格式"); |
||||
|
} |
||||
|
} |
||||
|
//获取新的历史记录 |
||||
|
@RequestMapping("/getNewHistoryRecord") |
||||
|
public Result getNewHistoryRecord(Page page){ |
||||
|
try { |
||||
|
//页码校验 |
||||
|
if (ObjectUtils.isEmpty(page.getPageNum())) { |
||||
|
return Result.error("页码数为空!"); |
||||
|
} |
||||
|
//页面大小校验 |
||||
|
if (ObjectUtils.isEmpty(page.getPageSize())) { |
||||
|
return Result.error("页大小为空!"); |
||||
|
} else { |
||||
|
return Result.success(historyRecordService.getNewHistoryRecord(page.getPageNum(), page.getPageSize(),page.getHistoryRecord())); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
return Result.error("请检查筛选数据的格式"); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -1,8 +1,10 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.example.demo.mapper.coin.HistoryRecordMapper"> |
<mapper namespace="com.example.demo.mapper.coin.HistoryRecordMapper"> |
||||
|
|
||||
<select id="getOldHistoryRecord" resultType="com.example.demo.domain.vo.coin.HistoryRecord"> |
<select id="getOldHistoryRecord" resultType="com.example.demo.domain.vo.coin.HistoryRecord"> |
||||
</select> |
</select> |
||||
|
|
||||
<select id="getNewHistoryRecord" resultType="com.example.demo.domain.vo.coin.HistoryRecord"> |
<select id="getNewHistoryRecord" resultType="com.example.demo.domain.vo.coin.HistoryRecord"> |
||||
</select> |
</select> |
||||
</mapper> |
</mapper> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue