修改英文

This commit is contained in:
2025-12-26 16:11:26 +08:00
parent e5b1f885aa
commit dd1b172273
4 changed files with 11 additions and 23 deletions

View File

@@ -30,57 +30,45 @@ public class SteelGradeInfoController {
@Operation(summary = "查询钢种列表") @Operation(summary = "查询钢种列表")
public R<List<StdAlloyVO>> list(@RequestParam(value = "keyword", required = false) String keyword) { public R<List<StdAlloyVO>> list(@RequestParam(value = "keyword", required = false) String keyword) {
// 使用 LambdaQueryWrapper 查询 StdAlloy 表中的数据,支持按名称/编号模糊查询 // 严格按 cgldb.sql查询 std_alloy(GRADEID, NAME)
LambdaQueryWrapper<StdAlloy> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<StdAlloy> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.select(StdAlloy::getGradeid, StdAlloy::getName); // 只查询 gradeId 和 name 字段 queryWrapper.select(StdAlloy::getGradeid, StdAlloy::getName);
if (StringUtils.isNotBlank(keyword)) { if (StringUtils.isNotBlank(keyword)) {
queryWrapper.like(StdAlloy::getName, keyword) queryWrapper.like(StdAlloy::getName, keyword)
.or() .or()
.like(StdAlloy::getGradeid, keyword); .like(StdAlloy::getGradeid, keyword);
} }
queryWrapper.orderByAsc(StdAlloy::getName); // 按 name 排序 queryWrapper.orderByAsc(StdAlloy::getName);
// 查询 StdAlloy 数据
List<StdAlloy> stdAlloyList = steelGradeInfoService.list(queryWrapper); List<StdAlloy> stdAlloyList = steelGradeInfoService.list(queryWrapper);
// 使用 BeanUtils 将 StdAlloy 对象的字段映射到 StdAlloyVO
List<StdAlloyVO> stdAlloyVOList = new ArrayList<>(); List<StdAlloyVO> stdAlloyVOList = new ArrayList<>();
for (StdAlloy stdAlloy : stdAlloyList) { for (StdAlloy stdAlloy : stdAlloyList) {
StdAlloyVO stdAlloyVO = new StdAlloyVO(); StdAlloyVO stdAlloyVO = new StdAlloyVO();
BeanUtils.copyProperties(stdAlloy, stdAlloyVO); // 将 StdAlloy 属性复制到 StdAlloyVO BeanUtils.copyProperties(stdAlloy, stdAlloyVO);
stdAlloyVOList.add(stdAlloyVO); stdAlloyVOList.add(stdAlloyVO);
} }
// 返回结果
return R.ok(stdAlloyVOList); return R.ok(stdAlloyVOList);
} }
@GetMapping("/info") @GetMapping("/info")
@Operation(summary ="询单个钢种详情") @Operation(summary ="询单个钢种详情")
public R<StdAlloy> getSteelGradeInfo(@RequestParam Integer gradeid) { public R<StdAlloy> getSteelGradeInfo(@RequestParam Integer gradeid) {
return R.ok(steelGradeInfoService.getById(gradeid));
// 使用 LambdaQueryWrapper 查询 StdAlloy 表中的数据
LambdaQueryWrapper<StdAlloy> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StdAlloy::getGradeid, gradeid); // 只查询 gradeId 和 name 字段
// 查询 StdAlloy 数据
StdAlloy stdAlloyList = steelGradeInfoService.getById(gradeid);
// 返回结果
return R.ok(stdAlloyList);
} }
@PostMapping("/add") @PostMapping("/add")
@Operation(summary ="新增") @Operation(summary ="新增")
public R<Boolean> add(@RequestBody StdAlloy steelGradeInfo) { public R<Boolean> add(@RequestBody StdAlloy stdAlloy) {
return R.ok(steelGradeInfoService.save(steelGradeInfo)); return R.ok(steelGradeInfoService.save(stdAlloy));
} }
@PutMapping("/update") @PutMapping("/update")
@Operation(summary ="更新") @Operation(summary ="更新")
public R<Boolean> update(@RequestBody StdAlloy steelGradeInfo) { public R<Boolean> update(@RequestBody StdAlloy stdAlloy) {
return R.ok(steelGradeInfoService.updateById(steelGradeInfo)); return R.ok(steelGradeInfoService.updateById(stdAlloy));
} }
@Operation(summary ="删除") @Operation(summary ="删除")

View File

@@ -2,10 +2,12 @@ package com.fizz.business.domain;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Data @Data
@TableName("std_alloy")
public class StdAlloy { public class StdAlloy {
@TableId("GRADEID") @TableId("GRADEID")

View File

@@ -3,7 +3,6 @@ package com.fizz.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fizz.business.domain.StdAlloy; import com.fizz.business.domain.StdAlloy;
import com.fizz.business.domain.SteelGradeInfo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper

View File

@@ -2,7 +2,6 @@ package com.fizz.business.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.fizz.business.domain.StdAlloy; import com.fizz.business.domain.StdAlloy;
import com.fizz.business.domain.SteelGradeInfo;
public interface SteelGradeInfoService extends IService<StdAlloy> { public interface SteelGradeInfoService extends IService<StdAlloy> {
} }