package com.gk.firework.Service.ServiceImpl;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.gk.firework.Domain.StandardDeviceToolsLeger;
|
import com.gk.firework.Domain.StandardProductLeger;
|
import com.gk.firework.Domain.UserInfo;
|
import com.gk.firework.Mapper.StandProductLegerMapper;
|
import com.gk.firework.Service.StandardProductLegerService;
|
import com.gk.firework.Service.UserService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import java.util.Date;
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
|
@Service("standardProductLegerService")
|
public class StandardProductLegerServiceImpl extends ServiceImpl<StandProductLegerMapper, StandardProductLeger> implements StandardProductLegerService {
|
|
@Autowired
|
private UserService userService;
|
@Autowired
|
private StandProductLegerMapper standProductLegerMapper;
|
|
@Override
|
public IPage selectPage(Page<StandardProductLeger> page, Map<String, Object> filter, UserInfo userInfo) {
|
|
UserInfo user = userService.getById(userInfo.getId());
|
Map<String, Object> params = new HashMap<>();
|
//菜单
|
//可视权限
|
{
|
params.put("enterprisenumber", user.getCompanynumber());
|
params.put("province", user.getProvince());
|
params.put("city", user.getCity());
|
params.put("district", user.getArea());
|
params.put("street", user.getTown());
|
params.put("committee", user.getCommunity());
|
}
|
|
params.put("filterProvince", filter.get("province"));
|
params.put("filterCity", filter.get("city"));
|
params.put("filterDistrict", filter.get("district"));
|
params.put("filterStreet", filter.get("street"));
|
params.put("filterCommittee", filter.get("committee"));
|
params.put("safetysupervision", filter.get("safetysupervision"));
|
params.put("enterprisename", filter.get("enterprisename"));
|
List<StandardProductLeger> standardProductLegers = standProductLegerMapper.selectPages(page, params);
|
|
return page.setRecords(standardProductLegers);
|
}
|
|
|
|
@Override
|
public void addProductLeger(StandardProductLeger standardProductLeger, UserInfo userInfo) {
|
UserInfo user = userService.getById(userInfo.getId());
|
standardProductLeger.setCreateby(user.getId());
|
standardProductLeger.setCreatebyname(user.getUsername());
|
standardProductLeger.setCreatetime(new Date());
|
standardProductLeger.setValidflag(true);
|
standardProductLeger.setEnterprisenumber(user.getUsername());
|
standardProductLeger.setEnterprisename(user.getUsername());
|
this.save(standardProductLeger);
|
}
|
|
@Override
|
public void modProductLeger(StandardProductLeger standardProductLeger, UserInfo user) {
|
|
standardProductLeger.setUpdatebyname(user.getUsername());
|
standardProductLeger.setUpdatetime(new Date());
|
standardProductLeger.setUpdateby(user.getId());
|
this.updateById(standardProductLeger);
|
}
|
|
@Override
|
public void delProductLeger(Long id, UserInfo user) {
|
LambdaUpdateWrapper<StandardProductLeger> updateWrapper = new LambdaUpdateWrapper<>();
|
updateWrapper.set(StandardProductLeger::getValidflag, false)
|
.set(StandardProductLeger::getUpdatetime, new Date())
|
.set(StandardProductLeger::getUpdateby, user.getId())
|
.set(StandardProductLeger::getUpdatebyname,user.getUsername())
|
.eq(StandardProductLeger::getId, id);
|
this.update(updateWrapper);
|
}
|
}
|