| | |
| | | package com.ruoyi.system.service.impl.config; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.system.domain.dto.MgtBannerEditDto; |
| | | import com.ruoyi.system.domain.pojo.config.Banner; |
| | | import com.ruoyi.system.domain.vo.AppBannerVo; |
| | | import com.ruoyi.system.domain.vo.MgtBannerPageVo; |
| | | import com.ruoyi.system.mapper.config.BannerMapper; |
| | | import com.ruoyi.system.service.config.BannerService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | return bannerMapper.listHomeBannerVo(); |
| | | } |
| | | |
| | | /** |
| | | * @description 修改banner |
| | | * @author jqs |
| | | * @date 2023/6/6 14:58 |
| | | * @param mgtBannerEditDto |
| | | * @return void |
| | | */ |
| | | @Override |
| | | public void editBanner(MgtBannerEditDto mgtBannerEditDto) { |
| | | Banner banner; |
| | | // 如果横幅ID不为空,则根据ID获取横幅信息 |
| | | if (mgtBannerEditDto.getBannerId() != null) { |
| | | banner = this.getById(mgtBannerEditDto.getBannerId()); |
| | | } else { // 否则新建一个横幅对象,并设置删除标志为0 |
| | | banner = new Banner(); |
| | | banner.setDelFlag(0); |
| | | } |
| | | // 将DTO中的属性值复制到横幅对象中 |
| | | BeanUtils.copyProperties(mgtBannerEditDto, banner); |
| | | // 设置创建用户ID和创建时间 |
| | | banner.setCreateUserId(mgtBannerEditDto.getUserId()); |
| | | banner.setCreateTime(new Date()); |
| | | // 保存或更新横幅信息 |
| | | this.saveOrUpdate(banner); |
| | | } |
| | | |
| | | /** |
| | | * @description 平台分页获取banner |
| | | * @author jqs |
| | | * @date 2023/6/6 15:22 |
| | | * @param page |
| | | * @return List<MgtBannerPageVo> |
| | | */ |
| | | @Override |
| | | public List<MgtBannerPageVo> pageMgtBannerVo(Page page){ |
| | | List<MgtBannerPageVo> mgtBannerPageVoList = bannerMapper.pageMgtBannerVo(page); |
| | | return mgtBannerPageVoList; |
| | | } |
| | | } |