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.TmsShelfMapper; import com.ruoyi.tms.domain.TmsShelf; import com.ruoyi.tms.service.ITmsShelfService; import com.ruoyi.common.core.text.Convert; /** * 托架管理Service业务层处理 * * @author ruoyi * @date 2025-11-03 */ @Service @Transactional(rollbackFor = Exception.class) public class TmsShelfServiceImpl extends BaseService implements ITmsShelfService { protected final Logger logger = LoggerFactory.getLogger(getClass()); @Resource private TmsShelfMapper tmsShelfMapper; @Autowired ISystemDataNoService systemDataNoService; /** * 查询托架管理 * * @param id 托架管理ID * @return 托架管理 */ @DataSource(DataSourceType.SLAVE) @Override public TmsShelf selectTmsShelfById(Integer id) { return tmsShelfMapper.selectTmsShelfById(id); } /** * 查询托架管理 记录数 * * @param tmsShelf 托架管理 * @return 托架管理集合 */ @DataSource(DataSourceType.SLAVE) @Override public int selectTmsShelfCount(TmsShelf tmsShelf) { return tmsShelfMapper.selectTmsShelfCount(tmsShelf); } /** * 查询托架管理列表 * * @param tmsShelf 托架管理 * @return 托架管理 */ @DataSource(DataSourceType.SLAVE) @Override public List selectTmsShelfList(TmsShelf tmsShelf) { return tmsShelfMapper.selectTmsShelfList(tmsShelf); } /** * 查询托架管理列表 异步 导出 * * @param tmsShelf 托架管理 * @param exportKey 导出功能的唯一标识 * @return 托架管理集合 */ @DataSource(DataSourceType.SLAVE) @Async @Override public void export(TmsShelf tmsShelf,String exportKey) { super.export(TmsShelf.class,exportKey,"tmsShelfData",(pageNum)->{ PageUtils.startPage(pageNum, Constants.EXPORT_PATE_SIZE); return selectTmsShelfList(tmsShelf); }); } /** * 新增托架管理 * * @param tmsShelf 托架管理 * @return 结果 */ @Override public int insertTmsShelf(TmsShelf tmsShelf) { tmsShelf.setSystemCode(systemDataNoService.getNoByKey(SystemDataNoEnum.TJ)); tmsShelf.setCreateBy(SecurityUtils.getUsername()); tmsShelf.setCreateTime(DateUtils.getNowDate()); return tmsShelfMapper.insertTmsShelf(tmsShelf); } /** * 新增托架管理[批量] * * @param tmsShelfs 托架管理 * @return 结果 */ @Override public int insertTmsShelfBatch(List tmsShelfs) { int rows = tmsShelfMapper.insertTmsShelfBatch(tmsShelfs); return rows; } /** * 修改托架管理 * * @param tmsShelf 托架管理 * @return 结果 */ @Override public int updateTmsShelf(TmsShelf tmsShelf) { tmsShelf.setUpdateBy(SecurityUtils.getUsername()); tmsShelf.setUpdateTime(DateUtils.getNowDate()); return tmsShelfMapper.updateTmsShelf(tmsShelf); } /** * 修改托架管理[批量] * * @param tmsShelfs 托架管理 * @return 结果 */ @Override public int updateTmsShelfBatch(List tmsShelfs){ return tmsShelfMapper.updateTmsShelfBatch(tmsShelfs); } /** * 删除托架管理对象 * * @param ids 需要删除的数据ID * @return 结果 */ @Override public int deleteTmsShelfByIds(String ids) { return deleteTmsShelfByIds(Convert.toIntArray(ids)); } /** * 删除托架管理对象 * * * @param ids 需要删除的数据ID * @return 结果 */ @Override public int deleteTmsShelfByIds(Integer[] ids) { return tmsShelfMapper.deleteTmsShelfByIds(ids); } /** * 删除托架管理信息 * * @param id 托架管理ID * @return 结果 */ @Override public int deleteTmsShelfById(Integer id) { return tmsShelfMapper.deleteTmsShelfById(id); } }