|  |  |  | 
|---|
|  |  |  | import com.doumee.core.utils.Utils; | 
|---|
|  |  |  | import com.doumee.dao.business.CateAttrMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.CateParamMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.CateParamSelectMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.CategoryMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.model.*; | 
|---|
|  |  |  | import com.doumee.service.business.CategoryService; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemDictDataBiz systemDictDataBiz; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private CateParamSelectMapper cateParamSelectMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Integer create(Category category) { | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<Category> findList(Category category) { | 
|---|
|  |  |  | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); | 
|---|
|  |  |  | QueryWrapper<Category> wrapper = new QueryWrapper<>(category) | 
|---|
|  |  |  | .eq("STATUS",Constants.ZERO) | 
|---|
|  |  |  | .eq("ISDELETED",Constants.ZERO) | 
|---|
|  |  |  | .eq("COMPANY_ID",user.getCompanyId()) | 
|---|
|  |  |  | .orderByAsc(" SORTNUM "); | 
|---|
|  |  |  | List<Category> list = categoryMapper.selectList(wrapper); | 
|---|
|  |  |  | String prefixUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.FILE_DIR).getCode() | 
|---|
|  |  |  | + systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.PROJECTS).getCode(); | 
|---|
|  |  |  | //        String prefixUrl = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode() | 
|---|
|  |  |  | //                + 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 "))); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | return list; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<Category> findListSaaS(Category category) { | 
|---|
|  |  |  | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); | 
|---|
|  |  |  | if(!user.getType().equals(Constants.UserType.ZHUBO.getKey())){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"用户类别错误,非主播用户!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | QueryWrapper<Category> wrapper = new QueryWrapper<>(category) | 
|---|
|  |  |  | .eq("STATUS",Constants.ZERO) | 
|---|
|  |  |  | .eq("ISDELETED",Constants.ZERO) | 
|---|
|  |  |  | .eq("COMPANY_ID",user.getCompanyId()) | 
|---|
|  |  |  | .orderByAsc(" SORTNUM "); | 
|---|
|  |  |  | List<Category> list = categoryMapper.selectList(wrapper); | 
|---|
|  |  |  | String prefixUrl = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode() | 
|---|
|  |  |  | + 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.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 "))); | 
|---|
|  |  |  | this.getParamSelect(c); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return list; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void getParamSelect(Category category){ | 
|---|
|  |  |  | List<CateParam> cateParamList =  cateParamMapper.selectList(new QueryWrapper<CateParam>() | 
|---|
|  |  |  | .eq("CATEGORY_ID",category.getId()) | 
|---|
|  |  |  | .eq("ISSELECT",Constants.ONE) | 
|---|
|  |  |  | .eq("ISDELETED",Constants.ZERO) | 
|---|
|  |  |  | .orderByAsc(" SORTNUM ") | 
|---|
|  |  |  | .last(" limit 2 ") | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(!Objects.isNull(cateParamList)&&cateParamList.size()>Constants.ZERO){ | 
|---|
|  |  |  | for (int i = 0; i < cateParamList.size(); i++) { | 
|---|
|  |  |  | CateParam cateParam = cateParamList.get(i); | 
|---|
|  |  |  | List<CateParamSelect> cateParamSelectList = cateParamSelectMapper.selectList(new QueryWrapper<CateParamSelect>() | 
|---|
|  |  |  | .eq("PARAM_ID",cateParam.getId()) | 
|---|
|  |  |  | .eq("ISDELETED",Constants.ZERO)); | 
|---|
|  |  |  | if(i==0){ | 
|---|
|  |  |  | category.setAttrFirst(cateParam.getName()); | 
|---|
|  |  |  | category.setCateParamFirstList(cateParamSelectList); | 
|---|
|  |  |  | }else if(i==1){ | 
|---|
|  |  |  | category.setAttrSecond(cateParam.getName()); | 
|---|
|  |  |  | category.setCateParamSecondList(cateParamSelectList); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<Category> findListForGoods(Integer goodsId) { | 
|---|
|  |  |  | 
|---|
|  |  |  | .eq("ISDELETED",Constants.ZERO) | 
|---|
|  |  |  | .orderByAsc(" SORTNUM "); | 
|---|
|  |  |  | List<Category> list = categoryMapper.selectList(wrapper); | 
|---|
|  |  |  | String prefixUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.FILE_DIR).getCode() | 
|---|
|  |  |  | + systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.PROJECTS).getCode(); | 
|---|
|  |  |  | String prefixUrl = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode() | 
|---|
|  |  |  | + 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 "))); | 
|---|
|  |  |  | 
|---|
|  |  |  | .eq("ISDELETED",Constants.ZERO) | 
|---|
|  |  |  | .orderByAsc(" SORTNUM "); | 
|---|
|  |  |  | List<Category> list = categoryMapper.selectList(wrapper); | 
|---|
|  |  |  | String prefixUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.FILE_DIR).getCode() | 
|---|
|  |  |  | + systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.PROJECTS).getCode(); | 
|---|
|  |  |  | String prefixUrl = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode() | 
|---|
|  |  |  | + systemDictDataBiz.queryByCode(Constants.OSS, Constants.CATEGORY_IMG).getCode(); | 
|---|
|  |  |  | for (Category c:list) { | 
|---|
|  |  |  | c.setPrefixUrl(prefixUrl); | 
|---|
|  |  |  | c.setBudgetList(cateBudgetMapper.selectList(new QueryWrapper<CateBudget>().eq("STATUS",Constants.ZERO).eq("CATEGORY_ID",c.getId()).orderByAsc(" SORTNUM "))); | 
|---|