fix:修复属性组管理删除一个无法继续修改
parent
e667f6e461
commit
70223a4d04
|
@ -37,5 +37,5 @@ public class AttributeGroupEditReq extends BaseEntity {
|
|||
@ApiModelProperty(name = "状态", value = "状态", required = true)
|
||||
private String states;
|
||||
|
||||
private List<AttributeInfo> attributeIdList ;
|
||||
private List<AttributeInfo> attributeList ;
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ public class AttributeGroupController extends BaseController {
|
|||
@ApiOperation("修改属性组")
|
||||
public Result edit(@PathVariable Long id, @RequestBody AttributeGroupEditReq attributeGroupEditReq) {
|
||||
attributeGroupService.updateByIdList(id,attributeGroupEditReq);
|
||||
return Result.success();
|
||||
return Result.success("修改成功");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.muyu.product.mapper;
|
|||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.product.domain.AttributeGroup;
|
||||
import com.muyu.product.domain.req.AttributeGroupEditReq;
|
||||
import com.muyu.product.domain.AttributeInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
|
@ -17,5 +17,6 @@ public interface AttributeGroupMapper extends BaseMapper<AttributeGroup> {
|
|||
void deleteId(Long id);
|
||||
|
||||
|
||||
void install(@Param("id") Long id, @Param("attributeList") List<Long> attributeList);
|
||||
void install(@Param("id") Long id, @Param("longs") List<Long> longs);
|
||||
|
||||
}
|
||||
|
|
|
@ -128,7 +128,8 @@ public class AttributeGroupServiceImpl extends ServiceImpl<AttributeGroupMapper,
|
|||
public void updateByIdList(Long id, AttributeGroupEditReq attributeGroupEditReq) {
|
||||
attributeGroupMapper.deleteId(id);
|
||||
|
||||
List<Long> longs = attributeGroupEditReq.getAttributeIdList().stream().map(AttributeInfo::getId).toList();
|
||||
List<AttributeInfo> list = attributeGroupEditReq.getAttributeList();
|
||||
List<Long> longs = list.stream().map(AttributeInfo::getId).toList();
|
||||
attributeGroupMapper.install(id,longs);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,10 +21,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<insert id="install">
|
||||
INSERT INTO as_attribute_group
|
||||
( `group_id`, `attribute_id`) VALUES
|
||||
<foreach collection="attributeList" separator="," item="attributeList">
|
||||
(#{id}, #{attributeList})
|
||||
<foreach collection="longs" separator="," item="longs">
|
||||
(#{id}, #{longs})
|
||||
</foreach>
|
||||
|
||||
</insert>
|
||||
<delete id="deleteId">
|
||||
delete from as_attribute_group where group_id = #{id}
|
||||
|
|
Loading…
Reference in New Issue