package com.iailab.module.model.mcs.pre.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.iailab.framework.common.pojo.PageResult; import com.iailab.framework.common.service.impl.BaseServiceImpl; import com.iailab.module.model.mcs.pre.dao.MmResultTableDao; import com.iailab.module.model.mcs.pre.entity.MmResultTableEntity; import com.iailab.module.model.mcs.pre.service.MmResultTableService;; import com.iailab.module.model.mcs.pre.vo.MmResultTablePageReqVO; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.UUID; /** * @author PanZhibao * @date 2021年04月23日 16:28 */ @Service("mmResultTableService") public class MmResultTableServiceImpl extends BaseServiceImpl implements MmResultTableService { @Override public PageResult page(MmResultTablePageReqVO reqVO) { return baseDao.selectPage(reqVO); } private QueryWrapper getWrapper(Map params) { String tablename = (String)params.get("tablename"); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.like(StringUtils.isNotBlank(tablename),"tablename", tablename); return wrapper; } @Override @Transactional(rollbackFor = Exception.class) public void saveResultTable(MmResultTableEntity resultTable) { resultTable.setId(UUID.randomUUID().toString()); baseDao.insert(resultTable); } @Override @Transactional(rollbackFor = Exception.class) public void update(MmResultTableEntity resultTable) { baseDao.updateById(resultTable); } @Override @Transactional(rollbackFor = Exception.class) public void deleteBatch(String[] resultTableIds) { baseDao.deleteBatchIds(Arrays.asList(resultTableIds)); } @Override public int check(MmResultTableEntity resultTable) { String id = resultTable.getId(); String tablename = resultTable.getTablename(); QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.ne(StringUtils.isNotBlank(id), "id", id); queryWrapper.and(wrapper -> wrapper.eq("tablename",tablename)); List list = baseDao.selectList(queryWrapper); return list.size(); } }