package com.iailab.module.data.indexdata.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.iailab.module.data.common.utils.PageUtils; import com.iailab.module.data.common.utils.Query; import com.iailab.module.data.indexdata.dao.IndexDataValueDao; import com.iailab.module.data.indexdata.entity.IndexDataValueEntity; import com.iailab.module.data.indexdata.service.IndexDataValueService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Map; /** * @author PanZhibao * @Description * @createTime 2022年09月08日 21:49:00 */ @Slf4j @Service public class IndexDataValueServiceImpl extends ServiceImpl implements IndexDataValueService { @Override public PageUtils queryPage(Map params) { String clock = (String)params.get("clock"); String itemCode = (String)params.get("itemCode"); IPage page = this.page( new Query().getPage(params), new QueryWrapper() .like(StringUtils.isNotBlank(clock),"clock", clock) .like(StringUtils.isNotBlank(itemCode),"item_code", itemCode) .orderByDesc("create_time") ); return new PageUtils(page); } @Override @Transactional(rollbackFor = Exception.class) public void add(IndexDataValueEntity indexDataValueEntity) { log.info("插入指标数据表2"); getBaseMapper().delete(new QueryWrapper() .eq("unit2", indexDataValueEntity.getUnit2()) .eq("ssdw", indexDataValueEntity.getSsdw()) .eq("item_code", indexDataValueEntity.getItemCode()) .eq("clock", indexDataValueEntity.getClock())); this.save(indexDataValueEntity); } }