package com.iailab.module.model.mpk.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.iailab.framework.common.service.impl.BaseServiceImpl; import com.iailab.framework.common.util.object.ConvertUtils; import com.iailab.module.model.mpk.dao.SettingSelectDao; import com.iailab.module.model.mpk.dto.MethodSettingDTO; import com.iailab.module.model.mpk.dto.SettingSelectDTO; import com.iailab.module.model.mpk.entity.ModelMethodEntity; import com.iailab.module.model.mpk.entity.SettingSelectEntity; import com.iailab.module.model.mpk.service.SettingSelectService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import java.util.List; import java.util.Map; import java.util.UUID; /** * @description: * @author: dzd * @date: 2024/9/14 15:13 **/ @Slf4j @Service public class SettingSelectServiceImpl extends BaseServiceImpl implements SettingSelectService { @Override public void deleteByMap(Map map) { baseDao.delete(getWrapper(map)); } private QueryWrapper getWrapper(Map params) { String settingId = (String) params.get("settingId"); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(settingId), "setting_id", settingId); return wrapper; } @Override public void insertList(List list, String settingId) { List entityList = ConvertUtils.sourceToTarget(list, SettingSelectEntity.class); for(int i = 0; i < entityList.size(); i++){ SettingSelectEntity entity = entityList.get(i); entity.setId(UUID.randomUUID().toString()); entity.setSettingId(settingId); entity.setSort(i); baseDao.insert(entity); } } }