耗材列表 关联 商品
This commit is contained in:
parent
0f7502df06
commit
312c9cc1be
|
|
@ -25,6 +25,8 @@ import javax.validation.constraints.*;
|
|||
import java.sql.Timestamp;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
|
|
@ -108,7 +110,7 @@ public class TbConsInfo implements Serializable {
|
|||
private String isCheck;
|
||||
|
||||
@Transient
|
||||
private String product;
|
||||
private List<Map<Integer, Object>> product;
|
||||
|
||||
public void copy(TbConsInfo source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
|
|
@ -26,11 +27,11 @@ public interface TbConsInfoRepository extends JpaRepository<TbConsInfo, Integer>
|
|||
|
||||
|
||||
@Query(value =
|
||||
"SELECT CONCAT(pro.id, '_', pro.NAME) AS product" +
|
||||
"SELECT pro.id, pro.name" +
|
||||
" FROM" +
|
||||
" tb_prosku_con conPro" +
|
||||
" LEFT JOIN tb_product pro ON conPro.product_id = pro.id AND pro.shop_id = :shopId AND conPro.shop_id = :shopId" +
|
||||
" where conPro.con_info_id = :conInfoId " +
|
||||
" group by conPro.product_id ",nativeQuery = true)
|
||||
List<String> queryAllAndPro(@Param("shopId") Integer shopId,@Param("conInfoId")Integer conInfoId);
|
||||
List<Map<Integer, Object>> queryAllAndPro(@Param("shopId") Integer shopId, @Param("conInfoId")Integer conInfoId);
|
||||
}
|
||||
|
|
@ -22,6 +22,8 @@ import javax.persistence.Column;
|
|||
import java.sql.Timestamp;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
|
|
@ -81,5 +83,5 @@ public class TbConsInfoDto implements Serializable {
|
|||
|
||||
private String isCheck;
|
||||
|
||||
private String product;
|
||||
private List<Map<Integer, Object>> product;
|
||||
}
|
||||
|
|
@ -102,8 +102,8 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
|
|||
Page<TbConsInfo> page = tbConsInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
||||
Page<TbConsInfoDto> result = page.map(tbConsInfoMapper::toDto);
|
||||
result.getContent().forEach(it -> {
|
||||
List<String> list = tbConsInfoRepository.queryAllAndPro(criteria.getShopId(), it.getId());
|
||||
it.setProduct(String.join(",", list));
|
||||
List<Map<Integer, Object>> list = tbConsInfoRepository.queryAllAndPro(criteria.getShopId(), it.getId());
|
||||
it.setProduct(list);
|
||||
});
|
||||
return PageUtil.toPage(result);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue