gongchunyi
11 小时以前 35a8e2f73dd2a959409d07b1bd657580662b6956
feat: 根据产品规格获取产品名称
已修改4个文件
27 ■■■■■ 文件已修改
src/main/java/com/ruoyi/production/mapper/ProductMaterialMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/production/service/ProductMaterialService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/production/service/impl/ProductMaterialServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/production/ProductMaterialMapper.xml 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/production/mapper/ProductMaterialMapper.java
@@ -13,4 +13,7 @@
 * @since 2026/03/11 16:35
 */
public interface ProductMaterialMapper extends BaseMapper<ProductMaterial> {
    String selectProductModelIdByName(Long productModelId);
}
src/main/java/com/ruoyi/production/service/ProductMaterialService.java
@@ -30,4 +30,7 @@
    void deleteProductMaterial(List<Long> ids);
    List<ProductMaterialGroupDto> productMaterialListByQuery(String materialName, Integer materialTypeId);
    String selectProductModelIdByName(Long productId);
}
src/main/java/com/ruoyi/production/service/impl/ProductMaterialServiceImpl.java
@@ -409,6 +409,11 @@
        log.info("删除物料成功 ids={}", ids);
    }
    @Override
    public String selectProductModelIdByName(Long productId) {
        return baseMapper.selectProductModelIdByName(productId);
    }
    private void validateProductMaterial(ProductMaterial productMaterial, boolean requireId) {
        if (productMaterial == null) {
            throw new ServiceException("参数不能为空");
src/main/resources/mapper/production/ProductMaterialMapper.xml
@@ -16,4 +16,20 @@
        <result property="updateTime" column="update_time"/>
    </resultMap>
    <select id="selectProductModelIdByName" resultType="java.lang.String" parameterType="java.lang.Long">
        select pm.product_name
        from product_material pm
        left join product_material_sku pms on pms.product_id = pm.id
        <where>
            <choose>
                <when test="productModelId != null">
                    pms.id = #{productModelId}
                </when>
                <otherwise>
                    1 = 0
                </otherwise>
            </choose>
        </where>
    </select>
</mapper>