package com.njzscloud.supervisory.biz.service;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njzscloud.common.mp.support.PageParam;
import com.njzscloud.common.mp.support.PageResult;
import com.njzscloud.supervisory.biz.mapper.BizProjectMapper;
import com.njzscloud.supervisory.biz.pojo.entity.BizProjectEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 项目信息
 */
@Slf4j
@Service
public class BizProjectService extends ServiceImpl<BizProjectMapper, BizProjectEntity> implements IService<BizProjectEntity> {

    /**
     * 新增
     */
    public void add(BizProjectEntity bizProjectEntity) {
        this.save(bizProjectEntity);
    }

    /**
     * 修改
     */
    public void modify(BizProjectEntity bizProjectEntity) {
        this.updateById(bizProjectEntity);
    }

    /**
     * 删除
     */
    @Transactional(rollbackFor = Exception.class)
    public void del(List<Long> ids) {
        this.removeBatchByIds(ids);
    }

    /**
     * 详情
     */
    public BizProjectEntity detail(Long id) {
        return this.getById(id);
    }

    /**
     * 分页查询
     */
    public PageResult<BizProjectEntity> paging(PageParam pageParam, BizProjectEntity bizProjectEntity) {
        return PageResult.of(this.page(pageParam.toPage(), Wrappers.<BizProjectEntity>query(bizProjectEntity)));
    }

}
