package com.iailab.module.model.mpk.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.iailab.framework.common.page.PageData; import com.iailab.framework.common.service.impl.BaseServiceImpl; import com.iailab.module.model.mpk.dao.ChartParamDao; import com.iailab.module.model.mpk.dto.ChartParamDTO; import com.iailab.module.model.mpk.entity.ChartEntity; import com.iailab.module.model.mpk.entity.ChartParamEntity; import com.iailab.module.model.mpk.service.ChartParamService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Date; import java.util.Map; import java.util.UUID; /** * @description: * @author: dzd * @date: 2024/11/5 11:21 **/ @Slf4j @Service public class ChartParamServiceImpl extends BaseServiceImpl implements ChartParamService { @Override public PageData page(Map params) { IPage page = baseDao.selectPage( getPage(params, "create_time", false), getWrapper(params) ); return getPageData(page, ChartParamDTO.class); } @Override public void create(ChartParamEntity entity) { entity.setId(UUID.randomUUID().toString()); entity.setCreateTime(new Date()); baseDao.insert(entity); } @Override public void update(ChartParamEntity entity) { entity.setUpdateTime(new Date()); baseDao.updateById(entity); } @Override public ChartParamEntity get(String id) { return baseDao.selectById(id); } @Override public void delete(String id) { baseDao.deleteById(id); } private QueryWrapper getWrapper(Map params) { String paramName = (String) params.get("paramName"); String paramCode = (String) params.get("paramCode"); String chartId = (String) params.get("chartId"); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.like(StringUtils.isNotBlank(paramName), "param_name", paramName) .like(StringUtils.isNotBlank(paramCode), "param_code", paramCode) .eq(StringUtils.isNotBlank(chartId), "chart_id", chartId); return wrapper; } }