package com.yunzhupaas.base.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.yunzhupaas.base.entity.VisualdevReleaseEntity;
import com.yunzhupaas.base.mapper.VisualdevReleaseMapper;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.base.service.VisualdevReleaseService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 云筑产品开发平台组
 * @version V3.1.0
 * @copyright 深圳市乐程软件有限公司（http://www.szlecheng.cn）
 * @date 2024/3/16
 */
@Service
public class VisualdevReleaseServiceImpl extends SuperServiceImpl<VisualdevReleaseMapper, VisualdevReleaseEntity> implements VisualdevReleaseService {

	@Override
	public long beenReleased(String id) {
		QueryWrapper<VisualdevReleaseEntity> queryWrapper = new QueryWrapper<>();
		queryWrapper.lambda().eq(VisualdevReleaseEntity::getId, id);
		return this.count(queryWrapper);
	}

	@Override
	public List<VisualdevReleaseEntity> selectorList() {
		QueryWrapper<VisualdevReleaseEntity> queryWrapper = new QueryWrapper<>();
		queryWrapper.lambda().select(
				VisualdevReleaseEntity::getId,
				VisualdevReleaseEntity::getFullName,
				VisualdevReleaseEntity::getWebType,
				VisualdevReleaseEntity::getType,
				VisualdevReleaseEntity::getCategory);
		return this.list(queryWrapper);
	}

	@Override
	public List<VisualdevReleaseEntity> selectByIds(List<String> ids, SFunction<VisualdevReleaseEntity, ?>... columns) {
		QueryWrapper<VisualdevReleaseEntity> queryWrapper = new QueryWrapper<>();
		if (columns != null) {
			queryWrapper.lambda().select(columns);
		} else {
			queryWrapper.lambda().select(
					VisualdevReleaseEntity::getId,
					VisualdevReleaseEntity::getFullName,
					VisualdevReleaseEntity::getWebType,
					VisualdevReleaseEntity::getType,
					VisualdevReleaseEntity::getCategory);
		}
		return this.list(queryWrapper);
	}
}

