Compare commits

...

5 Commits

Author SHA1 Message Date
清晨
3f7707f1db feat(mall): 添加商品评论列表功能并优化订单项
- 新增商品评论列表接口和相关服务方法
- 在订单项中添加指导价字段
- 优化商品评论查询条件和排序功能
- 增加评论用户头像和用户名信息
- 更新相关实体类和VO类以支持新功能
2025-05-16 10:50:23 +08:00
清晨
b5ce9d4a3d feat(mall): 商品搜索接口增加筛选条件
- 在商品搜索接口中添加环保等级、防火等级、试用场景等筛选条件
- 更新相关服务和 mapper 方法,支持新增的筛选条件
- 修改 SQL 查询语句,增加相应的 WHERE条件
2025-05-15 09:05:39 +08:00
清晨
5452cdced6 feat(mall): 添加商品环保等级、防火等级和试用场景属性
- 在 TzProd 和 TzProdBo 模型中添加环保等级、防火等级和试用场景字段
- 在 HyBasketVo 中添加指导价字段
- 更新 TzProdController 和 TzProdServiceImpl 以支持新属性的查询
2025-05-14 10:19:58 +08:00
清晨
1640ba4b7d refactor(mall): 优化分类查询接口参数类型和逻辑
- 将 ApiProdController 中 categoryByAncestors 方法的参数类型从 Long 改为 String
- 修改 ITzCategoryService 接口中 listByAncestors 方法的参数类型从 Long 改为 String- 更新 TzCategoryServiceImpl 中 listByAncestors 方法,移除对 subset 字段的查询条件- 优化 listByParentId 方法,移除对 subset 字段的查询条件
2025-05-12 17:48:26 +08:00
清晨
d57fc6f4ad refactor(mall): 移除未使用的函数参数
- 在 TzCategoryServiceImpl 类中移除了 listByParentId 和 listByAncestors 方法的多余参数注释- 这些参数在方法实现中并未使用,移除它们可以提高代码的可读性和维护性
2025-05-12 16:15:58 +08:00
21 changed files with 230 additions and 27 deletions

View File

@@ -8,6 +8,7 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.validate.QueryGroup;
import org.dromara.common.mybatis.core.page.PageQuery;
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.vo.*;
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.ServerResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
@@ -44,6 +48,8 @@ public class ApiIndexController {
private final ITzNoticeService tzNoticeService;
private final ISysDictTypeService dictTypeService;
@GetMapping("/indexImgs")
@Operation(summary = "首页轮播图" , description = "获取首页轮播图列表信息")
public ServerResponseEntity<List<TzIndexImgVo>> indexImgs() {
@@ -102,4 +108,18 @@ public class ApiIndexController {
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);
}
}

View File

@@ -225,15 +225,33 @@ public class ApiProdController {
@GetMapping("/categoryByAncestors")
@Operation(summary = "根据祖级ID获取分类信息列表", description = "获取所有的产品分类信息顶级分类的ancestors为0,默认为顶级分类")
@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);
return ServerResponseEntity.success(categories);
}
@PostMapping("/searchProdPage")
@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时必传")})
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) {
@Parameters({
@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();
//用户个人搜索关键词叠加
if (ObjectUtil.isNotEmpty(userId)) {
@@ -241,7 +259,14 @@ public class ApiProdController {
}
//热搜关键词次数叠加
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")

View File

@@ -22,7 +22,6 @@ import org.dromara.mall.domain.bo.TzSkuBo;
import org.dromara.mall.domain.vo.TzProdSumVo;
import org.dromara.mall.domain.vo.TzProdVo;
import org.dromara.mall.service.ITzProdService;
import org.dromara.mall.service.ITzSkuService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -42,8 +41,6 @@ public class TzProdController extends BaseController {
private final ITzProdService tzProdService;
private final ITzSkuService tzSkuService;
/**
* 查询商品列表
*/

View File

@@ -212,4 +212,19 @@ public class TzProd extends TenantEntity {
*/
private String remark;
/**
* 环保等级
*/
private String envLevel;
/**
* 防火等级
*/
private String fireLevel;
/**
* 试用场景
*/
private String trialScenario;
}

View File

@@ -33,6 +33,11 @@ public class TzProdComm extends TenantEntity {
*/
private Long prodId;
/**
* 商品名称
*/
private String prodName;
/**
* 订单 ID
*/
@@ -83,5 +88,10 @@ public class TzProdComm extends TenantEntity {
*/
private Long delFlag;
/**
* 浏览量
*/
private Long num;
}

View File

@@ -217,4 +217,19 @@ public class TzProdBo extends TenantEntity {
*/
private String remark;
/**
* 环保等级(查询多值时逗号隔开)
*/
private String envLevel;
/**
* 防火等级(查询多值时逗号隔开)
*/
private String fireLevel;
/**
* 试用场景(查询多值时逗号隔开)
*/
private String trialScenario;
}

View File

@@ -32,6 +32,11 @@ public class TzProdCommBo extends BaseEntity {
@NotNull(message = "商品ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long prodId;
/**
* 商品名称
*/
private String prodName;
/**
* 订单 ID
*/
@@ -82,5 +87,15 @@ public class TzProdCommBo extends BaseEntity {
*/
private Integer delFlag;
/**
* 浏览量
*/
private Long num;
/**
* 排序 1-最新2-最热
*/
private Integer sort;
}

View File

@@ -104,6 +104,12 @@ public class HyBasketVo implements Serializable {
@ExcelProperty(value = "SKU图片")
private String pic;
/**
* 指导价
*/
@ExcelProperty(value = "指导价")
private BigDecimal guidingPrice;
/**
* SKU成本价格
*/

View File

@@ -153,6 +153,12 @@ public class HyOrderItemVo implements Serializable {
@ExcelProperty(value = "付款金额")
private BigDecimal payPrice;
/**
* 指导价
*/
@ExcelProperty(value = "指导价")
private BigDecimal guidingPrice;
/**
* 支付状态 1:待支付 2:未付清 3:已付清
*/

View File

@@ -109,5 +109,11 @@ public class TzProdCommVo implements Serializable {
@ExcelProperty(value = "评论时间")
private Date createTime;
/**
* 浏览量
*/
@ExcelProperty(value = "浏览量")
private Long num;
}

View File

@@ -289,5 +289,20 @@ public class TzProdVo implements Serializable {
@ExcelProperty(value = "备注")
private String remark;
/**
* 环保等级
*/
private String envLevel;
/**
* 防火等级
*/
private String fireLevel;
/**
* 试用场景
*/
private String trialScenario;
}

View File

@@ -60,7 +60,7 @@ public interface TzProdMapper extends BaseMapperPlus<TzProd, TzProdVo>, MPJBaseM
* @param orderBy
* @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);
/**

View File

@@ -74,5 +74,5 @@ public interface ITzCategoryService {
* @param ancestors
* @return
*/
List<TzCategoryVo> listByAncestors(Long ancestors);
List<TzCategoryVo> listByAncestors(String ancestors);
}

View File

@@ -91,4 +91,12 @@ public interface ITzProdCommService {
* @return 商品评论分页列表
*/
IPage<TzProdCommVo> queryPageListByUser(TzProdCommBo bo, PageQuery pageQuery);
/**
* 查询商品评论列表
*
* @param bo 查询条件
* @return 商品评论列表
*/
IPage<TzProdCommVo> selectPageList(TzProdCommBo bo, PageQuery pageQuery);
}

View File

@@ -108,7 +108,7 @@ public interface ITzProdService extends MPJBaseService<TzProd> {
* @param orderBy
* @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);
/**
* 商品收藏

View File

@@ -85,6 +85,7 @@ public class HyBasketServiceImpl extends MPJBaseServiceImpl<HyBasketMapper,HyBas
.selectAll(HyBasket.class)
.select(TzProd::getProdCode, TzProd::getProdName, TzProd::getPic, TzProd::getUnit)
.select(TzSku::getSkuCode, TzSku::getSkuFactoryCode, TzSku::getSkuName)
.selectAs(TzProd::getGuidingPrice, HyBasketVo::getGuidingPrice)
.selectAs(TzSku::getPrice, HyBasketVo::getOriPrice)
.leftJoin(TzProd.class, TzProd::getProdId, HyBasket::getProdId)
.leftJoin(TzSku.class, TzSku::getSkuId, HyBasket::getSkuId)

View File

@@ -147,7 +147,7 @@ public class HyOrderItemServiceImpl extends MPJBaseServiceImpl<HyOrderItemMapper
MPJLambdaWrapper<HyOrderItem> wrapper = buildQueryWrapper(bo)
.selectAll(HyOrderItem.class)
.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(TzSku.class, TzSku::getSkuId, HyOrderItem::getSkuId)
.orderByDesc(HyOrderItem::getCreateTime);
@@ -382,7 +382,7 @@ public class HyOrderItemServiceImpl extends MPJBaseServiceImpl<HyOrderItemMapper
MPJLambdaWrapper<HyOrderItem> wrapper = new MPJLambdaWrapper<HyOrderItem>()
.selectAll(HyOrderItem.class)
.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(TzSku.class, TzSku::getSkuId, HyOrderItem::getSkuId)
.eq(HyOrderItem::getId, orderId)
@@ -526,7 +526,7 @@ public class HyOrderItemServiceImpl extends MPJBaseServiceImpl<HyOrderItemMapper
MPJLambdaWrapper<HyOrderItem> wrapper = new MPJLambdaWrapper<HyOrderItem>()
.selectAll(HyOrderItem.class)
.select(TzProd::getProdName, TzProd::getPic,TzProd::getUnit)
.select(TzSku::getSkuName)
.select(TzSku::getSkuName, TzSku::getGuidingPrice)
.leftJoin(TzProd.class, TzProd::getProdId, HyOrderItem::getProdId)
.leftJoin(TzSku.class, TzSku::getSkuId, HyOrderItem::getSkuId)
.eq(HyOrderItem::getOrderId, orderId)

View File

@@ -121,20 +121,18 @@ public class TzCategoryServiceImpl implements ITzCategoryService {
/**
* 根据父级ID查询子类信息
* @param parentId
*/
@Override
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
public List<TzCategoryVo> listByAncestors(Long ancestors) {
return baseMapper.selectVoList(new LambdaQueryWrapper<TzCategory>().like(TzCategory::getAncestors, ancestors).eq(TzCategory::getStatus,1).eq(TzCategory::getSubset,1));
public List<TzCategoryVo> listByAncestors(String ancestors) {
return baseMapper.selectVoList(new LambdaQueryWrapper<TzCategory>().like(TzCategory::getAncestors, ancestors).eq(TzCategory::getStatus,1));
}
/**

View File

@@ -1,6 +1,7 @@
package org.dromara.mall.service.impl;
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.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -41,7 +42,6 @@ public class TzProdCommServiceImpl implements ITzProdCommService {
private final HyOrderMapper orderMapper;
/**
* 查询商品评论
*
@@ -50,7 +50,16 @@ public class TzProdCommServiceImpl implements ITzProdCommService {
*/
@Override
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);
}
/**
* 查询商品评论列表
*
* @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();
LambdaQueryWrapper<TzProdComm> lqw = Wrappers.lambdaQuery();
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.getOrderItemId() != null, TzProdComm::getOrderItemId, bo.getOrderItemId());
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.getStatus() != null, TzProdComm::getStatus, bo.getStatus());
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;
}
@@ -145,6 +186,9 @@ public class TzProdCommServiceImpl implements ITzProdCommService {
order.setStatus(5);
orderMapper.updateById(order);
}
// 根据商品ID查询商品信息
TzProd prod = prodMapper.selectById(bo.getProdId());
bo.setProdName(prod.getProdName());
TzProdComm add = MapstructUtils.convert(bo, TzProdComm.class);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
@@ -189,14 +233,13 @@ public class TzProdCommServiceImpl implements ITzProdCommService {
IPage<TzProdCommVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw);
// 获取评论列表中的商品信息
page.getRecords().forEach(comment -> {
/*page.getRecords().forEach(comment -> {
// 根据商品ID查询商品信息
TzProd prod = prodMapper.selectById(comment.getProdId());
if (prod != null) {
comment.setProdName(prod.getProdName());
}
});
});*/
return page;
}
}

View File

@@ -182,7 +182,21 @@ public class TzProdServiceImpl extends MPJBaseServiceImpl<TzProdMapper,TzProd> i
lqw.like(StringUtils.isNotBlank(bo.getFactoryAddress()), TzProd::getFactoryAddress, bo.getFactoryAddress());
lqw.eq(bo.getStatus() != null, TzProd::getStatus, bo.getStatus());
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){
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
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());
return baseMapper.getSearchProdPageByProdName(page, categoryId, prodName, floor, sort, orderBy);
return baseMapper.getSearchProdPageByProdName(page, categoryId, prodName, envLevel, fireLevel, trialScenario, floor, sort, orderBy);
}
/**

View File

@@ -75,6 +75,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
or
p.prod_code like concat('%',#{prodName} ,'%')
</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">
ORDER BY RAND()