增加配置属性

This commit is contained in:
sxu 2024-12-10 10:07:51 +08:00
parent c58aa96c9f
commit 7849348924
4 changed files with 30 additions and 0 deletions

View File

@ -87,4 +87,8 @@ public interface MaTypeMapper {
List<Integer> selectParentId(@Param("typeId")Long typeId, @Param("level")Integer level); List<Integer> selectParentId(@Param("typeId")Long typeId, @Param("level")Integer level);
Integer updateLeasePrice(@Param("typeIds")List<Integer> typeIds,@Param("leasePrice") BigDecimal leasePrice); Integer updateLeasePrice(@Param("typeIds")List<Integer> typeIds,@Param("leasePrice") BigDecimal leasePrice);
int deleteMaTypePropertyNames(@Param("typeId")Long typeId);
int insertMaTypePropertyNames(@Param("typeId")Long typeId, @Param("list") List<String> propertyNames);
} }

View File

@ -8,6 +8,8 @@ import com.bonus.material.ma.service.ITypeService;
import com.bonus.material.ma.vo.*; import com.bonus.material.ma.vo.*;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -128,6 +130,11 @@ public class MaTypeServiceImpl implements ITypeService {
Long typeId = maType.getTypeId(); Long typeId = maType.getTypeId();
maType.setUpdateTime(DateUtils.getNowDate()); maType.setUpdateTime(DateUtils.getNowDate());
int i = maTypeMapper.updateType(maType); int i = maTypeMapper.updateType(maType);
//保存配置属性
if (!CollectionUtils.isEmpty(maType.getPropertyNames())) {
maTypeMapper.deleteMaTypePropertyNames(maType.getTypeId());
maTypeMapper.insertMaTypePropertyNames(maType.getTypeId(), maType.getPropertyNames());
}
// 图片路径保存 // 图片路径保存
if (StringUtils.isNotEmpty(maType.getPhotoName()) && StringUtils.isNotEmpty(maType.getPhotoUrl())) { if (StringUtils.isNotEmpty(maType.getPhotoName()) && StringUtils.isNotEmpty(maType.getPhotoUrl())) {
typeFileMapper.deleteMaTypeFileByTypeId(typeId, "1"); typeFileMapper.deleteMaTypeFileByTypeId(typeId, "1");

View File

@ -216,4 +216,6 @@ public class MaType extends BaseEntity {
private String intelligentCode; private String intelligentCode;
private List<Integer> typeIds; private List<Integer> typeIds;
private List<String> propertyNames;
} }

View File

@ -454,4 +454,21 @@
</foreach> </foreach>
and del_flag = 0 and del_flag = 0
</update> </update>
<delete id="deleteMaTypePropertyNames">
delete from ma_type_properties where type_id = #{typeId}
</delete>
<insert id="insertMaTypePropertyNames">
insert into
ma_type_properties(type_id, property_name, create_time)
values
<foreach collection="list" item="item" index="index" separator=",">
(
#{typeId},
#{item},
now()
)
</foreach>
</insert>
</mapper> </mapper>