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.UUIDUtils;
|
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.apache.commons.lang3.StringUtils;
|
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();
|
String id = suMaterialWarehouseEntity.getId();
|
if(StringUtils.isNotBlank(id)){
|
suMaterialWarehouseEntity.setUpdateTime(new Date());
|
suMaterialWarehouseEntity.setUpdateUser(userId);
|
}
|
suMaterialWarehouseEntity.setId(UUIDUtils.create());
|
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));
|
}
|
}
|