package com.iailab.module.model.mpk.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.iailab.framework.common.service.impl.CrudServiceImpl; import com.iailab.framework.common.util.object.ConvertUtils; import com.iailab.module.model.mpk.dao.ProjectModelDao; import com.iailab.module.model.mpk.dto.ProjectModelDTO; import com.iailab.module.model.mpk.entity.ProjectModelEntity; import com.iailab.module.model.mpk.service.ProjectModelService; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import java.util.List; import java.util.Map; /** * @description: * @author: dzd * @date: 2024/8/22 14:41 **/ @Service public class ProjectModelServiceImpl extends CrudServiceImpl implements ProjectModelService { @Override public List list(Map params) { List entityList = baseDao.selectList(getWrapper(params)); return ConvertUtils.sourceToTarget(entityList, ProjectModelDTO.class); } @Override public void deleteByMap(Map map) { baseDao.delete(getWrapper(map)); } @Override public QueryWrapper getWrapper(Map params){ String id = (String)params.get("id"); String projectId = (String)params.get("projectId"); String modelId = (String)params.get("modelId"); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), "id", id) .eq(StringUtils.isNotBlank(projectId), "project_id", projectId) .eq(StringUtils.isNotBlank(modelId),"model_id",modelId); return wrapper; } }