package com.ruoyi.tms.service.impl; import java.util.List; import com.ruoyi.common.enums.SystemDataNoEnum; import com.ruoyi.common.utils.DateUtils; import javax.annotation.Resource; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.system.service.ISystemDataNoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import org.springframework.stereotype.Service; import org.springframework.scheduling.annotation.Async; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.ruoyi.common.utils.PageUtils; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.annotation.DataSource; import com.ruoyi.common.enums.DataSourceType; import com.ruoyi.common.core.service.BaseService; import com.ruoyi.tms.mapper.TmsProductInfoMapper; import com.ruoyi.tms.domain.TmsProductInfo; import com.ruoyi.tms.service.ITmsProductInfoService; import com.ruoyi.common.core.text.Convert; /** * 货品信息Service业务层处理 * * @author ruoyi * @date 2025-11-04 */ @Service @Transactional(rollbackFor = Exception.class) public class TmsProductInfoServiceImpl extends BaseService implements ITmsProductInfoService { protected final Logger logger = LoggerFactory.getLogger(getClass()); @Resource private TmsProductInfoMapper tmsProductInfoMapper; @Autowired ISystemDataNoService systemDataNoService; /** * 查询货品信息 * * @param id 货品信息ID * @return 货品信息 */ @DataSource(DataSourceType.SLAVE) @Override public TmsProductInfo selectTmsProductInfoById(Integer id) { return tmsProductInfoMapper.selectTmsProductInfoById(id); } /** * 查询货品信息 记录数 * * @param tmsProductInfo 货品信息 * @return 货品信息集合 */ @DataSource(DataSourceType.SLAVE) @Override public int selectTmsProductInfoCount(TmsProductInfo tmsProductInfo) { return tmsProductInfoMapper.selectTmsProductInfoCount(tmsProductInfo); } /** * 查询货品信息列表 * * @param tmsProductInfo 货品信息 * @return 货品信息 */ @DataSource(DataSourceType.SLAVE) @Override public List selectTmsProductInfoList(TmsProductInfo tmsProductInfo) { return tmsProductInfoMapper.selectTmsProductInfoList(tmsProductInfo); } /** * 查询货品信息列表 异步 导出 * * @param tmsProductInfo 货品信息 * @param exportKey 导出功能的唯一标识 * @return 货品信息集合 */ @DataSource(DataSourceType.SLAVE) @Async @Override public void export(TmsProductInfo tmsProductInfo,String exportKey) { super.export(TmsProductInfo.class,exportKey,"tmsProductInfoData",(pageNum)->{ PageUtils.startPage(pageNum, Constants.EXPORT_PATE_SIZE); return selectTmsProductInfoList(tmsProductInfo); }); } /** * 新增货品信息 * * @param tmsProductInfo 货品信息 * @return 结果 */ @Override public int insertTmsProductInfo(TmsProductInfo tmsProductInfo) { tmsProductInfo.setCreateBy(SecurityUtils.getUsername()); tmsProductInfo.setCreateTime(DateUtils.getNowDate()); return tmsProductInfoMapper.insertTmsProductInfo(tmsProductInfo); } /** * 新增货品信息[批量] * * @param tmsProductInfos 货品信息 * @return 结果 */ @Override public int insertTmsProductInfoBatch(List tmsProductInfos) { int rows = tmsProductInfoMapper.insertTmsProductInfoBatch(tmsProductInfos); return rows; } /** * 修改货品信息 * * @param tmsProductInfo 货品信息 * @return 结果 */ @Override public int updateTmsProductInfo(TmsProductInfo tmsProductInfo) { tmsProductInfo.setUpdateBy(SecurityUtils.getUsername()); tmsProductInfo.setUpdateTime(DateUtils.getNowDate()); return tmsProductInfoMapper.updateTmsProductInfo(tmsProductInfo); } /** * 修改货品信息[批量] * * @param tmsProductInfos 货品信息 * @return 结果 */ @Override public int updateTmsProductInfoBatch(List tmsProductInfos){ return tmsProductInfoMapper.updateTmsProductInfoBatch(tmsProductInfos); } /** * 删除货品信息对象 * * @param ids 需要删除的数据ID * @return 结果 */ @Override public int deleteTmsProductInfoByIds(String ids) { return deleteTmsProductInfoByIds(Convert.toIntArray(ids)); } /** * 删除货品信息对象 * * * @param ids 需要删除的数据ID * @return 结果 */ @Override public int deleteTmsProductInfoByIds(Integer[] ids) { return tmsProductInfoMapper.deleteTmsProductInfoByIds(ids); } /** * 删除货品信息信息 * * @param id 货品信息ID * @return 结果 */ @Override public int deleteTmsProductInfoById(Integer id) { return tmsProductInfoMapper.deleteTmsProductInfoById(id); } }