Commit 88bd06f1 by 徐高华

Merge branch 'feature/xgh/202503' into 'developer'

素材分组排序

See merge request !2737
parents 6c52c4c5 1a7e9e4d
......@@ -42,7 +42,7 @@ public interface MaterialApiService {
String reUpdalodMetail(String materialId);
List<MaterialCategoryDTO> listByParentCategory(String categoryId);
List<MaterialCategoryDTO> listByParentCategory(String wxEnterpriseId ,String categoryId);
/**
* 分析素材
......
......@@ -23,7 +23,7 @@ public interface TabHaobanMaterialCategoryMapper {
List<TabHaobanMaterialCategory> listCategory(@Param("wxEnterpriseId")String wxEnterpriseId);
List<TabHaobanMaterialCategory> listByParentCategory(@Param("categoryId")String categoryId);
List<TabHaobanMaterialCategory> listByParentCategory(@Param("wxEnterpriseId")String wxEnterpriseId , @Param("categoryId")String categoryId);
void updateSortNum(@Param("list")List<MaterialCategoryDTO> list);
}
\ No newline at end of file
......@@ -17,7 +17,7 @@ public interface MaterialCategoryService {
void editCategory(MaterialCategoryDTO materialCategoryDTO);
List<MaterialCategoryDTO> listByParentCategory(String categoryId);
List<MaterialCategoryDTO> listByParentCategory(String wxEnterpriseId , String categoryId);
void materialSortCategory(MaterialCategorySortQDTO qdto);
}
......@@ -35,7 +35,7 @@ public class MaterialCategoryServiceImpl implements MaterialCategoryService{
materialCategoryDTO.setSortNum(-1);
mapper.insert(EntityUtil.changeEntityByJSON(TabHaobanMaterialCategory.class, materialCategoryDTO));
// 修改排序
List<MaterialCategoryDTO> list = this.listByParentCategory(materialCategoryDTO.getCategoryParentId()) ;
List<MaterialCategoryDTO> list = this.listByParentCategory(materialCategoryDTO.getWxEnterpriseId(),materialCategoryDTO.getCategoryParentId()) ;
for(int i=0;i<list.size();i++) {
MaterialCategoryDTO item = list.get(i) ;
item.setSortNum(i+1);
......@@ -60,8 +60,8 @@ public class MaterialCategoryServiceImpl implements MaterialCategoryService{
}
@Override
public List<MaterialCategoryDTO> listByParentCategory(String categoryId) {
return EntityUtil.changeEntityListByJSON(MaterialCategoryDTO.class, mapper.listByParentCategory(categoryId));
public List<MaterialCategoryDTO> listByParentCategory(String wxEnterpriseId , String categoryId) {
return EntityUtil.changeEntityListByJSON(MaterialCategoryDTO.class, mapper.listByParentCategory(wxEnterpriseId , categoryId));
}
@Override
......@@ -70,7 +70,7 @@ public class MaterialCategoryServiceImpl implements MaterialCategoryService{
Integer sortNum = qdto.getSortNum();
MaterialCategoryDTO dto = this.selectMaterialCategoryById(categoryId) ;
String parentId = dto.getCategoryParentId();
List<MaterialCategoryDTO> list = this.listByParentCategory(parentId) ;
List<MaterialCategoryDTO> list = EntityUtil.changeEntityListByJSON(MaterialCategoryDTO.class, mapper.listByParentCategory(dto.getWxEnterpriseId() , parentId));
int oldSortNum = 0 ;
for(int i=0;i<list.size();i++) {
MaterialCategoryDTO item = list.get(i) ;
......
......@@ -307,18 +307,18 @@ public class MaterialApiServiceImpl implements MaterialApiService {
return old.getMediaId();
}
private List<String> listSubCategoryIdsByParentId(String categoryId) {
private List<String> listSubCategoryIdsByParentId(String wxEnterpriseId , String categoryId) {
List<String> categoryIds = new ArrayList<>();
categoryIds.add(categoryId);
if (StringUtils.isBlank(categoryId)) {
return categoryIds;
}
List<MaterialCategoryDTO> categoryDTOList = materialCategoryService.listByParentCategory(categoryId);
List<MaterialCategoryDTO> categoryDTOList = materialCategoryService.listByParentCategory(wxEnterpriseId,categoryId);
if (CollectionUtils.isEmpty(categoryDTOList)) {
return categoryIds;
}
for (MaterialCategoryDTO categoryDTO : categoryDTOList) {
categoryIds.addAll(this.listSubCategoryIdsByParentId(categoryDTO.getCategoryId()));
categoryIds.addAll(this.listSubCategoryIdsByParentId(wxEnterpriseId,categoryDTO.getCategoryId()));
}
return categoryIds;
}
......@@ -331,7 +331,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
// 传入-1默认查询全部
categoryIds = Collections.emptyList();
} else {
categoryIds = this.listSubCategoryIdsByParentId(categoryId);
categoryIds = this.listSubCategoryIdsByParentId(wxEnterpriseId,categoryId);
}
PageHelper.startPage(pageInfo.getPageNum(), pageInfo.getPageSize());
com.github.pagehelper.Page<TabHaobanMaterial> page = materialService.listMaterial(wxEnterpriseId, keyword, categoryIds, materialType);
......@@ -356,8 +356,8 @@ public class MaterialApiServiceImpl implements MaterialApiService {
}
@Override
public List<MaterialCategoryDTO> listByParentCategory(String categoryId) {
return materialCategoryService.listByParentCategory(categoryId);
public List<MaterialCategoryDTO> listByParentCategory(String wxEnterpriseId , String categoryId) {
return materialCategoryService.listByParentCategory(wxEnterpriseId,categoryId);
}
@Override
......
......@@ -78,6 +78,9 @@
<include refid="Base_Column_List" />
from tab_haoban_material_category
where status_flag = 1
<if test="null != wxEnterpriseId">
and wx_enterprise_id = #{wxEnterpriseId}
</if>
and category_parent_id = #{categoryId} order by sort_num asc , create_time desc
</select>
......
......@@ -126,7 +126,7 @@ public class MaterialController extends WebBaseController {
if (dto == null) {
return resultResponse(HaoBanErrCode.ERR_10016);
}
List<MaterialCategoryDTO> categoryList = materialApiService.listByParentCategory(categoryId);
List<MaterialCategoryDTO> categoryList = materialApiService.listByParentCategory(dto.getWxEnterpriseId(),categoryId);
if (categoryList != null && !categoryList.isEmpty()) {
return resultResponse(HaoBanErrCode.ERR_10017);
}
......
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