package com.newfiber.api.pc.service.gis; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.newfiber.api.core.utils.StringUtil; import com.newfiber.api.pc.dao.gis.PipelineFlawMapper; import com.newfiber.api.pc.model.gis.PipelineFlaw; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; /** * ServiceImpl * * @author : xiongk * @since : 2021-09-23 14:00 */ @Service public class PipelineFlawService extends ServiceImpl<PipelineFlawMapper, PipelineFlaw> { @Value("${nginx.pic}") private String nginxPic; public PipelineFlaw infoByNumber(String number){ Wrapper<PipelineFlaw> entityWrapper = new EntityWrapper<PipelineFlaw>(). eq("concat(concat(start_number, '-'), connect_number)", number); PipelineFlaw pipelineFlaw = selectOne(entityWrapper); if(null != pipelineFlaw){ if(StringUtil.isNotEmpty(pipelineFlaw.getPicture())){ String[] pictureName = pipelineFlaw.getPicture().split("\\|"); List<String> parsedPictureName = new ArrayList<>(); for(String picture : pictureName){ parsedPictureName.add(nginxPic.concat("gis/").concat(picture)); } pipelineFlaw.setPicture(String.join("|", parsedPictureName)); } } return pipelineFlaw; } public void refreshPicture(String number, String picture){ Wrapper<PipelineFlaw> entityWrapper = new EntityWrapper<PipelineFlaw>(). eq("concat(concat(start_number, '-'), connect_number)", number); PipelineFlaw pipelineFlaw = new PipelineFlaw(); pipelineFlaw.setPicture(picture); update(pipelineFlaw, entityWrapper); } }