package com.ruoyi.basic.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.basic.mapper.*; import com.ruoyi.basic.pojo.*; import com.ruoyi.basic.service.*; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.system.domain.vo.UserVo; import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.service.UserService; import lombok.AllArgsConstructor; import org.springframework.stereotype.Service; import java.time.LocalDateTime; @Service @AllArgsConstructor public class IfsInventoryQuantityServiceImpl extends ServiceImpl implements IfsInventoryQuantityService { private IfsInventoryQuantityMapper ifsInventoryQuantityMapper; private UserService userService; @Override public int addIfsInventory(IfsInventoryQuantity ifsInventoryQuantity) { UserVo userNow = userService.getUserNow(); ifsInventoryQuantity.setDeclareUser(userNow.getName()); ifsInventoryQuantity.setDeclareDate(LocalDateTime.now()); if (ifsInventoryQuantity.getId() ==null){ ifsInventoryQuantity.setState(0); ifsInventoryQuantity.setIsInspect(1); return ifsInventoryQuantityMapper.insert(ifsInventoryQuantity); }else { return ifsInventoryQuantityMapper.updateById(ifsInventoryQuantity); } } @Override public int delIfsInventory(Integer id) { return ifsInventoryQuantityMapper.deleteById(id); } }