优化产品管理
This commit is contained in:
@@ -18,7 +18,8 @@ public interface BaseProductMapper extends BaseMapper<BaseProduct> {
|
||||
|
||||
IPage<BaseProductVo> selectPageVo(IPage<BaseProduct> page,@Param(Constants.WRAPPER) QueryWrapper<BaseProduct> qw);
|
||||
|
||||
List<BaseProductChildVo> selChildrenList(@Param("sid") String sid, @Param("cSid") String cSid);
|
||||
// List<BaseProductChildVo> selChildrenList(@Param("sid") String sid, @Param("cSid") String cSid);
|
||||
List<BaseProductChildVo> selChildrenList(@Param("sid") String sid);
|
||||
|
||||
int checkByGoodsSidAndUseOrgSid(@Param("goodsSid") String goodsSid, @Param("useOrgSid") String useOrgSid);
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
g.goodsCode AS productCode,
|
||||
p.rateType,
|
||||
m.rate,
|
||||
m.sid AS cSid
|
||||
m.sid AS cSid,
|
||||
(SELECT COUNT(*) FROM base_product_material as pm WHERE pm.productSid = p.sid) as num
|
||||
FROM
|
||||
base_product AS p
|
||||
LEFT JOIN base_product_material AS m ON p.sid = m.productSid
|
||||
@@ -43,7 +44,8 @@
|
||||
LEFT JOIN base_product_material AS m ON p.sid = m.productSid
|
||||
LEFT JOIN goods_spu AS g ON p.goodsSid = g.sid
|
||||
LEFT JOIN goods_spu AS mg ON m.materialSid = mg.sid
|
||||
WHERE p.sid = #{sid} and m.sid != #{cSid}
|
||||
WHERE p.sid = #{sid}
|
||||
-- and m.sid != #{cSid}
|
||||
|
||||
</select>
|
||||
<select id="checkByGoodsSidAndUseOrgSid" resultType="java.lang.Integer">
|
||||
|
||||
@@ -69,12 +69,21 @@ public class BaseProductService extends MybatisBaseService<BaseProductMapper, Ba
|
||||
List<BaseProductVo> records = pagging.getRecords();
|
||||
if (!records.isEmpty()) {
|
||||
for (BaseProductVo record : records) {
|
||||
String childSid = record.getCSid();
|
||||
String sid = record.getSid();
|
||||
List<BaseProductChildVo> children = baseMapper.selChildrenList(sid, childSid);
|
||||
if (!children.isEmpty()) {
|
||||
record.setChildren(children);
|
||||
String num = record.getNum();
|
||||
int i = Integer.parseInt(num);
|
||||
if (i > 1) {
|
||||
record.setProductCode("");
|
||||
record.setProductName("");
|
||||
record.setRate("");
|
||||
// String childSid = record.getCSid();
|
||||
String sid = record.getSid();
|
||||
// List<BaseProductChildVo> children = baseMapper.selChildrenList(sid, childSid);
|
||||
List<BaseProductChildVo> children = baseMapper.selChildrenList(sid);
|
||||
if (!children.isEmpty()) {
|
||||
record.setChildren(children);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
PagerVo<BaseProductVo> p = PagerUtil.pageToVo(pagging, null);
|
||||
|
||||
@@ -40,6 +40,7 @@ public class BaseProductVo implements Vo {
|
||||
private String rateType;
|
||||
private String sid;
|
||||
private String cSid;
|
||||
private String num;
|
||||
private List<BaseProductChildVo> children = new ArrayList<>();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user