mirror of
https://github.com/zccbbg/wms-ruoyi.git
synced 2024-09-20 11:05:54 +08:00
fix: 商品分类排序
This commit is contained in:
parent
86b0abaf7f
commit
5475c7d8e1
|
@ -106,6 +106,7 @@ public class ItemCategoryController extends BaseController {
|
|||
|
||||
@PostMapping("/update/orderNum")
|
||||
public R<Void> updateOrderNum(@RequestBody List<ItemTypeTreeSelectVo> tree) {
|
||||
return toAjax(itemCategoryService.updateOrderNum(tree));
|
||||
itemCategoryService.updateOrderNum(tree);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,5 +8,4 @@ import org.apache.ibatis.annotations.Param;
|
|||
import java.util.List;
|
||||
|
||||
public interface ItemCategoryMapper extends BaseMapperPlus<ItemCategory, ItemCategoryVo> {
|
||||
int updateOrderNum(@Param("list") List<ItemCategory> list);
|
||||
}
|
||||
|
|
|
@ -213,7 +213,7 @@ public class ItemCategoryService extends ServiceImpl<ItemCategoryMapper, ItemCat
|
|||
return getChildList(list, t).size() > 0;
|
||||
}
|
||||
|
||||
public int updateOrderNum(List<ItemTypeTreeSelectVo> tree) {
|
||||
public void updateOrderNum(List<ItemTypeTreeSelectVo> tree) {
|
||||
List<ItemCategory> updateList = new ArrayList<>();
|
||||
for (int i = 0; i < tree.size(); i++) {
|
||||
ItemCategory itemType = new ItemCategory();
|
||||
|
@ -221,6 +221,6 @@ public class ItemCategoryService extends ServiceImpl<ItemCategoryMapper, ItemCat
|
|||
itemType.setOrderNum((long) i);
|
||||
updateList.add(itemType);
|
||||
}
|
||||
return baseMapper.updateOrderNum(updateList);
|
||||
saveOrUpdateBatch(updateList);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,4 @@
|
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.wms.mapper.ItemCategoryMapper">
|
||||
|
||||
<update id="updateOrderNum">
|
||||
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
|
||||
update wms_item_type
|
||||
set order_num=#{item.orderNum}
|
||||
where id=#{item.id}
|
||||
</foreach>
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in a new issue