|
|
@ -30,6 +30,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.wh.mapper.shstorehouse.ShStorehouseMapper; |
|
|
|
import com.wh.pojo.shstorehouse.*; |
|
|
|
import com.wh.pojo.shstorehouseattachment.ShStorehouseAttachmentDetailsVo; |
|
|
|
import com.wh.pojo.shstorehouseattachment.ShStorehouseAttachmentDto; |
|
|
|
import com.wh.pojo.shstorehouseattachment.ShStorehouseAttachmentVo; |
|
|
|
import com.wh.service.shstorehouseattachment.ShStorehouseAttachmentService; |
|
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
|
import com.yxt.common.base.config.component.ImageUploadUtil; |
|
|
|
import com.yxt.common.core.result.FileUploadResult; |
|
|
@ -42,6 +46,7 @@ import com.yxt.common.core.vo.PagerVo; |
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
@ -66,6 +71,7 @@ import java.util.Map; |
|
|
|
public class ShStorehouseService extends MybatisBaseService<ShStorehouseMapper, ShStorehouse> { |
|
|
|
@Autowired |
|
|
|
private FileUploadComponent fileUploadComponent; |
|
|
|
private ShStorehouseAttachmentService shStorehouseAttachmentService; |
|
|
|
private QueryWrapper<ShStorehouse> createQueryWrapper(ShStorehouseQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
|
|
@ -95,12 +101,15 @@ public class ShStorehouseService extends MybatisBaseService<ShStorehouseMapper, |
|
|
|
|
|
|
|
return shStorehouseVos; |
|
|
|
} |
|
|
|
@Transactional |
|
|
|
public void saveOrUpdateDto(ShStorehouseDto dto){ |
|
|
|
String dtoSid = dto.getSid(); |
|
|
|
shStorehouseAttachmentService.deleteByHouseSid(dtoSid); |
|
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
|
this.insertByDto(dto); |
|
|
|
this.insertByDto(dto); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
this.updateByDto(dto); |
|
|
|
} |
|
|
|
|
|
|
@ -112,6 +121,15 @@ public class ShStorehouseService extends MybatisBaseService<ShStorehouseMapper, |
|
|
|
String countyName = dto.getCountyName(); |
|
|
|
String regionName=provinceName+","+cityName+","+countyName; |
|
|
|
entity.setRegionName(regionName); |
|
|
|
List<String> pics = dto.getPics(); |
|
|
|
for (String pic : pics) { |
|
|
|
ShStorehouseAttachmentDetailsVo shStorehouseAttachmentDetailsVo = shStorehouseAttachmentService.fetchDetailsVoBySid(pic); |
|
|
|
shStorehouseAttachmentDetailsVo.setStorehouseSid(entity.getSid()); |
|
|
|
shStorehouseAttachmentDetailsVo.setStorehouseName(entity.getName()); |
|
|
|
ShStorehouseAttachmentDto picdto=new ShStorehouseAttachmentDto(); |
|
|
|
BeanUtil.copyProperties(pic,picdto); |
|
|
|
shStorehouseAttachmentService.updateByDto(picdto); |
|
|
|
} |
|
|
|
baseMapper.insert(entity); |
|
|
|
} |
|
|
|
|
|
|
@ -127,6 +145,15 @@ public class ShStorehouseService extends MybatisBaseService<ShStorehouseMapper, |
|
|
|
String regionName=provinceName+","+cityName+","+countyName; |
|
|
|
entity.setRegionName(regionName); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
List<String> pics = dto.getPics(); |
|
|
|
for (String pic : pics) { |
|
|
|
ShStorehouseAttachmentDetailsVo shStorehouseAttachmentDetailsVo = shStorehouseAttachmentService.fetchDetailsVoBySid(pic); |
|
|
|
shStorehouseAttachmentDetailsVo.setStorehouseSid(entity.getSid()); |
|
|
|
shStorehouseAttachmentDetailsVo.setStorehouseName(entity.getName()); |
|
|
|
ShStorehouseAttachmentDto picdto=new ShStorehouseAttachmentDto(); |
|
|
|
BeanUtil.copyProperties(pic,picdto); |
|
|
|
shStorehouseAttachmentService.updateByDto(picdto); |
|
|
|
} |
|
|
|
baseMapper.updateById(entity); |
|
|
|
} |
|
|
|
|
|
|
@ -135,7 +162,9 @@ public class ShStorehouseService extends MybatisBaseService<ShStorehouseMapper, |
|
|
|
ShStorehouseDetailsVo vo = new ShStorehouseDetailsVo(); |
|
|
|
if (vo==null) |
|
|
|
return null; |
|
|
|
List<ShStorehouseAttachmentVo> pics=shStorehouseAttachmentService.fetchDetailsVoByShSid(sid); |
|
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
|
vo.setPics(pics); |
|
|
|
return vo; |
|
|
|
} |
|
|
|
|
|
|
|