maven
昨天 6047f24edc72a13b71813c3fb6cc0d087c0f6cd7
basic-server/src/main/java/com/ruoyi/basic/service/impl/SupplyServiceImpl.java
@@ -10,6 +10,8 @@
import com.ruoyi.basic.mapper.SupplyMapper;
import com.ruoyi.basic.service.SupplyService;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
@@ -65,6 +67,21 @@
    public int addOrEditSupply(SupplyDto supplyDto) {
        Supply supply = new Supply();
        BeanUtils.copyProperties(supplyDto, supply);
        if (supplyDto.getBids() != null && supplyDto.getBids().size() == 3) {
            supply.setBProvinceId(supplyDto.getBids().get(0));
            supply.setBCityId(supplyDto.getBids().get(1));
            supply.setBDistrictId(supplyDto.getBids().get(2));
        }
        if (supplyDto.getCids() != null && supplyDto.getCids().size() == 3) {
            supply.setCProvinceId(supplyDto.getCids().get(0));
            supply.setCCityId(supplyDto.getCids().get(1));
            supply.setCDistrictId(supplyDto.getCids().get(2));
        }
        if (Objects.isNull(supplyDto.getId())) {
            return supplyMapper.insert(supply);
        } else {
@@ -87,6 +104,19 @@
    }
    @Override
    public void supplyExport(HttpServletResponse response, SupplyDto supplyDto) {
        List<Long> ids = supplyDto.getIds();
        List<Supply> list;
        if (ids != null && ids.size() > 0) {
            list = supplyMapper.selectByIds(ids);
        } else {
            list = supplyMapper.selectList(null);
        }
        ExcelUtil<Supply> util = new ExcelUtil<>(Supply.class);
        util.exportExcel(response, list, "供应商数据");
    }
    @Override
    public List<Supply> supplyList() {
        return supplyMapper.selectList(null);
    }