Commit cc3e8841 authored by shiyu's avatar shiyu

用户商品关联表删除,直接用商品表记录用户id11

parent 74889956
...@@ -117,4 +117,10 @@ public class CoinRequestDto extends BaseRequestDto implements Entity { ...@@ -117,4 +117,10 @@ public class CoinRequestDto extends BaseRequestDto implements Entity {
* 成交时间 * 成交时间
*/ */
private String bidTime; private String bidTime;
/**
* 上传商品的用户id
*/
private Long userId;
} }
...@@ -50,6 +50,7 @@ public class ItemDaoImpl implements ItemDao { ...@@ -50,6 +50,7 @@ public class ItemDaoImpl implements ItemDao {
ItemExample.Criteria criteria = example.createCriteria(); ItemExample.Criteria criteria = example.createCriteria();
JdbcHelper.ifPresent(coinRequestDto.getId(), criteria :: andIdEqualTo); JdbcHelper.ifPresent(coinRequestDto.getId(), criteria :: andIdEqualTo);
JdbcHelper.ifPresent(coinRequestDto.getIds(), criteria::andIdIn); JdbcHelper.ifPresent(coinRequestDto.getIds(), criteria::andIdIn);
JdbcHelper.ifPresent(coinRequestDto.getUserId(), criteria::andUserIdEqualTo);
JdbcHelper.ifPresent(coinRequestDto.getCid(), criteria :: andCidEqualTo); JdbcHelper.ifPresent(coinRequestDto.getCid(), criteria :: andCidEqualTo);
if (StringUtils.hasLength(coinRequestDto.getName())) { if (StringUtils.hasLength(coinRequestDto.getName())) {
criteria.andNameLike("%" + coinRequestDto.getName() + "%"); criteria.andNameLike("%" + coinRequestDto.getName() + "%");
......
...@@ -80,15 +80,12 @@ public class ConsignSaleServiceImpl implements ConsignSaleService { ...@@ -80,15 +80,12 @@ public class ConsignSaleServiceImpl implements ConsignSaleService {
if (StringUtils.hasLength(dto.getSearchParam())) { if (StringUtils.hasLength(dto.getSearchParam())) {
//判断查询条件是否为中文,是的话就根据商品名称模糊查询 //判断查询条件是否为中文,是的话就根据商品名称模糊查询
if (RegexUtil.isContainChinese(dto.getSearchParam())) { if (RegexUtil.isContainChinese(dto.getSearchParam())) {
//先查询该用户发布的商品id
List<UserItemsRelation> userItemsRelations = itemDao.listByUserIds(dto.getUserId(), null);
List<Long> itemIds = userItemsRelations.stream().map(UserItemsRelation::getItemId).collect(Collectors.toList());
CoinRequestDto coinRequestDto = new CoinRequestDto(); CoinRequestDto coinRequestDto = new CoinRequestDto();
coinRequestDto.setIds(itemIds); coinRequestDto.setUserId(dto.getUserId());
coinRequestDto.setName(dto.getSearchParam()); coinRequestDto.setName(dto.getSearchParam());
List<Item> items = itemDao.findList(coinRequestDto); List<Item> items = itemDao.findList(coinRequestDto);
if (!CollectionUtils.isEmpty(items)) { List<Long> itemIds = items.stream().map(Item::getId).collect(Collectors.toList());
itemIds = items.stream().map(Item::getId).collect(Collectors.toList()); if (!CollectionUtils.isEmpty(itemIds)) {
dto.setItemIds(itemIds); dto.setItemIds(itemIds);
} }
} else { } else {
...@@ -115,7 +112,7 @@ public class ConsignSaleServiceImpl implements ConsignSaleService { ...@@ -115,7 +112,7 @@ public class ConsignSaleServiceImpl implements ConsignSaleService {
PageSearchResult pageSearchResult = PageSearchResult.of(pageInfo, consignSaleVos); PageSearchResult pageSearchResult = PageSearchResult.of(pageInfo, consignSaleVos);
return Result.success(pageSearchResult); return Result.success(pageSearchResult);
} catch (Exception e) { } catch (Exception e) {
logger.error("查询接收单列表error : {}", e); logger.error("查询寄售单列表error : {}", e);
} }
return Result.failed(); return Result.failed();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment