chenrui
2025-04-11 6c1e7d3ffc39e98782364880bb937081e91059d6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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<IfsInventoryQuantityMapper, IfsInventoryQuantity> 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);
    }
}