| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.numgen.NumberGenerator; |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | | import com.ruoyi.basic.mapper.StandardTemplateMapper; |
| | | import com.ruoyi.basic.pojo.StandardTemplate; |
| | | import com.ruoyi.basic.service.StandardTemplateService; |
| | | import com.ruoyi.common.numgen.NumberGenerator; |
| | | import com.ruoyi.common.utils.GZipUtil; |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | StandardTemplate::getNumber); |
| | | standardTemplate.setNumber(giveCode); |
| | | } |
| | | if (StringUtils.isNotBlank(standardTemplate.getThing())) { |
| | | standardTemplate.setThing(GZipUtil.compress(standardTemplate.getThing())); |
| | | } else { |
| | | standardTemplate.setThing(null); |
| | | } |
| | | return standardTemplateMapper.insert(standardTemplate); |
| | | } |
| | | |
| | | @Override |
| | | public int upStandardTemplate(StandardTemplate standardTemplate) { |
| | | if(standardTemplate.getThing().equals("")){ |
| | | if (StringUtils.isNotBlank(standardTemplate.getThing())) { |
| | | standardTemplate.setThing(GZipUtil.compress(standardTemplate.getThing())); |
| | | } else { |
| | | standardTemplate.setThing(null); |
| | | } |
| | | return standardTemplateMapper.updateById(standardTemplate); |
| | |
| | | |
| | | @Override |
| | | public int delStandardTemplate(Integer id) { |
| | | // 判断是否被绑定 |
| | | int count = standardTemplateMapper.countBindTemplateItemParameter(id); |
| | | if (count > 0) { |
| | | throw new RuntimeException("该模板已绑定检验项目参数,禁止删除"); |
| | | } |
| | | return standardTemplateMapper.deleteById(id); |
| | | } |
| | | |
| | |
| | | if(standardTemplate==null){ |
| | | return null; |
| | | }else{ |
| | | return standardTemplate.getThing(); |
| | | return GZipUtil.uncompress(standardTemplate.getThing()); |
| | | } |
| | | // 查询压缩后的数据 |
| | | // String thing = standardTemplateMapper.selectCompressThing(templateId); |
| | | // if (StringUtils.isNotBlank(thing)) { |
| | | // try { |
| | | // return DecompressMySQLData.decompress(java.util.Base64.getDecoder().decode(thing)); |
| | | // } catch (Exception e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // } else { |
| | | // return null; |
| | | // } |
| | | } |
| | | |
| | | @Override |