gunshi-project-ss/src/main/java/com/gunshi/project/hsz/service/RescueGoodsService.java

98 lines
2.8 KiB
Java
Raw Normal View History

2025-07-17 15:26:39 +08:00
package com.gunshi.project.hsz.service;
2024-07-08 10:05:02 +08:00
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gunshi.file.model.FileDescriptor;
2025-07-17 15:26:39 +08:00
import com.gunshi.project.hsz.entity.so.RescueGoodsPageSo;
import com.gunshi.project.hsz.mapper.RescueGoodsMapper;
import com.gunshi.project.hsz.model.RescueGoodsB;
import com.gunshi.project.hsz.model.RescueGoodsBAutoDao;
import com.gunshi.project.hsz.model.RescueGoodsBAutoMapper;
import com.gunshi.project.hsz.model.RescueGoodsFile;
2024-07-08 10:05:02 +08:00
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)
2024-07-08 17:47:02 +08:00
public class RescueGoodsService
extends AbstractModelWithAttachService<
RescueGoodsB,
RescueGoodsBAutoMapper,
RescueGoodsBAutoDao,
RescueGoodsFile,
2025-07-17 15:26:39 +08:00
com.gunshi.project.hsz.model.RescueGoodsFileAutoMapper,
com.gunshi.project.hsz.model.RescueGoodsFileAutoDao
2024-07-08 17:47:02 +08:00
>
{
2024-07-08 10:05:02 +08:00
@Autowired
private RescueGoodsBAutoDao autoDao;
@Autowired
2025-07-17 15:26:39 +08:00
private com.gunshi.project.hsz.model.RescueGoodsFileAutoDao attachFileAutoDao;
2024-07-08 10:05:02 +08:00
@Resource
private RescueGoodsMapper rescueGoodsMapper;
public Page<RescueGoodsB> pageQuery(RescueGoodsPageSo RescueGoodsPageSo) {
return rescueGoodsMapper.pageQuery(RescueGoodsPageSo.getPageSo().toPage(),RescueGoodsPageSo);
}
@Override
RescueGoodsBAutoDao getAutoDao() {
return autoDao;
}
@Override
2025-07-17 15:26:39 +08:00
com.gunshi.project.hsz.model.RescueGoodsFileAutoDao getAttachFileAutoDao() {
2024-07-08 10:05:02 +08:00
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);
}
}