叶松
2023-11-16 e54c4eb160c09711dc262c50ef5a0b3d0c4709f5
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package com.thhy.materials.modules.biz.suMaterialWarehouse.service.impl;
 
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.thhy.general.common.BasicResult;
import com.thhy.general.config.SysUserInfo;
import com.thhy.general.utils.UserInfoUtils;
import com.thhy.materials.modules.biz.suMaterialWarehouse.entity.SuMaterialWarehouseEntity;
import com.thhy.materials.modules.biz.suMaterialWarehouse.mapper.SuMaterialWarehouseMapper;
import com.thhy.materials.modules.biz.suMaterialWarehouse.service.SuMaterialWarehouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.Date;
import java.util.Map;
 
/**
 * @Author QiuYuHao
 * @CreateDate 2023-11-15 9:23:59
 * 苏州料仓实现
 */
@Service
public class SuMaterialWarehouseServiceImpl implements SuMaterialWarehouseService {
 
    @Autowired
    private SuMaterialWarehouseMapper suMaterialWarehouseMapper;
 
    @Override
    public BasicResult insertAndUpdate(SuMaterialWarehouseEntity suMaterialWarehouseEntity) {
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
        String companyId = sysUserInfo.getCompanyId();
        String userId = sysUserInfo.getUserId();
        Integer id = suMaterialWarehouseEntity.getId();
        if(id != null){
            suMaterialWarehouseEntity.setUpdateTime(new Date());
            suMaterialWarehouseEntity.setUpdateUser(userId);
        }
        suMaterialWarehouseEntity.setCreateUser(userId);
        suMaterialWarehouseEntity.setCompanyId(companyId);
        suMaterialWarehouseMapper.insertAndUpdate(suMaterialWarehouseEntity);
        return BasicResult.success();
    }
 
    @Override
    public BasicResult delete(String id) {
        suMaterialWarehouseMapper.delete(id);
        return BasicResult.success();
    }
 
    @Override
    public BasicResult selectPageList(Map map) {
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
        String companyId = sysUserInfo.getCompanyId();
        int pageNum = (int) map.get("pageNum");
        int pageSize = (int) map.get("pageSize");
        map.put("companyId",companyId);
        PageHelper.startPage(pageNum,pageSize);
        return BasicResult.success(
                new PageInfo<>(suMaterialWarehouseMapper.selectPageList(map))
        );
    }
 
    @Override
    public BasicResult selectInfo(Integer id) {
        return BasicResult.success(suMaterialWarehouseMapper.selectInfo(id));
    }
 
    @Override
    public BasicResult selectNewOneByTableNum(Integer tableNum) {
        return BasicResult.success(suMaterialWarehouseMapper.selectNewOneByTableNum(tableNum));
    }
}