refactor(gear-mat): 重构配料价格历史模块命名
- 将 MatMatPriceHistory 重命名为 MatPriceHistory - 将 MatMatPriceHistoryBo 重命名为 MatPriceHistoryBo - 将 MatMatPriceHistoryVo 重命名为 MatPriceHistoryVo - 将 IMatMatPriceHistoryService 重命名为 IMatPriceHistoryService - 将 MatMatPriceHistoryController 重命名为 MatPriceHistoryController - 将 MatMatPriceHistoryMapper 重命名为 MatPriceHistoryMapper - 更新所有相关的导入包路径和类引用 - 移除不必要的导入和字段声明 - 简化代码结构并优化查询方法实现
This commit is contained in:
@@ -2,12 +2,11 @@ package com.gear.mat.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.gear.common.annotation.RepeatSubmit;
|
||||
@@ -17,12 +16,11 @@ import com.gear.common.core.domain.PageQuery;
|
||||
import com.gear.common.core.domain.R;
|
||||
import com.gear.common.core.validate.AddGroup;
|
||||
import com.gear.common.core.validate.EditGroup;
|
||||
import com.gear.common.core.validate.QueryGroup;
|
||||
import com.gear.common.enums.BusinessType;
|
||||
import com.gear.common.utils.poi.ExcelUtil;
|
||||
import com.gear.mat.domain.vo.MatMatPriceHistoryVo;
|
||||
import com.gear.mat.domain.bo.MatMatPriceHistoryBo;
|
||||
import com.gear.mat.service.IMatMatPriceHistoryService;
|
||||
import com.gear.mat.domain.vo.MatPriceHistoryVo;
|
||||
import com.gear.mat.domain.bo.MatPriceHistoryBo;
|
||||
import com.gear.mat.service.IMatPriceHistoryService;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
@@ -35,15 +33,15 @@ import com.gear.common.core.page.TableDataInfo;
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/mat/matPriceHistory")
|
||||
public class MatMatPriceHistoryController extends BaseController {
|
||||
public class MatPriceHistoryController extends BaseController {
|
||||
|
||||
private final IMatMatPriceHistoryService iMatMatPriceHistoryService;
|
||||
private final IMatPriceHistoryService iMatMatPriceHistoryService;
|
||||
|
||||
/**
|
||||
* 查询配料价格/均价变动历史列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<MatMatPriceHistoryVo> list(MatMatPriceHistoryBo bo, PageQuery pageQuery) {
|
||||
public TableDataInfo<MatPriceHistoryVo> list(MatPriceHistoryBo bo, PageQuery pageQuery) {
|
||||
return iMatMatPriceHistoryService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@@ -52,9 +50,9 @@ public class MatMatPriceHistoryController extends BaseController {
|
||||
*/
|
||||
@Log(title = "配料价格/均价变动历史", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(MatMatPriceHistoryBo bo, HttpServletResponse response) {
|
||||
List<MatMatPriceHistoryVo> list = iMatMatPriceHistoryService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "配料价格/均价变动历史", MatMatPriceHistoryVo.class, response);
|
||||
public void export(MatPriceHistoryBo bo, HttpServletResponse response) {
|
||||
List<MatPriceHistoryVo> list = iMatMatPriceHistoryService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "配料价格/均价变动历史", MatPriceHistoryVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +61,7 @@ public class MatMatPriceHistoryController extends BaseController {
|
||||
* @param historyId 主键
|
||||
*/
|
||||
@GetMapping("/{historyId}")
|
||||
public R<MatMatPriceHistoryVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
public R<MatPriceHistoryVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long historyId) {
|
||||
return R.ok(iMatMatPriceHistoryService.queryById(historyId));
|
||||
}
|
||||
@@ -74,7 +72,7 @@ public class MatMatPriceHistoryController extends BaseController {
|
||||
@Log(title = "配料价格/均价变动历史", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody MatMatPriceHistoryBo bo) {
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody MatPriceHistoryBo bo) {
|
||||
return toAjax(iMatMatPriceHistoryService.insertByBo(bo));
|
||||
}
|
||||
|
||||
@@ -84,7 +82,7 @@ public class MatMatPriceHistoryController extends BaseController {
|
||||
@Log(title = "配料价格/均价变动历史", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody MatMatPriceHistoryBo bo) {
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody MatPriceHistoryBo bo) {
|
||||
return toAjax(iMatMatPriceHistoryService.updateByBo(bo));
|
||||
}
|
||||
|
||||
@@ -3,11 +3,9 @@ package com.gear.mat.domain;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
@@ -19,7 +17,7 @@ import com.gear.common.core.domain.BaseEntity;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("mat_mat_price_history")
|
||||
public class MatMatPriceHistory extends BaseEntity {
|
||||
public class MatPriceHistory extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
package com.gear.mat.domain.bo;
|
||||
|
||||
import com.gear.common.core.validate.AddGroup;
|
||||
import com.gear.common.core.validate.EditGroup;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
@@ -20,7 +15,7 @@ import com.gear.common.core.domain.BaseEntity;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MatMatPriceHistoryBo extends BaseEntity {
|
||||
public class MatPriceHistoryBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -3,11 +3,7 @@ package com.gear.mat.domain.vo;
|
||||
import java.math.BigDecimal;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.gear.common.annotation.ExcelDictFormat;
|
||||
import com.gear.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -18,7 +14,7 @@ import java.util.Date;
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class MatMatPriceHistoryVo {
|
||||
public class MatPriceHistoryVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -2,8 +2,8 @@ package com.gear.mat.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gear.mat.domain.MatMatPriceHistory;
|
||||
import com.gear.mat.domain.vo.MatMatPriceHistoryVo;
|
||||
import com.gear.mat.domain.MatPriceHistory;
|
||||
import com.gear.mat.domain.vo.MatPriceHistoryVo;
|
||||
import com.gear.common.core.mapper.BaseMapperPlus;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
* @author ruoyi
|
||||
* @date 2026-01-30
|
||||
*/
|
||||
public interface MatMatPriceHistoryMapper extends BaseMapperPlus<MatMatPriceHistoryMapper, MatMatPriceHistory, MatMatPriceHistoryVo> {
|
||||
public interface MatPriceHistoryMapper extends BaseMapperPlus<MatPriceHistoryMapper, MatPriceHistory, MatPriceHistoryVo> {
|
||||
|
||||
Page<MatMatPriceHistoryVo> selectVoPagePlus(Page<Object> build,@Param("ew") QueryWrapper<MatMatPriceHistory> lqw);
|
||||
Page<MatPriceHistoryVo> selectVoPagePlus(Page<Object> build, @Param("ew") QueryWrapper<MatPriceHistory> lqw);
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
package com.gear.mat.service;
|
||||
|
||||
import com.gear.mat.domain.MatMatPriceHistory;
|
||||
import com.gear.mat.domain.vo.MatMatPriceHistoryVo;
|
||||
import com.gear.mat.domain.bo.MatMatPriceHistoryBo;
|
||||
import com.gear.mat.domain.vo.MatPriceHistoryVo;
|
||||
import com.gear.mat.domain.bo.MatPriceHistoryBo;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
|
||||
@@ -15,32 +14,32 @@ import java.util.List;
|
||||
* @author ruoyi
|
||||
* @date 2026-01-30
|
||||
*/
|
||||
public interface IMatMatPriceHistoryService {
|
||||
public interface IMatPriceHistoryService {
|
||||
|
||||
/**
|
||||
* 查询配料价格/均价变动历史
|
||||
*/
|
||||
MatMatPriceHistoryVo queryById(Long historyId);
|
||||
MatPriceHistoryVo queryById(Long historyId);
|
||||
|
||||
/**
|
||||
* 查询配料价格/均价变动历史列表
|
||||
*/
|
||||
TableDataInfo<MatMatPriceHistoryVo> queryPageList(MatMatPriceHistoryBo bo, PageQuery pageQuery);
|
||||
TableDataInfo<MatPriceHistoryVo> queryPageList(MatPriceHistoryBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询配料价格/均价变动历史列表
|
||||
*/
|
||||
List<MatMatPriceHistoryVo> queryList(MatMatPriceHistoryBo bo);
|
||||
List<MatPriceHistoryVo> queryList(MatPriceHistoryBo bo);
|
||||
|
||||
/**
|
||||
* 新增配料价格/均价变动历史
|
||||
*/
|
||||
Boolean insertByBo(MatMatPriceHistoryBo bo);
|
||||
Boolean insertByBo(MatPriceHistoryBo bo);
|
||||
|
||||
/**
|
||||
* 修改配料价格/均价变动历史
|
||||
*/
|
||||
Boolean updateByBo(MatMatPriceHistoryBo bo);
|
||||
Boolean updateByBo(MatPriceHistoryBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除配料价格/均价变动历史信息
|
||||
@@ -2,7 +2,6 @@ package com.gear.mat.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.gear.common.utils.StringUtils;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -10,11 +9,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.gear.mat.domain.bo.MatMatPriceHistoryBo;
|
||||
import com.gear.mat.domain.vo.MatMatPriceHistoryVo;
|
||||
import com.gear.mat.domain.MatMatPriceHistory;
|
||||
import com.gear.mat.mapper.MatMatPriceHistoryMapper;
|
||||
import com.gear.mat.service.IMatMatPriceHistoryService;
|
||||
import com.gear.mat.domain.bo.MatPriceHistoryBo;
|
||||
import com.gear.mat.domain.vo.MatPriceHistoryVo;
|
||||
import com.gear.mat.domain.MatPriceHistory;
|
||||
import com.gear.mat.mapper.MatPriceHistoryMapper;
|
||||
import com.gear.mat.service.IMatPriceHistoryService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -28,15 +27,15 @@ import java.util.Collection;
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class MatMatPriceHistoryServiceImpl implements IMatMatPriceHistoryService {
|
||||
public class MatPriceHistoryServiceImpl implements IMatPriceHistoryService {
|
||||
|
||||
private final MatMatPriceHistoryMapper baseMapper;
|
||||
private final MatPriceHistoryMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询配料价格/均价变动历史
|
||||
*/
|
||||
@Override
|
||||
public MatMatPriceHistoryVo queryById(Long historyId){
|
||||
public MatPriceHistoryVo queryById(Long historyId){
|
||||
return baseMapper.selectVoById(historyId);
|
||||
}
|
||||
|
||||
@@ -44,14 +43,14 @@ public class MatMatPriceHistoryServiceImpl implements IMatMatPriceHistoryService
|
||||
* 查询配料价格/均价变动历史列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<MatMatPriceHistoryVo> queryPageList(MatMatPriceHistoryBo bo, PageQuery pageQuery) {
|
||||
QueryWrapper<MatMatPriceHistory> lqw = buildQueryWrapperPlus(bo);
|
||||
Page<MatMatPriceHistoryVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||
public TableDataInfo<MatPriceHistoryVo> queryPageList(MatPriceHistoryBo bo, PageQuery pageQuery) {
|
||||
QueryWrapper<MatPriceHistory> lqw = buildQueryWrapperPlus(bo);
|
||||
Page<MatPriceHistoryVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
private QueryWrapper<MatMatPriceHistory> buildQueryWrapperPlus(MatMatPriceHistoryBo bo) {
|
||||
QueryWrapper<MatMatPriceHistory> lqw = Wrappers.query();
|
||||
private QueryWrapper<MatPriceHistory> buildQueryWrapperPlus(MatPriceHistoryBo bo) {
|
||||
QueryWrapper<MatPriceHistory> lqw = Wrappers.query();
|
||||
lqw.eq(bo.getMaterialId() != null, "t.material_id", bo.getMaterialId());
|
||||
lqw.eq(bo.getPrice() != null, "t.price", bo.getPrice());
|
||||
lqw.eq(bo.getAvgPrice() != null, "t.avg_price", bo.getAvgPrice());
|
||||
@@ -67,18 +66,18 @@ public class MatMatPriceHistoryServiceImpl implements IMatMatPriceHistoryService
|
||||
* 查询配料价格/均价变动历史列表
|
||||
*/
|
||||
@Override
|
||||
public List<MatMatPriceHistoryVo> queryList(MatMatPriceHistoryBo bo) {
|
||||
LambdaQueryWrapper<MatMatPriceHistory> lqw = buildQueryWrapper(bo);
|
||||
public List<MatPriceHistoryVo> queryList(MatPriceHistoryBo bo) {
|
||||
LambdaQueryWrapper<MatPriceHistory> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<MatMatPriceHistory> buildQueryWrapper(MatMatPriceHistoryBo bo) {
|
||||
private LambdaQueryWrapper<MatPriceHistory> buildQueryWrapper(MatPriceHistoryBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<MatMatPriceHistory> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getMaterialId() != null, MatMatPriceHistory::getMaterialId, bo.getMaterialId());
|
||||
lqw.eq(bo.getPrice() != null, MatMatPriceHistory::getPrice, bo.getPrice());
|
||||
lqw.eq(bo.getAvgPrice() != null, MatMatPriceHistory::getAvgPrice, bo.getAvgPrice());
|
||||
lqw.eq(bo.getQuantity() != null, MatMatPriceHistory::getQuantity, bo.getQuantity());
|
||||
LambdaQueryWrapper<MatPriceHistory> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getMaterialId() != null, MatPriceHistory::getMaterialId, bo.getMaterialId());
|
||||
lqw.eq(bo.getPrice() != null, MatPriceHistory::getPrice, bo.getPrice());
|
||||
lqw.eq(bo.getAvgPrice() != null, MatPriceHistory::getAvgPrice, bo.getAvgPrice());
|
||||
lqw.eq(bo.getQuantity() != null, MatPriceHistory::getQuantity, bo.getQuantity());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@@ -86,8 +85,8 @@ public class MatMatPriceHistoryServiceImpl implements IMatMatPriceHistoryService
|
||||
* 新增配料价格/均价变动历史
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(MatMatPriceHistoryBo bo) {
|
||||
MatMatPriceHistory add = BeanUtil.toBean(bo, MatMatPriceHistory.class);
|
||||
public Boolean insertByBo(MatPriceHistoryBo bo) {
|
||||
MatPriceHistory add = BeanUtil.toBean(bo, MatPriceHistory.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
@@ -100,8 +99,8 @@ public class MatMatPriceHistoryServiceImpl implements IMatMatPriceHistoryService
|
||||
* 修改配料价格/均价变动历史
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(MatMatPriceHistoryBo bo) {
|
||||
MatMatPriceHistory update = BeanUtil.toBean(bo, MatMatPriceHistory.class);
|
||||
public Boolean updateByBo(MatPriceHistoryBo bo) {
|
||||
MatPriceHistory update = BeanUtil.toBean(bo, MatPriceHistory.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
@@ -109,7 +108,7 @@ public class MatMatPriceHistoryServiceImpl implements IMatMatPriceHistoryService
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(MatMatPriceHistory entity){
|
||||
private void validEntityBeforeSave(MatPriceHistory entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.gear.mat.mapper.MatMatPriceHistoryMapper">
|
||||
<mapper namespace="com.gear.mat.mapper.MatPriceHistoryMapper">
|
||||
|
||||
<resultMap type="com.gear.mat.domain.MatMatPriceHistory" id="MatMatPriceHistoryResult">
|
||||
<resultMap type="com.gear.mat.domain.MatPriceHistory" id="MatMatPriceHistoryResult">
|
||||
<result property="historyId" column="history_id"/>
|
||||
<result property="materialId" column="material_id"/>
|
||||
<result property="price" column="price"/>
|
||||
@@ -17,7 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
<select id="selectVoPagePlus" resultType="com.gear.mat.domain.vo.MatMatPriceHistoryVo">
|
||||
<select id="selectVoPagePlus" resultType="com.gear.mat.domain.vo.MatPriceHistoryVo">
|
||||
SELECT
|
||||
t.history_id AS historyId,
|
||||
t.material_id AS materialId,
|
||||
Reference in New Issue
Block a user