rentaiming
2024-06-26 60f51255fca3538ee188bdba723bc972b2f5e70a
ruoyi-modules/ruoyi-management/src/main/java/com/ruoyi/management/service/impl/SlStoreManagementImgServiceImpl.java
@@ -1,6 +1,13 @@
package com.ruoyi.management.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.utils.page.PageDTO;
import com.ruoyi.management.domain.SlStoreManagement;
import com.ruoyi.management.domain.SlStoreManagementImg;
import com.ruoyi.management.domain.dto.StoreManagementimgDTO;
import com.ruoyi.management.domain.dto.StoreManagementimgQuery;
import com.ruoyi.management.mapper.SlStoreManagementImgMapper;
import com.ruoyi.management.service.SlStoreManagementImgService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -17,4 +24,37 @@
@Service
public class SlStoreManagementImgServiceImpl extends ServiceImpl<SlStoreManagementImgMapper, SlStoreManagementImg> implements SlStoreManagementImgService {
    @Override
    public void addStoreManagementimg(StoreManagementimgDTO storeManagementimgDTO) {
            if (storeManagementimgDTO.getId()==null){
                SlStoreManagementImg slStoreManagementImg=new SlStoreManagementImg();
                slStoreManagementImg.setStoreManagementId(storeManagementimgDTO.getStoreManagementId());
                slStoreManagementImg.setStoreManagementNumber(storeManagementimgDTO.getStoreManagementNumber());
                slStoreManagementImg.setImgUrl(storeManagementimgDTO.getImgUrl());
                this.save(slStoreManagementImg);
            }else {
                SlStoreManagementImg slStoreManagementImg = this.getById(storeManagementimgDTO.getId());
                if (storeManagementimgDTO.getStoreManagementId()!=null){
                    slStoreManagementImg.setStoreManagementId(storeManagementimgDTO.getStoreManagementId());
                }
                if (storeManagementimgDTO.getStoreManagementNumber()!=null){
                slStoreManagementImg.setStoreManagementNumber(storeManagementimgDTO.getStoreManagementNumber());
                }
                if (storeManagementimgDTO.getImgUrl()!=null){
                    slStoreManagementImg.setImgUrl(storeManagementimgDTO.getImgUrl());
                }
                this.updateById(slStoreManagementImg);
            }
    }
    @Override
    public SlStoreManagementImg getStoreManagementimgOne(StoreManagementimgQuery storeManagementimgQuery) {
        LambdaQueryWrapper< SlStoreManagementImg> wrapper= Wrappers.lambdaQuery();
        wrapper.eq(SlStoreManagementImg::getStoreManagementId,storeManagementimgQuery.getStoreManagementId());
        wrapper.eq(SlStoreManagementImg::getStoreManagementNumber,storeManagementimgQuery.getStoreManagementNumber());
        wrapper.eq( SlStoreManagementImg::getDelFlag,0);
        wrapper.orderByDesc(SlStoreManagementImg::getCreateTime);
        SlStoreManagementImg page1 = this.getOne(wrapper);
        return page1;
    }
}