All Downloads are FREE. Search and download functionalities are using the official Maven repository.

k.e.book.ddh.service.CcDrawConfigService Maven / Gradle / Ivy


package k.e.book.ddh.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import k.e.book.ddh.entity.CcDrawConfigDO;
import k.e.book.ddh.entity.CcDrawConfigQueryDTO;
import k.e.book.ddh.mapper.CcDrawConfigMapper;
import org.springframework.stereotype.Service;

/**
 * @author kk
 * @date 2023-05-21 11:04
 */
@Service
public class CcDrawConfigService extends ServiceImpl {

    /**
     *
     * @param relation_product_id
     * @param type
     * @param status
     * @return
     */
    public CcDrawConfigDO findByNotify(Integer relation_product_id, Integer type, Integer status) {
        LambdaQueryWrapper qr = new LambdaQueryWrapper<>();
        qr.eq(CcDrawConfigDO::getRelationProductId, relation_product_id).eq(CcDrawConfigDO::getType, type)
                .eq(CcDrawConfigDO::getStatus, status).last("limit 1");
        return this.getOne(qr);
    }

    public IPage selectProductPage(CcDrawConfigQueryDTO dto) {
        LambdaQueryWrapper qr = new LambdaQueryWrapper<>();

        if (dto.getId() != null) {
            qr.eq(CcDrawConfigDO::getId, dto.getId());
        }
        if (dto.getName() != null) {
            qr.eq(CcDrawConfigDO::getName, dto.getName());
        }
        if (dto.getType() != null) {
            qr.eq(CcDrawConfigDO::getType, dto.getType());
        }
        if (dto.getRelationProductId() != null) {
            qr.eq(CcDrawConfigDO::getRelationProductId, dto.getRelationProductId());
        }
        if (dto.getRelationBoxId() != null) {
            qr.eq(CcDrawConfigDO::getRelationBoxId, dto.getRelationBoxId());
        }
        if (dto.getRelationZgId() != null) {
            qr.eq(CcDrawConfigDO::getRelationZgId, dto.getRelationZgId());
        }
        if (dto.getStatus() != null) {
            qr.eq(CcDrawConfigDO::getStatus, dto.getStatus());
        }
        if (dto.getOpenStatus() != null) {
            qr.eq(CcDrawConfigDO::getOpenStatus, dto.getOpenStatus());
        }
        if (dto.getMaxDrawNum() != null) {
            qr.eq(CcDrawConfigDO::getMaxDrawNum, dto.getMaxDrawNum());
        }
        if (dto.getWinnerNum() != null) {
            qr.eq(CcDrawConfigDO::getWinnerNum, dto.getWinnerNum());
        }
        if (dto.getStartTime() != null) {
            qr.eq(CcDrawConfigDO::getStartTime, dto.getStartTime());
        }
        if (dto.getEndTime() != null) {
            qr.eq(CcDrawConfigDO::getEndTime, dto.getEndTime());
        }
        if (dto.getOpenTime() != null) {
            qr.eq(CcDrawConfigDO::getOpenTime, dto.getOpenTime());
        }
        if (dto.getCreatetime() != null) {
            qr.eq(CcDrawConfigDO::getCreatetime, dto.getCreatetime());
        }
        if (dto.getUpdatetime() != null) {
            qr.eq(CcDrawConfigDO::getUpdatetime, dto.getUpdatetime());
        }
        if (dto.getDeletetime() != null) {
            qr.eq(CcDrawConfigDO::getDeletetime, dto.getDeletetime());
        }
        if (dto.getCreatedAt() != null) {
            qr.eq(CcDrawConfigDO::getCreatedAt, dto.getCreatedAt());
        }
        if (dto.getUpdatedAt() != null) {
            qr.eq(CcDrawConfigDO::getUpdatedAt, dto.getUpdatedAt());
        }
        if (dto.getDeletedAt() != null) {
            qr.eq(CcDrawConfigDO::getDeletedAt, dto.getDeletedAt());
        }

        qr.orderByDesc(CcDrawConfigDO::getId);
        IPage page = new Page<>();
        page.setCurrent(dto.getPage());
        page.setSize(dto.getLimit());
        return baseMapper.selectPage(page, qr);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy