Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lanbaoming
jiedao-api-boot-master
Commits
f43a292e
Commit
f43a292e
authored
May 27, 2024
by
liuzeheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商品列表支持多选
parent
7958bb32
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
203 additions
and
3 deletions
+203
-3
ProductMapper.java
...yudao/module/product/dal/mysql/product/ProductMapper.java
+75
-0
ProductReqDTO.java
...va/cn/iocoder/yudao/module/product/dto/ProductReqDTO.java
+88
-0
ProductService.java
.../yudao/module/product/service/product/ProductService.java
+3
-0
ProductServiceImpl.java
...dule/product/service/product/impl/ProductServiceImpl.java
+25
-0
ProductController.java
...e/product/controller/admin/product/ProductController.java
+12
-3
No files found.
yudao-module-product/yudao-module-product-core/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/product/ProductMapper.java
View file @
f43a292e
...
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.product.dal.mysql.product;
...
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.product.dal.mysql.product;
import
cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX
;
import
cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX
;
import
cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX
;
import
cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX
;
import
cn.iocoder.yudao.module.product.dal.dataobject.product.ProductDO
;
import
cn.iocoder.yudao.module.product.dal.dataobject.product.ProductDO
;
import
cn.iocoder.yudao.module.product.dto.ProductReqDTO
;
import
cn.iocoder.yudao.module.product.vo.product.ProductExportReqVO
;
import
cn.iocoder.yudao.module.product.vo.product.ProductExportReqVO
;
import
cn.iocoder.yudao.module.product.vo.product.ProductPageReqVO
;
import
cn.iocoder.yudao.module.product.vo.product.ProductPageReqVO
;
import
cn.iocoder.yudao.module.product.vo.product.ProductTypeNumVO
;
import
cn.iocoder.yudao.module.product.vo.product.ProductTypeNumVO
;
...
@@ -97,6 +98,80 @@ public interface ProductMapper extends BaseMapperX<ProductDO> {
...
@@ -97,6 +98,80 @@ public interface ProductMapper extends BaseMapperX<ProductDO> {
})
})
IPage
<
ProductDO
>
selectPage2
(
IPage
<
ProductDO
>
mpPage
,
@Param
(
"query"
)
ProductPageReqVO
query
);
IPage
<
ProductDO
>
selectPage2
(
IPage
<
ProductDO
>
mpPage
,
@Param
(
"query"
)
ProductPageReqVO
query
);
@ResultType
(
ProductDO
.
class
)
@Select
({
"<script>"
,
"select t.*, c.nickname as creator_name, u.nickname as updater_name "
,
"from ecw_product t "
,
"left join system_user c on t.creator = c.id "
,
"left join system_user u on t.updater = u.id "
,
"where t.deleted = 0 "
,
"<when test = 'query.productCode != null and query.productCode != \"\"'>"
,
"AND t.`product_code` like concat('%',concat(#{query.productCode},'%'))"
,
"</when>"
,
"<when test = 'query.customsCode != null and query.customsCode != \"\"'>"
,
"AND t.`customs_code` like concat('%',concat(#{query.customsCode},'%'))"
,
"</when>"
,
/* "<when test = 'query.typeId != null'>",
"AND t.`type_id` = #{query.typeId}",
"</when>",*/
"<when test=\"query.typeId != null and query.typeId.size()>0\">"
+
" <when test=\"query.typeId != null and query.typeId != '' and query.typeId.size()==1 \">"
+
" AND t.`type_id` =\n"
+
" <foreach item='typeId' index='index' collection='query.typeId' >\n"
+
" #{typeId}"
+
" </foreach>"
+
" </when>"
+
" <when test=\"query.typeId != null and query.typeId != '' and query.typeId.size()>1 \">"
+
" AND t.`type_id` in "
+
" <foreach item='typeId' index='index' collection='query.typeId' open='(' separator=',' close=')'>"
+
" #{typeId}"
+
" </foreach>"
+
" </when>"
+
"</when>"
,
"<when test = 'query.status != null'>"
,
"AND t.`status` = #{query.status}"
,
"</when>"
,
"<when test = 'query.auditStatus != null'>"
,
"AND t.`audit_status` = #{query.auditStatus}"
,
"</when>"
,
"<when test = 'query.titleZh != null and query.titleZh != \"\"'>"
,
"AND (t.`title_zh` like concat('%',concat(#{query.titleZh},'%')) or t.`title_en` like concat('%',concat(#{query.titleZh},'%')))"
,
"</when>"
,
// "<when test = 'query.attrId != null and query.attrId != \"\" '>",
"<when test=\"query.attrId != null and query.attrId.size()>0\">"
,
"<when test=\"query.attrId != null and query.attrId != '' and query.attrId.size()==1 \">"
+
"<foreach item='attrId' index=\"index\" collection='query.attrId' >"
+
"AND t.`attr_id` = #{attrId}"
+
"</foreach>"
+
"</when>"
,
"<when test=\"query.attrId != null and query.attrId != '' and query.attrId.size()>1 \">"
+
"AND (1!=1 "
+
" <foreach item='attrId' index='index' collection='query.attrId'>"
+
" OR FIND_IN_SET(t.`attr_id`, #{attrId})"
+
"</foreach>"
+
" )"
+
"</when>"
,
// "AND FIND_IN_SET(t.`attr_id`, #{query.attrId})",
"</when>"
,
"order by t.id desc"
,
"</script>"
})
IPage
<
ProductDO
>
selectPageResp
(
IPage
<
ProductDO
>
mpPage
,
@Param
(
"query"
)
ProductReqDTO
query
);
default
List
<
ProductDO
>
selectList
(
ProductPageReqVO
reqVO
)
{
default
List
<
ProductDO
>
selectList
(
ProductPageReqVO
reqVO
)
{
return
selectList
(
new
LambdaQueryWrapperX
<
ProductDO
>()
return
selectList
(
new
LambdaQueryWrapperX
<
ProductDO
>()
.
likeIfPresent
(
ProductDO:
:
getProductCode
,
reqVO
.
getProductCode
())
.
likeIfPresent
(
ProductDO:
:
getProductCode
,
reqVO
.
getProductCode
())
...
...
yudao-module-product/yudao-module-product-core/src/main/java/cn/iocoder/yudao/module/product/dto/ProductReqDTO.java
0 → 100644
View file @
f43a292e
package
cn
.
iocoder
.
yudao
.
module
.
product
.
dto
;
import
cn.iocoder.yudao.framework.common.pojo.PageParam
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.ToString
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
@ApiModel
(
"管理后台 - 商品分页 Request DTO"
)
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ToString
(
callSuper
=
true
)
public
class
ProductReqDTO
extends
PageParam
{
@ApiModelProperty
(
value
=
"商品类型id"
)
private
List
<
Long
>
typeId
;
@ApiModelProperty
(
value
=
"商品属性id"
)
//private String attrId;
private
List
<
String
>
attrId
;
@ApiModelProperty
(
value
=
"中文标题"
)
private
String
titleZh
;
@ApiModelProperty
(
value
=
"英文标题"
)
private
String
titleEn
;
@ApiModelProperty
(
value
=
"商品材质,字段material_type"
)
private
String
materialType
;
@ApiModelProperty
(
value
=
"出运要求,1表示下单该类货物需要提供特定证书"
)
private
Integer
requirements
;
@ApiModelProperty
(
value
=
"包装(字典packaging_type)"
)
private
String
packaging
;
@ApiModelProperty
(
value
=
"图片"
)
private
String
imgs
;
@ApiModelProperty
(
value
=
"商品编码"
)
private
String
productCode
;
@ApiModelProperty
(
value
=
"海关编码"
)
private
String
customsCode
;
@ApiModelProperty
(
value
=
"默认货柜位置,字典container_location"
)
private
String
containerLocation
;
@ApiModelProperty
(
value
=
"默认方数"
)
private
BigDecimal
square
;
@ApiModelProperty
(
value
=
"空运重量上限"
)
private
BigDecimal
airWeightLimit
;
@ApiModelProperty
(
value
=
"是否需要预约入仓,0-否,1-是"
)
private
Integer
needBook
;
@ApiModelProperty
(
value
=
"每日入仓上限"
)
private
BigDecimal
dayLimit
;
@ApiModelProperty
(
value
=
"审核状态"
)
private
Integer
auditStatus
;
@ApiModelProperty
(
value
=
"是否展示 默认为展示"
)
private
Integer
status
;
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
@ApiModelProperty
(
value
=
"开始创建时间"
)
private
Date
beginCreateTime
;
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
@ApiModelProperty
(
value
=
"结束创建时间"
)
private
Date
endCreateTime
;
private
boolean
filter
=
true
;
/**
* 有效的transportType集合
*/
private
List
<
String
>
enableTransportTypeList
;
}
yudao-module-product/yudao-module-product-core/src/main/java/cn/iocoder/yudao/module/product/service/product/ProductService.java
View file @
f43a292e
...
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.product.service.product;
...
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.product.service.product;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.module.product.dal.dataobject.product.ProductDO
;
import
cn.iocoder.yudao.module.product.dal.dataobject.product.ProductDO
;
import
cn.iocoder.yudao.module.product.dto.ProductReqDTO
;
import
cn.iocoder.yudao.module.product.vo.product.*
;
import
cn.iocoder.yudao.module.product.vo.product.*
;
import
javax.validation.Valid
;
import
javax.validation.Valid
;
...
@@ -77,6 +78,8 @@ public interface ProductService {
...
@@ -77,6 +78,8 @@ public interface ProductService {
*/
*/
PageResult
<
ProductRespVO
>
getProductPage
(
ProductPageReqVO
pageReqVO
);
PageResult
<
ProductRespVO
>
getProductPage
(
ProductPageReqVO
pageReqVO
);
PageResult
<
ProductRespVO
>
getProductPageResp
(
ProductReqDTO
pageReqVO
);
List
<
ProductDO
>
getProductList
(
ProductPageReqVO
pageReqVO
);
List
<
ProductDO
>
getProductList
(
ProductPageReqVO
pageReqVO
);
/**
/**
...
...
yudao-module-product/yudao-module-product-core/src/main/java/cn/iocoder/yudao/module/product/service/product/impl/ProductServiceImpl.java
View file @
f43a292e
...
@@ -22,6 +22,7 @@ import cn.iocoder.yudao.module.product.dal.mysql.product.ProductAttrMapper;
...
@@ -22,6 +22,7 @@ import cn.iocoder.yudao.module.product.dal.mysql.product.ProductAttrMapper;
import
cn.iocoder.yudao.module.product.dal.mysql.product.ProductMapper
;
import
cn.iocoder.yudao.module.product.dal.mysql.product.ProductMapper
;
import
cn.iocoder.yudao.module.product.dal.mysql.product.ProductPriceStepClearanceMapper
;
import
cn.iocoder.yudao.module.product.dal.mysql.product.ProductPriceStepClearanceMapper
;
import
cn.iocoder.yudao.module.product.dal.mysql.productPriceSnapshot.ProductPriceSnapshotMapper
;
import
cn.iocoder.yudao.module.product.dal.mysql.productPriceSnapshot.ProductPriceSnapshotMapper
;
import
cn.iocoder.yudao.module.product.dto.ProductReqDTO
;
import
cn.iocoder.yudao.module.product.service.coupon.CouponService
;
import
cn.iocoder.yudao.module.product.service.coupon.CouponService
;
import
cn.iocoder.yudao.module.product.service.product.ProductPriceService
;
import
cn.iocoder.yudao.module.product.service.product.ProductPriceService
;
import
cn.iocoder.yudao.module.product.service.product.ProductPriceStepClearanceService
;
import
cn.iocoder.yudao.module.product.service.product.ProductPriceStepClearanceService
;
...
@@ -384,6 +385,30 @@ public class ProductServiceImpl implements ProductService {
...
@@ -384,6 +385,30 @@ public class ProductServiceImpl implements ProductService {
return
productRespVOPageResult
;
return
productRespVOPageResult
;
}
}
@Override
public
PageResult
<
ProductRespVO
>
getProductPageResp
(
ProductReqDTO
pageReqVO
)
{
if
(
pageReqVO
.
isFilter
())
{
pageReqVO
.
setAuditStatus
(
2
);
}
IPage
<
ProductDO
>
mpPage
=
MyBatisUtils
.
buildPage
(
pageReqVO
);
productMapper
.
selectPageResp
(
mpPage
,
pageReqVO
);
PageResult
<
ProductDO
>
pageResult
=
PageResult
.
of
(
mpPage
);
PageResult
<
ProductRespVO
>
productRespVOPageResult
=
ProductConvert
.
INSTANCE
.
convertPage
(
pageResult
);
List
<
ProductRespVO
>
list
=
productRespVOPageResult
.
getList
();
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
for
(
ProductRespVO
productRespVO
:
list
)
{
List
<
ProductPriceStepClearanceBackVO
>
productPriceStepClearanceList
=
productPriceStepClearanceService
.
getProductPriceStepClearanceList
(
productRespVO
.
getId
());
productRespVO
.
setPriceStepClearanceList
(
productPriceStepClearanceList
);
productRespVO
.
setPriceStepClearanceCount
(
new
Long
(
productPriceStepClearanceList
.
size
()));
}
}
return
productRespVOPageResult
;
}
@Override
@Override
public
List
<
Long
>
getProductIdList
(
ProductPageReqVO
pageReqVO
)
{
public
List
<
Long
>
getProductIdList
(
ProductPageReqVO
pageReqVO
)
{
if
(
pageReqVO
.
isFilter
())
{
if
(
pageReqVO
.
isFilter
())
{
...
...
yudao-module-product/yudao-module-product-rest/src/main/java/cn/iocoder/yudao/module/product/controller/admin/product/ProductController.java
View file @
f43a292e
...
@@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.product.convert.product.ProductConvert;
...
@@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.product.convert.product.ProductConvert;
import
cn.iocoder.yudao.module.product.dal.dataobject.product.ProductAttrDO
;
import
cn.iocoder.yudao.module.product.dal.dataobject.product.ProductAttrDO
;
import
cn.iocoder.yudao.module.product.dal.dataobject.product.ProductDO
;
import
cn.iocoder.yudao.module.product.dal.dataobject.product.ProductDO
;
import
cn.iocoder.yudao.module.product.dal.dataobject.product.ProductTypeDO
;
import
cn.iocoder.yudao.module.product.dal.dataobject.product.ProductTypeDO
;
import
cn.iocoder.yudao.module.product.dto.ProductReqDTO
;
import
cn.iocoder.yudao.module.product.enums.AuditEnum
;
import
cn.iocoder.yudao.module.product.enums.AuditEnum
;
import
cn.iocoder.yudao.module.product.service.product.ProductAttrService
;
import
cn.iocoder.yudao.module.product.service.product.ProductAttrService
;
import
cn.iocoder.yudao.module.product.service.product.ProductPriceStepClearanceService
;
import
cn.iocoder.yudao.module.product.service.product.ProductPriceStepClearanceService
;
...
@@ -129,11 +130,12 @@ public class ProductController {
...
@@ -129,11 +130,12 @@ public class ProductController {
@GetMapping
(
"/page"
)
@GetMapping
(
"/page"
)
@ApiOperation
(
"获得商品分页"
)
@ApiOperation
(
"获得商品分页"
)
// @PreAuthorize("@ss.hasPermission('ecw:product:query')")
// @PreAuthorize("@ss.hasPermission('ecw:product:query')")
public
CommonResult
<
PageResult
<
ProductRespVO
>>
getProductPage
(
@Valid
Product
PageReqV
O
pageVO
)
{
public
CommonResult
<
PageResult
<
ProductRespVO
>>
getProductPage
(
@Valid
Product
ReqDT
O
pageVO
)
{
//设置有效的transportTypeList
//设置有效的transportTypeList
initDictParams
(
pageVO
);
initDictParamsCopy
(
pageVO
);
PageResult
<
ProductRespVO
>
pageResult
=
productService
.
getProductPageResp
(
pageVO
);
//PageResult<ProductRespVO> pageResult = productService.getProductPage(pageVO);
PageResult
<
ProductRespVO
>
pageResult
=
productService
.
getProductPage
(
pageVO
);
// List<ProductRespVO> productList = page.getList();
// List<ProductRespVO> productList = page.getList();
// if(CollectionUtil.isNotEmpty(productList)) {
// if(CollectionUtil.isNotEmpty(productList)) {
// for (ProductRespVO productRespVO : productList) {
// for (ProductRespVO productRespVO : productList) {
...
@@ -157,6 +159,13 @@ public class ProductController {
...
@@ -157,6 +159,13 @@ public class ProductController {
pageParam
.
setEnableTransportTypeList
(
CollectionUtil
.
newArrayList
(
"3"
));
pageParam
.
setEnableTransportTypeList
(
CollectionUtil
.
newArrayList
(
"3"
));
}
}
private
void
initDictParamsCopy
(
ProductReqDTO
pageParam
)
{
//目前只复制空运模板
pageParam
.
setEnableTransportTypeList
(
CollectionUtil
.
newArrayList
(
"3"
));
}
@PostMapping
(
"/add"
)
@PostMapping
(
"/add"
)
@ApiOperation
(
"添加商品"
)
@ApiOperation
(
"添加商品"
)
public
CommonResult
<
Long
>
getProductPage
(
@Valid
@RequestBody
AppProductCreateVo
appProductCreateVo
)
{
public
CommonResult
<
Long
>
getProductPage
(
@Valid
@RequestBody
AppProductCreateVo
appProductCreateVo
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment