Skip to content

Commit

Permalink
Merge branch 'master-jdk17' of https://gitee.com/zhijiantianya/ruoyi-…
Browse files Browse the repository at this point in the history
…vue-pro

# Conflicts:
#	yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyController.java
#	yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyValueController.java
  • Loading branch information
YunaiV committed Aug 14, 2024
2 parents a30c1c2 + 664abe7 commit 458235e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;

@Tag(name = "管理后台 - 商品属性项")
@RestController
Expand Down Expand Up @@ -70,4 +72,12 @@ public CommonResult<PageResult<ProductPropertyRespVO>> getPropertyPage(@Valid Pr
return success(BeanUtils.toBean(pageResult, ProductPropertyRespVO.class));
}

@GetMapping("/simple-list")
@Operation(summary = "获得属性项精简列表")
public CommonResult<List<ProductPropertyRespVO>> getPropertySimpleList() {
List<ProductPropertyDO> list = productPropertyService.getPropertyList();
return success(convertList(list, property -> new ProductPropertyRespVO() // 只返回 id、name 属性
.setId(property.getId()).setName(property.getName())));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.singleton;

@Tag(name = "管理后台 - 商品属性值")
@RestController
Expand Down Expand Up @@ -70,4 +73,13 @@ public CommonResult<PageResult<ProductPropertyValueRespVO>> getPropertyValuePage
return success(BeanUtils.toBean(pageResult, ProductPropertyValueRespVO.class));
}

@GetMapping("/simple-list")
@Operation(summary = "获得属性值精简列表")
@Parameter(name = "propertyId", description = "属性项编号", required = true, example = "1024")
public CommonResult<List<ProductPropertyValueRespVO>> getPropertyValueSimpleList(@RequestParam("propertyId") Long propertyId) {
List<ProductPropertyValueDO> list = productPropertyValueService.getPropertyValueListByPropertyId(singleton(propertyId));
return success(convertList(list, value -> new ProductPropertyValueRespVO() // 只返回 id、name 属性
.setId(value.getId()).setName(value.getName())));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ public class ProductPropertyDO extends BaseDO {
* 名称
*/
private String name;
/**
* 状态
*/
private Integer status;
/**
* 备注
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,11 @@ public interface ProductPropertyService {
*/
List<ProductPropertyDO> getPropertyList(Collection<Long> ids);

/**
* 获得指定状态的属性项列表
*
* @return 属性项列表
*/
List<ProductPropertyDO> getPropertyList();

}
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,9 @@ public List<ProductPropertyDO> getPropertyList(Collection<Long> ids) {
return productPropertyMapper.selectBatchIds(ids);
}

@Override
public List<ProductPropertyDO> getPropertyList() {
return productPropertyMapper.selectList();
}

}

0 comments on commit 458235e

Please sign in to comment.