|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | this.dealCateAttr(category.getAttrFirstList(),Constants.ZERO,category.getId(),user); | 
|---|
|  |  |  | this.dealCateAttr(category.getAttrSecondList(),Constants.ONE,category.getId(),user); | 
|---|
|  |  |  | //        this.dealCateAttr(category.getAttrFirstList(),Constants.ZERO,category.getId(),user); | 
|---|
|  |  |  | //        this.dealCateAttr(category.getAttrSecondList(),Constants.ONE,category.getId(),user); | 
|---|
|  |  |  | //        cateAttrMapper.delete(new QueryWrapper<CateAttr>().eq("CATEGORY_ID",category.getId())); | 
|---|
|  |  |  | //        List<CateAttr>  attrFirst = category.getAttrFirstList(); | 
|---|
|  |  |  | //        if(!Objects.isNull(attrFirst)&&attrFirst.size()> Constants.ZERO){ | 
|---|
|  |  |  | 
|---|
|  |  |  | category.setShortPinyin(PinYinUtil.getFirstSpell(category.getName())); | 
|---|
|  |  |  | categoryMapper.updateById(category); | 
|---|
|  |  |  | //处理属性配置 | 
|---|
|  |  |  | cateParamMapper.delete(new QueryWrapper<CateParam>().eq("CATEGORY_ID",category.getId())); | 
|---|
|  |  |  | List<CateParam> paramList = category.getParamList(); | 
|---|
|  |  |  | if(!Objects.isNull(paramList)&¶mList.size()> Constants.ZERO){ | 
|---|
|  |  |  | for (int i = 0; i < paramList.size(); i++) { | 
|---|
|  |  |  | CateParam cateParam = paramList.get(i); | 
|---|
|  |  |  | cateParam.setCreator(user.getId()); | 
|---|
|  |  |  | cateParam.setCreateDate(new Date()); | 
|---|
|  |  |  | cateParam.setIsdeleted(Constants.ZERO); | 
|---|
|  |  |  | cateParam.setSortnum(i+Constants.ONE); | 
|---|
|  |  |  | cateParam.setStatus(Constants.ZERO); | 
|---|
|  |  |  | cateParam.setCategoryId(category.getId()); | 
|---|
|  |  |  | cateParamMapper.insert(cateParam); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.dealCateParam(category.getParamList(),category.getId(),user); | 
|---|
|  |  |  | cateBudgetMapper.delete(new QueryWrapper<CateBudget>().eq("CATEGORY_ID",category.getId())); | 
|---|
|  |  |  | List<CateBudget>  budgetList = category.getBudgetList(); | 
|---|
|  |  |  | if(!Objects.isNull(budgetList)&&budgetList.size()> Constants.ZERO){ | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void dealCateAttr(List<CateAttr> cateAttrList,Integer type,Integer categoryId,LoginUserInfo user){ | 
|---|
|  |  |  | List<CateAttr> oldCateAttrList = cateAttrMapper.selectList(new QueryWrapper<CateAttr>().eq("ISDELETED",Constants.ZERO).eq("CATEGORY_ID",categoryId).eq("TYPE",type)); | 
|---|
|  |  |  | List<CateAttr> addCateAttr = new ArrayList<>(); | 
|---|
|  |  |  | List<CateAttr> updCateAttr = new ArrayList<>(); | 
|---|
|  |  |  | List<CateAttr> delCateAttr = new ArrayList<>(); | 
|---|
|  |  |  | for (CateAttr oldCateAttr:oldCateAttrList) { | 
|---|
|  |  |  | public void dealCateParam(List<CateParam> cateParamList,Integer categoryId,LoginUserInfo userInfo ){ | 
|---|
|  |  |  | List<CateParam> oldCateParamList = cateParamMapper.selectList(new QueryWrapper<CateParam>() | 
|---|
|  |  |  | .eq("ISDELETED",Constants.ZERO).eq("CATEGORY_ID",categoryId)); | 
|---|
|  |  |  | List<CateParam> updCateParam = new ArrayList<>(); | 
|---|
|  |  |  | List<CateParam> delCateParam = new ArrayList<>(); | 
|---|
|  |  |  | for (CateParam oldCateParam:oldCateParamList) { | 
|---|
|  |  |  | Boolean flag = false; | 
|---|
|  |  |  | for (CateAttr cateAttr:cateAttrList) { | 
|---|
|  |  |  | if(oldCateAttr.getName().equals(cateAttr.getName())){ | 
|---|
|  |  |  | updCateAttr.add(oldCateAttr); | 
|---|
|  |  |  | for (CateParam cateParam:cateParamList) { | 
|---|
|  |  |  | if(oldCateParam.getId().equals(cateParam.getId())){ | 
|---|
|  |  |  | updCateParam.add(cateParam); | 
|---|
|  |  |  | flag = true; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(!flag){ | 
|---|
|  |  |  | delCateAttr.add(oldCateAttr); | 
|---|
|  |  |  | delCateParam.add(oldCateParam); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | CateAttr maxCateAttr = cateAttrMapper.selectOne(new QueryWrapper<CateAttr>().eq("ISDELETED",Constants.ZERO).eq("CATEGORY_ID",categoryId).eq("TYPE",type).orderByDesc(" SORTNUM ").last(" limit 1  ")); | 
|---|
|  |  |  | CateParam maxCateParam = cateParamMapper.selectOne(new QueryWrapper<CateParam>().eq("ISDELETED",Constants.ZERO) | 
|---|
|  |  |  | .eq("CATEGORY_ID",categoryId).orderByDesc(" SORTNUM ").last(" limit 1  ")); | 
|---|
|  |  |  | Integer nextSortNum = 0; | 
|---|
|  |  |  | if(!Objects.isNull(maxCateAttr)){ | 
|---|
|  |  |  | nextSortNum = maxCateAttr.getSortnum(); | 
|---|
|  |  |  | if(!Objects.isNull(maxCateParam)){ | 
|---|
|  |  |  | nextSortNum = maxCateParam.getSortnum(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //处理新增数据 | 
|---|
|  |  |  | for (CateAttr cateAttr:cateAttrList) { | 
|---|
|  |  |  | Boolean flag = false; | 
|---|
|  |  |  | for (CateAttr oldCateAttr:oldCateAttrList) { | 
|---|
|  |  |  | if(cateAttr.getName().equals(oldCateAttr.getName())){ | 
|---|
|  |  |  | flag = true; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(!flag){ | 
|---|
|  |  |  | nextSortNum = nextSortNum + 1; | 
|---|
|  |  |  | cateAttr.setCreator(user.getId()); | 
|---|
|  |  |  | cateAttr.setCreateDate(new Date()); | 
|---|
|  |  |  | cateAttr.setIsdeleted(Constants.ZERO); | 
|---|
|  |  |  | cateAttr.setSortnum(nextSortNum); | 
|---|
|  |  |  | cateAttr.setStatus(Constants.ZERO); | 
|---|
|  |  |  | cateAttr.setCategoryId(categoryId); | 
|---|
|  |  |  | cateAttr.setType(type); | 
|---|
|  |  |  | addCateAttr.add(cateAttr); | 
|---|
|  |  |  | for (CateParam cateParam:cateParamList) { | 
|---|
|  |  |  | if(Objects.isNull(cateParam.getId())){ | 
|---|
|  |  |  | nextSortNum ++ ; | 
|---|
|  |  |  | cateParam.setCreator(userInfo.getId()); | 
|---|
|  |  |  | cateParam.setCreateDate(new Date()); | 
|---|
|  |  |  | cateParam.setIsdeleted(Constants.ZERO); | 
|---|
|  |  |  | cateParam.setSortnum(nextSortNum); | 
|---|
|  |  |  | cateParam.setStatus(Constants.ZERO); | 
|---|
|  |  |  | cateParam.setCategoryId(categoryId); | 
|---|
|  |  |  | cateParamMapper.insert(cateParam); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | addCateAttr.forEach(i->{ | 
|---|
|  |  |  | cateAttrMapper.insert(i); | 
|---|
|  |  |  | delCateParam.forEach(i->{ | 
|---|
|  |  |  | cateParamMapper.deleteById(i.getId()); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | delCateAttr.forEach(i->{ | 
|---|
|  |  |  | i.setIsdeleted(Constants.ONE); | 
|---|
|  |  |  | updCateParam.forEach(i->{ | 
|---|
|  |  |  | i.setEditDate(new Date()); | 
|---|
|  |  |  | i.setEditor(user.getId()); | 
|---|
|  |  |  | cateAttrMapper.updateById(i); | 
|---|
|  |  |  | i.setEditor(userInfo.getId()); | 
|---|
|  |  |  | cateParamMapper.updateById(i); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void updateDisableById(Category category) { | 
|---|
|  |  |  | 
|---|
|  |  |  | + systemDictDataBiz.queryByCode(Constants.OSS, Constants.CATEGORY_IMG).getCode(); | 
|---|
|  |  |  | for (Category c:list) { | 
|---|
|  |  |  | c.setPrefixUrl(prefixUrl); | 
|---|
|  |  |  | //            c.setAttrFirstList(cateAttrMapper.selectList(new QueryWrapper<CateAttr>().eq("TYPE",Constants.ZERO).eq("ISDELETED",Constants.ZERO).eq("CATEGORY_ID",c.getId()).orderByAsc(" SORTNUM "))); | 
|---|
|  |  |  | //            c.setAttrSecondList(cateAttrMapper.selectList(new QueryWrapper<CateAttr>().eq("TYPE",Constants.ONE).eq("ISDELETED",Constants.ZERO).eq("CATEGORY_ID",c.getId()).orderByAsc(" SORTNUM "))); | 
|---|
|  |  |  | c.setBudgetList(cateBudgetMapper.selectList(new QueryWrapper<CateBudget>().eq("CATEGORY_ID",c.getId()).orderByAsc(" SORTNUM "))); | 
|---|
|  |  |  | c.setBudgetList(cateBudgetMapper.selectList(new QueryWrapper<CateBudget>().eq("CATEGORY_ID",c.getId()) | 
|---|
|  |  |  | .orderByAsc(" SORTNUM "))); | 
|---|
|  |  |  | this.getParamSelect(c); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return list; | 
|---|
|  |  |  | 
|---|
|  |  |  | .eq("CATEGORY_ID",category.getId()) | 
|---|
|  |  |  | .eq("ISSELECT",Constants.ONE) | 
|---|
|  |  |  | .eq("ISDELETED",Constants.ZERO) | 
|---|
|  |  |  | .eq("ISSHOW",Constants.ONE) | 
|---|
|  |  |  | .orderByAsc(" SORTNUM ") | 
|---|
|  |  |  | .last(" limit 2 ") | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | 
|---|
|  |  |  | c.setAttrFirstList(cateAttrMapper.selectList(new QueryWrapper<CateAttr>().eq("TYPE",Constants.ZERO).eq("ISDELETED",Constants.ZERO).eq("CATEGORY_ID",c.getId()).orderByAsc(" SORTNUM "))); | 
|---|
|  |  |  | c.setAttrSecondList(cateAttrMapper.selectList(new QueryWrapper<CateAttr>().eq("TYPE",Constants.ONE).eq("ISDELETED",Constants.ZERO).eq("CATEGORY_ID",c.getId()).orderByAsc(" SORTNUM "))); | 
|---|
|  |  |  | c.setParamList(cateParamMapper.selectList(new QueryWrapper<CateParam>() | 
|---|
|  |  |  | .select(" * , ( select gp.VAL from goods_param gp where gp.GOODS_ID = "+goodsId+" and gp.PRAMA_ID = cate_param.id limit 1 )  as val ") | 
|---|
|  |  |  | .eq("CATEGORY_ID",c.getId()).orderByAsc(" SORTNUM "))); | 
|---|
|  |  |  | .select(" * , ( select gp.VAL from goods_param gp where gp.GOODS_ID = "+goodsId+" and gp.PRAMA_ID = cate_param.id limit 1 )  as val ") | 
|---|
|  |  |  | .eq("CATEGORY_ID",c.getId()) | 
|---|
|  |  |  | .eq("ISSHOW",Constants.ONE) | 
|---|
|  |  |  | .eq("STATUS",Constants.ZERO) | 
|---|
|  |  |  | .eq("ISDELETED",Constants.ZERO) | 
|---|
|  |  |  | .orderByAsc(" SORTNUM "))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return list; | 
|---|
|  |  |  | } | 
|---|