郑永安
2023-06-19 f65443d8abeaedc9d102324565e8368e7c9d90c8
src/main/java/com/gk/firework/Service/ServiceImpl/StandardSupplyMarketObjectServiceImpl.java
对比新文件
@@ -0,0 +1,90 @@
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.StandardHiddenDangerLeger;
import com.gk.firework.Domain.StandardSupplyMarketObject;
import com.gk.firework.Domain.UserInfo;
import com.gk.firework.Mapper.StandardSupplyMarketObjectMapper;
import com.gk.firework.Service.StandardSupplyMarketObjectService;
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.Map;
import java.util.List;
@Service("standardSupplyMarketObjectService")
public class StandardSupplyMarketObjectServiceImpl extends ServiceImpl<StandardSupplyMarketObjectMapper, StandardSupplyMarketObject> implements StandardSupplyMarketObjectService {
    @Autowired
    private UserService userService;
    @Autowired
    private StandardSupplyMarketObjectMapper standardSupplyMarketObjectMapper;
    @Override
    public IPage selectPage(Page<StandardSupplyMarketObject> page, Map 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"));
        params.put("menu", filter.get("menu"));
        List<StandardSupplyMarketObject> list  = standardSupplyMarketObjectMapper.selectPages(page, params);
        return page.setRecords(list);
    }
    @Override
    public void addSupplyMarketObject(StandardSupplyMarketObject standardSupplyMarketObject, UserInfo userInfo) {
        UserInfo user = userService.getById(userInfo.getId());
        standardSupplyMarketObject.setCreateby(user.getId());
        standardSupplyMarketObject.setCreatebyname(user.getUsername());
        standardSupplyMarketObject.setCreatetime(new Date());
        standardSupplyMarketObject.setValidflag(true);
        standardSupplyMarketObject.setEnterprisenumber(user.getUsername());
        standardSupplyMarketObject.setEnterprisename(user.getUsername());
        this.save(standardSupplyMarketObject);
    }
    @Override
    public void modSupplyMarketObject(StandardSupplyMarketObject standardSupplyMarketObject, UserInfo user) {
        standardSupplyMarketObject.setUpdateby(user.getId());
        standardSupplyMarketObject.setUpdatetime(new Date());
        standardSupplyMarketObject.setUpdatebyname(user.getUsername());
        this.updateById(standardSupplyMarketObject);
    }
    @Override
    public void delSupplyMarketObject(Long id, UserInfo user) {
        LambdaUpdateWrapper<StandardSupplyMarketObject> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.set(StandardSupplyMarketObject::getValidflag, false)
                .set(StandardSupplyMarketObject::getUpdatetime, new Date())
                .set(StandardSupplyMarketObject::getUpdateby, user.getId())
                .set(StandardSupplyMarketObject::getUpdatebyname,user.getUsername())
                .eq(StandardSupplyMarketObject::getId, id);
        this.update(updateWrapper);
    }
}