89 lines
2.8 KiB
Java
89 lines
2.8 KiB
Java
|
|
package com.gunshi.project.xyt.service;
|
||
|
|
|
||
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||
|
|
import com.gunshi.file.model.FileDescriptor;
|
||
|
|
import com.gunshi.project.xyt.entity.so.RescueGoodsPageSo;
|
||
|
|
import com.gunshi.project.xyt.mapper.RescueGoodsMapper;
|
||
|
|
import com.gunshi.project.xyt.model.RescueGoodsB;
|
||
|
|
import com.gunshi.project.xyt.model.RescueGoodsBAutoDao;
|
||
|
|
import com.gunshi.project.xyt.model.RescueGoodsBAutoMapper;
|
||
|
|
import com.gunshi.project.xyt.model.RescueGoodsFile;
|
||
|
|
import jakarta.annotation.Resource;
|
||
|
|
import lombok.extern.slf4j.Slf4j;
|
||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
|
import org.springframework.stereotype.Service;
|
||
|
|
import org.springframework.transaction.annotation.Transactional;
|
||
|
|
|
||
|
|
import java.util.ArrayList;
|
||
|
|
import java.util.Date;
|
||
|
|
import java.util.List;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Description:
|
||
|
|
* Created by wanyan on 2024/3/20
|
||
|
|
*
|
||
|
|
* @author wanyan
|
||
|
|
* @version 1.0
|
||
|
|
*/
|
||
|
|
@Service
|
||
|
|
@Slf4j
|
||
|
|
@Transactional(rollbackFor = Exception.class)
|
||
|
|
public class RescueGoodsService extends AbstractModelWithAttachService<RescueGoodsB, RescueGoodsBAutoMapper, RescueGoodsBAutoDao, RescueGoodsFile, com.gunshi.project.xyt.model.RescueGoodsFileAutoMapper, com.gunshi.project.xyt.model.RescueGoodsFileAutoDao>{
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
private RescueGoodsBAutoDao autoDao;
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
private com.gunshi.project.xyt.model.RescueGoodsFileAutoDao attachFileAutoDao;
|
||
|
|
|
||
|
|
@Resource
|
||
|
|
private RescueGoodsMapper rescueGoodsMapper;
|
||
|
|
|
||
|
|
|
||
|
|
public Page<RescueGoodsB> pageQuery(RescueGoodsPageSo RescueGoodsPageSo) {
|
||
|
|
return rescueGoodsMapper.pageQuery(RescueGoodsPageSo.getPageSo().toPage(),RescueGoodsPageSo);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
@Override
|
||
|
|
RescueGoodsBAutoDao getAutoDao() {
|
||
|
|
return autoDao;
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
com.gunshi.project.xyt.model.RescueGoodsFileAutoDao getAttachFileAutoDao() {
|
||
|
|
return attachFileAutoDao;
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
List<RescueGoodsFile> createAttachList(RescueGoodsB RescueGoodsB) {
|
||
|
|
List<String> fileIds = RescueGoodsB.getFileIds();
|
||
|
|
if (fileIds == null) return null;
|
||
|
|
List<RescueGoodsFile> attachList = new ArrayList<>();
|
||
|
|
for (String fileId : fileIds) {
|
||
|
|
RescueGoodsFile attach = new RescueGoodsFile();
|
||
|
|
attach.setFileId(Long.valueOf(fileId));
|
||
|
|
attach.setGoodsId(RescueGoodsB.getGoodsId());
|
||
|
|
attach.setTm(new Date());
|
||
|
|
attach.setId(IdWorker.getId());
|
||
|
|
attachList.add(attach);
|
||
|
|
}
|
||
|
|
return attachList;
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
Object getModelId(RescueGoodsB RescueGoodsB) {
|
||
|
|
return RescueGoodsB.getGoodsId();
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public String getAttachBzIdName() {
|
||
|
|
return "goods_id";
|
||
|
|
}
|
||
|
|
|
||
|
|
public List<FileDescriptor> detail(Long goodsId) {
|
||
|
|
return rescueGoodsMapper.detail(goodsId);
|
||
|
|
}
|
||
|
|
}
|