Compare commits
5 Commits
5011984747
...
3f7707f1db
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f7707f1db | ||
|
|
b5ce9d4a3d | ||
|
|
5452cdced6 | ||
|
|
1640ba4b7d | ||
|
|
d57fc6f4ad |
@@ -8,6 +8,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
|||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.core.validate.QueryGroup;
|
import org.dromara.common.core.validate.QueryGroup;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.mall.domain.TzUserSearch;
|
import org.dromara.mall.domain.TzUserSearch;
|
||||||
@@ -17,11 +18,14 @@ import org.dromara.mall.domain.bo.TzNoticeBo;
|
|||||||
import org.dromara.mall.domain.bo.TzPictureAlbumBo;
|
import org.dromara.mall.domain.bo.TzPictureAlbumBo;
|
||||||
import org.dromara.mall.domain.vo.*;
|
import org.dromara.mall.domain.vo.*;
|
||||||
import org.dromara.mall.service.*;
|
import org.dromara.mall.service.*;
|
||||||
|
import org.dromara.system.domain.vo.SysDictDataVo;
|
||||||
|
import org.dromara.system.service.ISysDictTypeService;
|
||||||
import org.dromara.web.common.SecurityUtils;
|
import org.dromara.web.common.SecurityUtils;
|
||||||
import org.dromara.web.common.ServerResponseEntity;
|
import org.dromara.web.common.ServerResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,6 +48,8 @@ public class ApiIndexController {
|
|||||||
|
|
||||||
private final ITzNoticeService tzNoticeService;
|
private final ITzNoticeService tzNoticeService;
|
||||||
|
|
||||||
|
private final ISysDictTypeService dictTypeService;
|
||||||
|
|
||||||
@GetMapping("/indexImgs")
|
@GetMapping("/indexImgs")
|
||||||
@Operation(summary = "首页轮播图" , description = "获取首页轮播图列表信息")
|
@Operation(summary = "首页轮播图" , description = "获取首页轮播图列表信息")
|
||||||
public ServerResponseEntity<List<TzIndexImgVo>> indexImgs() {
|
public ServerResponseEntity<List<TzIndexImgVo>> indexImgs() {
|
||||||
@@ -102,4 +108,18 @@ public class ApiIndexController {
|
|||||||
return ServerResponseEntity.success(noticeDetail);
|
return ServerResponseEntity.success(noticeDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型查询字典数据信息
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/type/{dictType}")
|
||||||
|
public R<List<SysDictDataVo>> dictType(@PathVariable String dictType) {
|
||||||
|
List<SysDictDataVo> data = dictTypeService.selectDictDataByType(dictType);
|
||||||
|
if (ObjectUtil.isNull(data)) {
|
||||||
|
data = new ArrayList<>();
|
||||||
|
}
|
||||||
|
return R.ok(data);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -225,15 +225,33 @@ public class ApiProdController {
|
|||||||
@GetMapping("/categoryByAncestors")
|
@GetMapping("/categoryByAncestors")
|
||||||
@Operation(summary = "根据祖级ID获取分类信息列表", description = "获取所有的产品分类信息,顶级分类的ancestors为0,默认为顶级分类")
|
@Operation(summary = "根据祖级ID获取分类信息列表", description = "获取所有的产品分类信息,顶级分类的ancestors为0,默认为顶级分类")
|
||||||
@Parameter(name = "ancestors", description = "祖级ID")
|
@Parameter(name = "ancestors", description = "祖级ID")
|
||||||
public ServerResponseEntity<List<TzCategoryVo>> categoryByAncestors(@RequestParam(value = "ancestors", defaultValue = "0") Long ancestors) {
|
public ServerResponseEntity<List<TzCategoryVo>> categoryByAncestors(@RequestParam(value = "ancestors", defaultValue = "0") String ancestors) {
|
||||||
List<TzCategoryVo> categories = categoryService.listByAncestors(ancestors);
|
List<TzCategoryVo> categories = categoryService.listByAncestors(ancestors);
|
||||||
return ServerResponseEntity.success(categories);
|
return ServerResponseEntity.success(categories);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/searchProdPage")
|
@PostMapping("/searchProdPage")
|
||||||
@Operation(summary = "分页排序搜索商品", description = "根据商品名搜索")
|
@Operation(summary = "分页排序搜索商品", description = "根据商品名搜索")
|
||||||
@Parameters({@Parameter(name = "categoryId", description = "分类ID"),@Parameter(name = "prodName", description = "商品名"), @Parameter(name = "floor", description = "是否特价 1:是 2:否", required = true),@Parameter(name = "sort", description = "排序(0综合 1价格排序 2热门 3新品)", required = true), @Parameter(name = "orderBy", description = "排序(0升序 1降序)--sort选择1时必传")})
|
@Parameters({
|
||||||
public ServerResponseEntity<IPage<TzProdVo>> searchProdPage(@RequestBody PageQuery pageQuery, @RequestParam(value = "categoryId") Long categoryId, @RequestParam(value = "prodName") String prodName, @RequestParam(value = "floor") Integer floor, @RequestParam(value = "sort") Integer sort, @RequestParam(value = "orderBy") Integer orderBy) {
|
@Parameter(name = "categoryId", description = "分类ID"),
|
||||||
|
@Parameter(name = "prodName", description = "商品名"),
|
||||||
|
@Parameter(name = "envLevel", description = "环保等级", required = false),
|
||||||
|
@Parameter(name = "fireLevel", description = "防火等级", required = false),
|
||||||
|
@Parameter(name = "trialScenario", description = "试用场景", required = false),
|
||||||
|
@Parameter(name = "floor", description = "是否特价 1:是 2:否", required = true),
|
||||||
|
@Parameter(name = "sort", description = "排序(0综合 1价格排序 2热门 3新品)", required = true),
|
||||||
|
@Parameter(name = "orderBy", description = "排序(0升序 1降序)--sort选择1时必传")
|
||||||
|
})
|
||||||
|
public ServerResponseEntity<IPage<TzProdVo>> searchProdPage(
|
||||||
|
@RequestBody PageQuery pageQuery,
|
||||||
|
@RequestParam(value = "categoryId") Long categoryId,
|
||||||
|
@RequestParam(value = "prodName") String prodName,
|
||||||
|
@RequestParam(value = "envLevel", required = false) String envLevel,
|
||||||
|
@RequestParam(value = "fireLevel", required = false) String fireLevel,
|
||||||
|
@RequestParam(value = "trialScenario", required = false) String trialScenario,
|
||||||
|
@RequestParam(value = "floor") Integer floor,
|
||||||
|
@RequestParam(value = "sort") Integer sort,
|
||||||
|
@RequestParam(value = "orderBy") Integer orderBy) {
|
||||||
Long userId = SecurityUtils.getUserInfo();
|
Long userId = SecurityUtils.getUserInfo();
|
||||||
//用户个人搜索关键词叠加
|
//用户个人搜索关键词叠加
|
||||||
if (ObjectUtil.isNotEmpty(userId)) {
|
if (ObjectUtil.isNotEmpty(userId)) {
|
||||||
@@ -241,7 +259,14 @@ public class ApiProdController {
|
|||||||
}
|
}
|
||||||
//热搜关键词次数叠加
|
//热搜关键词次数叠加
|
||||||
hotSearchService.setSearchNum(prodName);
|
hotSearchService.setSearchNum(prodName);
|
||||||
return ServerResponseEntity.success(prodService.getSearchProdPageByProdName(pageQuery, categoryId, prodName, floor, sort, orderBy));
|
|
||||||
|
return ServerResponseEntity.success(prodService.getSearchProdPageByProdName(pageQuery, categoryId, prodName, envLevel, fireLevel, trialScenario,floor, sort, orderBy));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/prodCommPage")
|
||||||
|
@Operation(summary = "商品评论列表", description = "查询商品评论列表")
|
||||||
|
public ServerResponseEntity<IPage<TzProdCommVo>> getMyWithdrawList(TzProdCommBo bo, PageQuery pageQuery) {
|
||||||
|
return ServerResponseEntity.success(prodCommService.selectPageList(bo, pageQuery));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/prodCommByProdId")
|
@PostMapping("/prodCommByProdId")
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import org.dromara.mall.domain.bo.TzSkuBo;
|
|||||||
import org.dromara.mall.domain.vo.TzProdSumVo;
|
import org.dromara.mall.domain.vo.TzProdSumVo;
|
||||||
import org.dromara.mall.domain.vo.TzProdVo;
|
import org.dromara.mall.domain.vo.TzProdVo;
|
||||||
import org.dromara.mall.service.ITzProdService;
|
import org.dromara.mall.service.ITzProdService;
|
||||||
import org.dromara.mall.service.ITzSkuService;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -42,8 +41,6 @@ public class TzProdController extends BaseController {
|
|||||||
|
|
||||||
private final ITzProdService tzProdService;
|
private final ITzProdService tzProdService;
|
||||||
|
|
||||||
private final ITzSkuService tzSkuService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询商品列表
|
* 查询商品列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -212,4 +212,19 @@ public class TzProd extends TenantEntity {
|
|||||||
*/
|
*/
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 环保等级
|
||||||
|
*/
|
||||||
|
private String envLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 防火等级
|
||||||
|
*/
|
||||||
|
private String fireLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试用场景
|
||||||
|
*/
|
||||||
|
private String trialScenario;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,11 @@ public class TzProdComm extends TenantEntity {
|
|||||||
*/
|
*/
|
||||||
private Long prodId;
|
private Long prodId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
private String prodName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单 ID
|
* 订单 ID
|
||||||
*/
|
*/
|
||||||
@@ -83,5 +88,10 @@ public class TzProdComm extends TenantEntity {
|
|||||||
*/
|
*/
|
||||||
private Long delFlag;
|
private Long delFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 浏览量
|
||||||
|
*/
|
||||||
|
private Long num;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -217,4 +217,19 @@ public class TzProdBo extends TenantEntity {
|
|||||||
*/
|
*/
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 环保等级(查询多值时逗号隔开)
|
||||||
|
*/
|
||||||
|
private String envLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 防火等级(查询多值时逗号隔开)
|
||||||
|
*/
|
||||||
|
private String fireLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试用场景(查询多值时逗号隔开)
|
||||||
|
*/
|
||||||
|
private String trialScenario;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,11 @@ public class TzProdCommBo extends BaseEntity {
|
|||||||
@NotNull(message = "商品ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
@NotNull(message = "商品ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
private Long prodId;
|
private Long prodId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
private String prodName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单 ID
|
* 订单 ID
|
||||||
*/
|
*/
|
||||||
@@ -82,5 +87,15 @@ public class TzProdCommBo extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private Integer delFlag;
|
private Integer delFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 浏览量
|
||||||
|
*/
|
||||||
|
private Long num;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序 1-最新,2-最热
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,6 +104,12 @@ public class HyBasketVo implements Serializable {
|
|||||||
@ExcelProperty(value = "SKU图片")
|
@ExcelProperty(value = "SKU图片")
|
||||||
private String pic;
|
private String pic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指导价
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "指导价")
|
||||||
|
private BigDecimal guidingPrice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SKU成本价格
|
* SKU成本价格
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -153,6 +153,12 @@ public class HyOrderItemVo implements Serializable {
|
|||||||
@ExcelProperty(value = "付款金额")
|
@ExcelProperty(value = "付款金额")
|
||||||
private BigDecimal payPrice;
|
private BigDecimal payPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指导价
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "指导价")
|
||||||
|
private BigDecimal guidingPrice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付状态 1:待支付 2:未付清 3:已付清
|
* 支付状态 1:待支付 2:未付清 3:已付清
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -109,5 +109,11 @@ public class TzProdCommVo implements Serializable {
|
|||||||
@ExcelProperty(value = "评论时间")
|
@ExcelProperty(value = "评论时间")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 浏览量
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "浏览量")
|
||||||
|
private Long num;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -289,5 +289,20 @@ public class TzProdVo implements Serializable {
|
|||||||
@ExcelProperty(value = "备注")
|
@ExcelProperty(value = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 环保等级
|
||||||
|
*/
|
||||||
|
private String envLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 防火等级
|
||||||
|
*/
|
||||||
|
private String fireLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试用场景
|
||||||
|
*/
|
||||||
|
private String trialScenario;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public interface TzProdMapper extends BaseMapperPlus<TzProd, TzProdVo>, MPJBaseM
|
|||||||
* @param orderBy
|
* @param orderBy
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
IPage<TzProdVo> getSearchProdPageByProdName(@Param("page") IPage<TzProdBo> page, @Param("categoryId") Long categoryId, @Param("prodName") String prodName, @Param("floor") Integer floor, @Param("sort") Integer sort, @Param("orderBy") Integer orderBy);
|
IPage<TzProdVo> getSearchProdPageByProdName(@Param("page") IPage<TzProdBo> page, @Param("categoryId") Long categoryId, @Param("prodName") String prodName, @Param("envLevel") String envLevel, @Param("fireLevel") String fireLevel, @Param("trialScenario") String trialScenario, @Param("floor") Integer floor, @Param("sort") Integer sort, @Param("orderBy") Integer orderBy);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -74,5 +74,5 @@ public interface ITzCategoryService {
|
|||||||
* @param ancestors
|
* @param ancestors
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<TzCategoryVo> listByAncestors(Long ancestors);
|
List<TzCategoryVo> listByAncestors(String ancestors);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,4 +91,12 @@ public interface ITzProdCommService {
|
|||||||
* @return 商品评论分页列表
|
* @return 商品评论分页列表
|
||||||
*/
|
*/
|
||||||
IPage<TzProdCommVo> queryPageListByUser(TzProdCommBo bo, PageQuery pageQuery);
|
IPage<TzProdCommVo> queryPageListByUser(TzProdCommBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询商品评论列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 商品评论列表
|
||||||
|
*/
|
||||||
|
IPage<TzProdCommVo> selectPageList(TzProdCommBo bo, PageQuery pageQuery);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ public interface ITzProdService extends MPJBaseService<TzProd> {
|
|||||||
* @param orderBy
|
* @param orderBy
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
IPage<TzProdVo> getSearchProdPageByProdName(PageQuery pageQuery, Long categoryId, String prodName, Integer floor, Integer sort, Integer orderBy);
|
IPage<TzProdVo> getSearchProdPageByProdName(PageQuery pageQuery, Long categoryId, String prodName, String envLevel, String fireLevel, String trialScenario, Integer floor, Integer sort, Integer orderBy);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品收藏
|
* 商品收藏
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ public class HyBasketServiceImpl extends MPJBaseServiceImpl<HyBasketMapper,HyBas
|
|||||||
.selectAll(HyBasket.class)
|
.selectAll(HyBasket.class)
|
||||||
.select(TzProd::getProdCode, TzProd::getProdName, TzProd::getPic, TzProd::getUnit)
|
.select(TzProd::getProdCode, TzProd::getProdName, TzProd::getPic, TzProd::getUnit)
|
||||||
.select(TzSku::getSkuCode, TzSku::getSkuFactoryCode, TzSku::getSkuName)
|
.select(TzSku::getSkuCode, TzSku::getSkuFactoryCode, TzSku::getSkuName)
|
||||||
|
.selectAs(TzProd::getGuidingPrice, HyBasketVo::getGuidingPrice)
|
||||||
.selectAs(TzSku::getPrice, HyBasketVo::getOriPrice)
|
.selectAs(TzSku::getPrice, HyBasketVo::getOriPrice)
|
||||||
.leftJoin(TzProd.class, TzProd::getProdId, HyBasket::getProdId)
|
.leftJoin(TzProd.class, TzProd::getProdId, HyBasket::getProdId)
|
||||||
.leftJoin(TzSku.class, TzSku::getSkuId, HyBasket::getSkuId)
|
.leftJoin(TzSku.class, TzSku::getSkuId, HyBasket::getSkuId)
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ public class HyOrderItemServiceImpl extends MPJBaseServiceImpl<HyOrderItemMapper
|
|||||||
MPJLambdaWrapper<HyOrderItem> wrapper = buildQueryWrapper(bo)
|
MPJLambdaWrapper<HyOrderItem> wrapper = buildQueryWrapper(bo)
|
||||||
.selectAll(HyOrderItem.class)
|
.selectAll(HyOrderItem.class)
|
||||||
.select(TzProd::getProdName, TzProd::getPic,TzProd::getUnit)
|
.select(TzProd::getProdName, TzProd::getPic,TzProd::getUnit)
|
||||||
.select(TzSku::getSkuName, TzSku::getPrice)
|
.select(TzSku::getSkuName, TzSku::getPrice,TzSku::getGuidingPrice)
|
||||||
.leftJoin(TzProd.class, TzProd::getProdId, HyOrderItem::getProdId)
|
.leftJoin(TzProd.class, TzProd::getProdId, HyOrderItem::getProdId)
|
||||||
.leftJoin(TzSku.class, TzSku::getSkuId, HyOrderItem::getSkuId)
|
.leftJoin(TzSku.class, TzSku::getSkuId, HyOrderItem::getSkuId)
|
||||||
.orderByDesc(HyOrderItem::getCreateTime);
|
.orderByDesc(HyOrderItem::getCreateTime);
|
||||||
@@ -382,7 +382,7 @@ public class HyOrderItemServiceImpl extends MPJBaseServiceImpl<HyOrderItemMapper
|
|||||||
MPJLambdaWrapper<HyOrderItem> wrapper = new MPJLambdaWrapper<HyOrderItem>()
|
MPJLambdaWrapper<HyOrderItem> wrapper = new MPJLambdaWrapper<HyOrderItem>()
|
||||||
.selectAll(HyOrderItem.class)
|
.selectAll(HyOrderItem.class)
|
||||||
.select(TzProd::getProdName, TzProd::getPic,TzProd::getUnit)
|
.select(TzProd::getProdName, TzProd::getPic,TzProd::getUnit)
|
||||||
.select(TzSku::getSkuName, TzSku::getPrice)
|
.select(TzSku::getSkuName, TzSku::getPrice, TzSku::getGuidingPrice)
|
||||||
.leftJoin(TzProd.class, TzProd::getProdId, HyOrderItem::getProdId)
|
.leftJoin(TzProd.class, TzProd::getProdId, HyOrderItem::getProdId)
|
||||||
.leftJoin(TzSku.class, TzSku::getSkuId, HyOrderItem::getSkuId)
|
.leftJoin(TzSku.class, TzSku::getSkuId, HyOrderItem::getSkuId)
|
||||||
.eq(HyOrderItem::getId, orderId)
|
.eq(HyOrderItem::getId, orderId)
|
||||||
@@ -526,7 +526,7 @@ public class HyOrderItemServiceImpl extends MPJBaseServiceImpl<HyOrderItemMapper
|
|||||||
MPJLambdaWrapper<HyOrderItem> wrapper = new MPJLambdaWrapper<HyOrderItem>()
|
MPJLambdaWrapper<HyOrderItem> wrapper = new MPJLambdaWrapper<HyOrderItem>()
|
||||||
.selectAll(HyOrderItem.class)
|
.selectAll(HyOrderItem.class)
|
||||||
.select(TzProd::getProdName, TzProd::getPic,TzProd::getUnit)
|
.select(TzProd::getProdName, TzProd::getPic,TzProd::getUnit)
|
||||||
.select(TzSku::getSkuName)
|
.select(TzSku::getSkuName, TzSku::getGuidingPrice)
|
||||||
.leftJoin(TzProd.class, TzProd::getProdId, HyOrderItem::getProdId)
|
.leftJoin(TzProd.class, TzProd::getProdId, HyOrderItem::getProdId)
|
||||||
.leftJoin(TzSku.class, TzSku::getSkuId, HyOrderItem::getSkuId)
|
.leftJoin(TzSku.class, TzSku::getSkuId, HyOrderItem::getSkuId)
|
||||||
.eq(HyOrderItem::getOrderId, orderId)
|
.eq(HyOrderItem::getOrderId, orderId)
|
||||||
|
|||||||
@@ -121,20 +121,18 @@ public class TzCategoryServiceImpl implements ITzCategoryService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据父级ID查询子类信息
|
* 根据父级ID查询子类信息
|
||||||
* @param parentId
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<TzCategoryVo> listByParentId(Long parentId) {
|
public List<TzCategoryVo> listByParentId(Long parentId) {
|
||||||
return baseMapper.selectVoList(new LambdaQueryWrapper<TzCategory>().eq(TzCategory::getParentId, parentId).eq(TzCategory::getStatus,1).eq(TzCategory::getSubset,1));
|
return baseMapper.selectVoList(new LambdaQueryWrapper<TzCategory>().eq(TzCategory::getParentId, parentId).eq(TzCategory::getStatus,1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分类信息列表
|
* 分类信息列表
|
||||||
* @param ancestors
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<TzCategoryVo> listByAncestors(Long ancestors) {
|
public List<TzCategoryVo> listByAncestors(String ancestors) {
|
||||||
return baseMapper.selectVoList(new LambdaQueryWrapper<TzCategory>().like(TzCategory::getAncestors, ancestors).eq(TzCategory::getStatus,1).eq(TzCategory::getSubset,1));
|
return baseMapper.selectVoList(new LambdaQueryWrapper<TzCategory>().like(TzCategory::getAncestors, ancestors).eq(TzCategory::getStatus,1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package org.dromara.mall.service.impl;
|
package org.dromara.mall.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@@ -41,7 +42,6 @@ public class TzProdCommServiceImpl implements ITzProdCommService {
|
|||||||
private final HyOrderMapper orderMapper;
|
private final HyOrderMapper orderMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询商品评论
|
* 查询商品评论
|
||||||
*
|
*
|
||||||
@@ -50,7 +50,16 @@ public class TzProdCommServiceImpl implements ITzProdCommService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public TzProdCommVo queryById(Long id){
|
public TzProdCommVo queryById(Long id){
|
||||||
return baseMapper.selectVoById(id);
|
TzProdCommVo tzProdCommVo = baseMapper.selectVoById(id);
|
||||||
|
|
||||||
|
TzUser user = userMapper.selectById(tzProdCommVo.getUserId());
|
||||||
|
if(user != null) {
|
||||||
|
tzProdCommVo.setUserAvatar(user.getPic());
|
||||||
|
tzProdCommVo.setUserName(user.getRealName());
|
||||||
|
}
|
||||||
|
//设置浏览量+1
|
||||||
|
baseMapper.update(new LambdaUpdateWrapper<TzProdComm>().eq(TzProdComm::getId, id).setIncrBy(TzProdComm::getNum, 1));
|
||||||
|
return tzProdCommVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,6 +77,31 @@ public class TzProdCommServiceImpl implements ITzProdCommService {
|
|||||||
return TableDataInfo.build(result);
|
return TableDataInfo.build(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询商品评论列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery
|
||||||
|
* @return 商品评论列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IPage<TzProdCommVo> selectPageList(TzProdCommBo bo, PageQuery pageQuery) {
|
||||||
|
bo.setDelFlag(1);
|
||||||
|
bo.setStatus(1);
|
||||||
|
LambdaQueryWrapper<TzProdComm> lqw = buildQueryWrapper(bo);
|
||||||
|
IPage<TzProdCommVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
|
||||||
|
// 获取评论用户头像
|
||||||
|
for(TzProdCommVo vo : page.getRecords()) {
|
||||||
|
TzUser user = userMapper.selectById(vo.getUserId());
|
||||||
|
if(user != null) {
|
||||||
|
vo.setUserAvatar(user.getPic());
|
||||||
|
vo.setUserName(user.getRealName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询符合条件的商品评论列表
|
* 查询符合条件的商品评论列表
|
||||||
*
|
*
|
||||||
@@ -111,6 +145,7 @@ public class TzProdCommServiceImpl implements ITzProdCommService {
|
|||||||
Map<String, Object> params = bo.getParams();
|
Map<String, Object> params = bo.getParams();
|
||||||
LambdaQueryWrapper<TzProdComm> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<TzProdComm> lqw = Wrappers.lambdaQuery();
|
||||||
lqw.eq(bo.getProdId() != null, TzProdComm::getProdId, bo.getProdId());
|
lqw.eq(bo.getProdId() != null, TzProdComm::getProdId, bo.getProdId());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getProdName()), TzProdComm::getProdName, bo.getProdName());
|
||||||
lqw.eq(bo.getOrderId() != null, TzProdComm::getOrderId, bo.getOrderId());
|
lqw.eq(bo.getOrderId() != null, TzProdComm::getOrderId, bo.getOrderId());
|
||||||
lqw.eq(bo.getOrderItemId() != null, TzProdComm::getOrderItemId, bo.getOrderItemId());
|
lqw.eq(bo.getOrderItemId() != null, TzProdComm::getOrderItemId, bo.getOrderItemId());
|
||||||
lqw.eq(bo.getUserId() != null, TzProdComm::getUserId, bo.getUserId());
|
lqw.eq(bo.getUserId() != null, TzProdComm::getUserId, bo.getUserId());
|
||||||
@@ -121,7 +156,13 @@ public class TzProdCommServiceImpl implements ITzProdCommService {
|
|||||||
lqw.eq(bo.getIsAnonymous() != null, TzProdComm::getIsAnonymous, bo.getIsAnonymous());
|
lqw.eq(bo.getIsAnonymous() != null, TzProdComm::getIsAnonymous, bo.getIsAnonymous());
|
||||||
lqw.eq(bo.getStatus() != null, TzProdComm::getStatus, bo.getStatus());
|
lqw.eq(bo.getStatus() != null, TzProdComm::getStatus, bo.getStatus());
|
||||||
lqw.eq(bo.getDelFlag() != null, TzProdComm::getDelFlag, bo.getDelFlag());
|
lqw.eq(bo.getDelFlag() != null, TzProdComm::getDelFlag, bo.getDelFlag());
|
||||||
lqw.orderByDesc(TzProdComm::getId);
|
if(bo.getSort() != null){
|
||||||
|
if(bo.getSort() == 1){
|
||||||
|
lqw.orderByDesc(TzProdComm::getCreateTime);
|
||||||
|
}else if (bo.getSort() == 2){
|
||||||
|
lqw.orderByDesc(TzProdComm::getNum);
|
||||||
|
}
|
||||||
|
}
|
||||||
return lqw;
|
return lqw;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,6 +186,9 @@ public class TzProdCommServiceImpl implements ITzProdCommService {
|
|||||||
order.setStatus(5);
|
order.setStatus(5);
|
||||||
orderMapper.updateById(order);
|
orderMapper.updateById(order);
|
||||||
}
|
}
|
||||||
|
// 根据商品ID查询商品信息
|
||||||
|
TzProd prod = prodMapper.selectById(bo.getProdId());
|
||||||
|
bo.setProdName(prod.getProdName());
|
||||||
TzProdComm add = MapstructUtils.convert(bo, TzProdComm.class);
|
TzProdComm add = MapstructUtils.convert(bo, TzProdComm.class);
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
@@ -189,14 +233,13 @@ public class TzProdCommServiceImpl implements ITzProdCommService {
|
|||||||
IPage<TzProdCommVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
IPage<TzProdCommVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
|
||||||
// 获取评论列表中的商品信息
|
// 获取评论列表中的商品信息
|
||||||
page.getRecords().forEach(comment -> {
|
/*page.getRecords().forEach(comment -> {
|
||||||
// 根据商品ID查询商品信息
|
// 根据商品ID查询商品信息
|
||||||
TzProd prod = prodMapper.selectById(comment.getProdId());
|
TzProd prod = prodMapper.selectById(comment.getProdId());
|
||||||
if (prod != null) {
|
if (prod != null) {
|
||||||
comment.setProdName(prod.getProdName());
|
comment.setProdName(prod.getProdName());
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
|
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,7 +182,21 @@ public class TzProdServiceImpl extends MPJBaseServiceImpl<TzProdMapper,TzProd> i
|
|||||||
lqw.like(StringUtils.isNotBlank(bo.getFactoryAddress()), TzProd::getFactoryAddress, bo.getFactoryAddress());
|
lqw.like(StringUtils.isNotBlank(bo.getFactoryAddress()), TzProd::getFactoryAddress, bo.getFactoryAddress());
|
||||||
lqw.eq(bo.getStatus() != null, TzProd::getStatus, bo.getStatus());
|
lqw.eq(bo.getStatus() != null, TzProd::getStatus, bo.getStatus());
|
||||||
lqw.eq(bo.getExamineFlag() != null, TzProd::getExamineFlag, bo.getExamineFlag());
|
lqw.eq(bo.getExamineFlag() != null, TzProd::getExamineFlag, bo.getExamineFlag());
|
||||||
// lqw.like(bo.getCategoryId() != null, TzProd::getCategoryId, bo.getCategoryId());
|
|
||||||
|
if(bo.getEnvLevel() != null){
|
||||||
|
/*//根据逗号分割解析该字符串
|
||||||
|
String[] split = bo.getEnvLevel().split(",");
|
||||||
|
for (String s : split) {
|
||||||
|
lqw.or().like(TzProd::getEnvLevel, s);
|
||||||
|
}*/
|
||||||
|
lqw.in(TzProd::getEnvLevel, bo.getEnvLevel());
|
||||||
|
}
|
||||||
|
if(bo.getFireLevel() != null){
|
||||||
|
lqw.in(TzProd::getFireLevel, bo.getFireLevel());
|
||||||
|
}
|
||||||
|
if(bo.getTrialScenario() != null){
|
||||||
|
lqw.in(TzProd::getTrialScenario, bo.getTrialScenario());
|
||||||
|
}
|
||||||
if(bo.getCategoryId() != null){
|
if(bo.getCategoryId() != null){
|
||||||
lqw.or().apply("FIND_IN_SET({0}, t.category_id)", bo.getCategoryId());
|
lqw.or().apply("FIND_IN_SET({0}, t.category_id)", bo.getCategoryId());
|
||||||
}
|
}
|
||||||
@@ -439,9 +453,9 @@ public class TzProdServiceImpl extends MPJBaseServiceImpl<TzProdMapper,TzProd> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<TzProdVo> getSearchProdPageByProdName(PageQuery pageQuery, Long categoryId, String prodName, Integer floor, Integer sort, Integer orderBy) {
|
public IPage<TzProdVo> getSearchProdPageByProdName(PageQuery pageQuery, Long categoryId, String prodName, String envLevel, String fireLevel, String trialScenario, Integer floor, Integer sort, Integer orderBy) {
|
||||||
IPage<TzProdBo> page = new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize());
|
IPage<TzProdBo> page = new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize());
|
||||||
return baseMapper.getSearchProdPageByProdName(page, categoryId, prodName, floor, sort, orderBy);
|
return baseMapper.getSearchProdPageByProdName(page, categoryId, prodName, envLevel, fireLevel, trialScenario, floor, sort, orderBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -75,6 +75,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
or
|
or
|
||||||
p.prod_code like concat('%',#{prodName} ,'%')
|
p.prod_code like concat('%',#{prodName} ,'%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="envLevel != null and envLevel != ''">
|
||||||
|
and FIND_IN_SET(p.env_level, #{envLevel}) > 0
|
||||||
|
</if>
|
||||||
|
<if test="fireLevel != null and fireLevel != ''">
|
||||||
|
and FIND_IN_SET(p.fire_level, #{fireLevel}) > 0
|
||||||
|
</if>
|
||||||
|
<if test="trialScenario != null and trialScenario != ''">
|
||||||
|
and FIND_IN_SET(p.trial_scenario, #{trialScenario}) > 0
|
||||||
|
</if>
|
||||||
|
|
||||||
<if test="sort == 0">
|
<if test="sort == 0">
|
||||||
ORDER BY RAND()
|
ORDER BY RAND()
|
||||||
|
|||||||
Reference in New Issue
Block a user