修改英文
This commit is contained in:
@@ -30,57 +30,45 @@ public class SteelGradeInfoController {
|
||||
@Operation(summary = "查询钢种列表")
|
||||
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<>();
|
||||
queryWrapper.select(StdAlloy::getGradeid, StdAlloy::getName); // 只查询 gradeId 和 name 字段
|
||||
queryWrapper.select(StdAlloy::getGradeid, StdAlloy::getName);
|
||||
if (StringUtils.isNotBlank(keyword)) {
|
||||
queryWrapper.like(StdAlloy::getName, keyword)
|
||||
.or()
|
||||
.like(StdAlloy::getGradeid, keyword);
|
||||
}
|
||||
queryWrapper.orderByAsc(StdAlloy::getName); // 按 name 排序
|
||||
queryWrapper.orderByAsc(StdAlloy::getName);
|
||||
|
||||
// 查询 StdAlloy 数据
|
||||
List<StdAlloy> stdAlloyList = steelGradeInfoService.list(queryWrapper);
|
||||
|
||||
// 使用 BeanUtils 将 StdAlloy 对象的字段映射到 StdAlloyVO
|
||||
List<StdAlloyVO> stdAlloyVOList = new ArrayList<>();
|
||||
for (StdAlloy stdAlloy : stdAlloyList) {
|
||||
StdAlloyVO stdAlloyVO = new StdAlloyVO();
|
||||
BeanUtils.copyProperties(stdAlloy, stdAlloyVO); // 将 StdAlloy 属性复制到 StdAlloyVO
|
||||
BeanUtils.copyProperties(stdAlloy, stdAlloyVO);
|
||||
stdAlloyVOList.add(stdAlloyVO);
|
||||
}
|
||||
|
||||
// 返回结果
|
||||
return R.ok(stdAlloyVOList);
|
||||
}
|
||||
|
||||
@GetMapping("/info")
|
||||
@Operation(summary ="询单个钢种详情")
|
||||
public R<StdAlloy> getSteelGradeInfo(@RequestParam Integer 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);
|
||||
return R.ok(steelGradeInfoService.getById(gradeid));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/add")
|
||||
@Operation(summary ="新增")
|
||||
public R<Boolean> add(@RequestBody StdAlloy steelGradeInfo) {
|
||||
return R.ok(steelGradeInfoService.save(steelGradeInfo));
|
||||
public R<Boolean> add(@RequestBody StdAlloy stdAlloy) {
|
||||
return R.ok(steelGradeInfoService.save(stdAlloy));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary ="更新")
|
||||
public R<Boolean> update(@RequestBody StdAlloy steelGradeInfo) {
|
||||
return R.ok(steelGradeInfoService.updateById(steelGradeInfo));
|
||||
public R<Boolean> update(@RequestBody StdAlloy stdAlloy) {
|
||||
return R.ok(steelGradeInfoService.updateById(stdAlloy));
|
||||
}
|
||||
|
||||
@Operation(summary ="删除")
|
||||
|
||||
@@ -2,10 +2,12 @@ package com.fizz.business.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("std_alloy")
|
||||
public class StdAlloy {
|
||||
|
||||
@TableId("GRADEID")
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.fizz.business.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fizz.business.domain.StdAlloy;
|
||||
import com.fizz.business.domain.SteelGradeInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.fizz.business.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fizz.business.domain.StdAlloy;
|
||||
import com.fizz.business.domain.SteelGradeInfo;
|
||||
|
||||
public interface SteelGradeInfoService extends IService<StdAlloy> {
|
||||
}
|
||||
Reference in New Issue
Block a user