123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- package com.ruoyi.basicData.service.impl;
- import com.ruoyi.basicData.domain.TWarehouseArea;
- import com.ruoyi.basicData.mapper.TWarehouseAreaMapper;
- import com.ruoyi.basicData.service.ITWarehouseAreaService;
- import com.ruoyi.common.core.domain.AjaxResult;
- import com.ruoyi.common.utils.DateUtils;
- import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
- import com.ruoyi.warehouseBusiness.domain.TWarehousebillsitems;
- import com.ruoyi.warehouseBusiness.mapper.TWarehouseBillsMapper;
- import com.ruoyi.warehouseBusiness.mapper.TWarehousebillsitemsMapper;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import org.springframework.transaction.annotation.Transactional;
- import org.springframework.transaction.interceptor.TransactionAspectSupport;
- import java.util.List;
- /**
- * 库区Service业务层处理
- *
- * @author ruoyi
- * @date 2020-12-11
- */
- @Service
- public class TWarehouseAreaServiceImpl implements ITWarehouseAreaService {
- @Autowired
- private TWarehouseAreaMapper tWarehouseAreaMapper;
- @Autowired
- private TWarehousebillsitemsMapper tWarehousebillsitemsMapper;
- /**
- * 查询库区
- *
- * @param fId 库区ID
- * @return 库区
- */
- @Override
- public TWarehouseArea selectTWarehouseAreaById(Long fId) {
- return tWarehouseAreaMapper.selectTWarehouseAreaById(fId);
- }
- /**
- * 查询库区列表
- *
- * @param tWarehouseArea 库区
- * @return 库区
- */
- @Override
- public List<TWarehouseArea> selectTWarehouseAreaList(TWarehouseArea tWarehouseArea) {
- return tWarehouseAreaMapper.selectTWarehouseAreaList(tWarehouseArea);
- }
- /**
- * 新增库区
- *
- * @param tWarehouseArea 库区
- * @return 结果
- */
- @Override
- public int insertTWarehouseArea(TWarehouseArea tWarehouseArea) {
- tWarehouseArea.setCreateTime(DateUtils.getNowDate());
- return tWarehouseAreaMapper.insertTWarehouseArea(tWarehouseArea);
- }
- /**
- * 修改库区
- *
- * @param tWarehouseArea 库区
- * @return 结果
- */
- @Override
- public int updateTWarehouseArea(TWarehouseArea tWarehouseArea) {
- tWarehouseArea.setUpdateTime(DateUtils.getNowDate());
- return tWarehouseAreaMapper.updateTWarehouseArea(tWarehouseArea);
- }
- /**
- * 批量删除库区
- *
- * @param fId 需要删除的库区ID
- * @return 结果
- */
- @Override
- @Transactional
- public AjaxResult deleteTWarehouseAreaByIds(Long[] fId) {
- for(Long id:fId){
- TWarehousebillsitems tWarehousebillsitems =new TWarehousebillsitems();
- tWarehousebillsitems.setfWarehouselocid(id);
- int warehousebillsitemsSize = tWarehousebillsitemsMapper.warehousebillsitemsWarehouselocidSize(id);
- if(warehousebillsitemsSize > 0 ){
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
- return AjaxResult.error("库区有货物不可删除");
- }
- tWarehouseAreaMapper.deleteTWarehouseAreaById(id);
- }
- return AjaxResult.success();
- }
- /**
- * 删除库区信息
- *
- * @param fId 库区ID
- * @return 结果
- */
- @Override
- public int deleteTWarehouseAreaById(Long fId) {
- return tWarehouseAreaMapper.deleteTWarehouseAreaById(fId);
- }
- }
|