Commit 88bd06f1 by 徐高华

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

素材分组排序

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