package com.xingxi.business.CopyrightApproval.service.impl;

import com.xingxi.common.core.text.Convert;
import com.xingxi.common.utils.DateUtils;
import com.xingxi.business.CopyrightApproval.domain.CopyrightApproval;
import com.xingxi.business.CopyrightApproval.mapper.CopyrightApprovalMapper;
import com.xingxi.business.CopyrightApproval.service.ICopyrightApprovalService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 著作权申请Service业务层处理
 *
 * @author xingxi
 * @date 2025-03-06
 */
@Service
public class CopyrightApprovalServiceImpl implements ICopyrightApprovalService {
    @Resource
    private CopyrightApprovalMapper copyrightApprovalMapper;

    /**
     * 查询著作权申请
     *
     * @param approvalId 著作权申请主键
     * @return 著作权申请
     */
    @Override
    public CopyrightApproval selectCopyrightApprovalByApprovalId(Long approvalId) {
        return copyrightApprovalMapper.selectCopyrightApprovalByApprovalId(approvalId);
    }

    /**
     * 查询著作权申请列表
     *
     * @param CopyrightApproval 著作权申请
     * @return 著作权申请
     */
    @Override
    public List<CopyrightApproval> selectCopyrightApprovalList(CopyrightApproval CopyrightApproval) {
        return copyrightApprovalMapper.selectCopyrightApprovalList(CopyrightApproval);
    }

    /**
     * 新增著作权申请
     *
     * @param CopyrightApproval 著作权申请
     * @return 结果
     */
    @Override
    public int insertCopyrightApproval(CopyrightApproval CopyrightApproval) {
        CopyrightApproval.setCreateTime(DateUtils.getNowDate());
        return copyrightApprovalMapper.insertCopyrightApproval(CopyrightApproval);
    }

    /**
     * 新增著作权申请
     *
     * @param CopyrightApprovalList 著作权申请
     * @return 结果
     */
    @Override
    public int batchInsertCopyrightApproval(List<CopyrightApproval> CopyrightApprovalList) {
        return copyrightApprovalMapper.batchInsertCopyrightApproval(CopyrightApprovalList);
    }

    /**
     * 修改著作权申请
     *
     * @param CopyrightApproval 著作权申请
     * @return 结果
     */
    @Override
    public int updateCopyrightApproval(CopyrightApproval CopyrightApproval) {
        CopyrightApproval.setUpdateTime(DateUtils.getNowDate());
        return copyrightApprovalMapper.updateCopyrightApproval(CopyrightApproval);
    }

    /**
     * 批量删除著作权申请
     *
     * @param approvalIds 需要删除的著作权申请主键
     * @return 结果
     */
    @Override
    public int deleteCopyrightApprovalByApprovalIds(String approvalIds) {
        return copyrightApprovalMapper.deleteCopyrightApprovalByApprovalIds(Convert.toStrArray(approvalIds));
    }

    /**
     * 删除著作权申请信息
     *
     * @param approvalId 著作权申请主键
     * @return 结果
     */
    @Override
    public int deleteCopyrightApprovalByApprovalId(Long approvalId) {
        return copyrightApprovalMapper.deleteCopyrightApprovalByApprovalId(approvalId);
    }

    /**
     * 逻辑删除著作权申请
     *
     * @param approvalId 著作权申请主键
     * @return 结果
     */
    @Override
    public int logicDeleteCopyrightApprovalByApprovalId(Long approvalId) {
        return copyrightApprovalMapper.logicDeleteCopyrightApprovalByApprovalId(approvalId);
    }

    /**
     * 逻辑批量删除著作权申请
     *
     * @param approvalIds 需要删除的数据主键集合
     * @return 结果
     */
    @Override
    public int logicDeleteCopyrightApprovalByApprovalIds(String[] approvalIds) {
        return copyrightApprovalMapper.logicDeleteCopyrightApprovalByApprovalIds(approvalIds);
    }

    /**
     * 逻辑批量删除著作权申请
     *
     * @param CopyrightApproval 著作权申请
     * @return 结果
     */
    @Override
    public int logicDeleteCopyrightApprovalByCondition(CopyrightApproval CopyrightApproval) {
        return copyrightApprovalMapper.logicDeleteCopyrightApprovalByCondition(CopyrightApproval);
    }
}
