package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.assets.CommunityAssets;
import com.ruoyi.system.mapper.CommunityAssetsMapper;
import com.ruoyi.system.service.ICommunityAssetsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 社区资产Service业务层处理
 * 
 * @author boman
 * @date 2025-02-14
 */
@Service
public class CommunityAssetsServiceImpl implements ICommunityAssetsService 
{
    @Autowired
    private CommunityAssetsMapper communityAssetsMapper;

    /**
     * 查询社区资产
     * 
     * @param assetId 社区资产主键
     * @return 社区资产
     */
    @Override
    public CommunityAssets selectCommunityAssetsByAssetId(Long assetId)
    {
        return communityAssetsMapper.selectCommunityAssetsByAssetId(assetId);
    }

    /**
     * 查询社区资产列表
     * 
     * @param communityAssets 社区资产
     * @return 社区资产
     */
    @Override
    public List<CommunityAssets> selectCommunityAssetsList(CommunityAssets communityAssets)
    {
        return communityAssetsMapper.selectCommunityAssetsList(communityAssets);
    }

    /**
     * 新增社区资产
     * 
     * @param communityAssets 社区资产
     * @return 结果
     */
    @Override
    public int insertCommunityAssets(CommunityAssets communityAssets)
    {
        communityAssets.setCreateTime(DateUtils.getNowDate());
        return communityAssetsMapper.insertCommunityAssets(communityAssets);
    }

    /**
     * 修改社区资产
     * 
     * @param communityAssets 社区资产
     * @return 结果
     */
    @Override
    public int updateCommunityAssets(CommunityAssets communityAssets)
    {
        communityAssets.setUpdateTime(DateUtils.getNowDate());
        return communityAssetsMapper.updateCommunityAssets(communityAssets);
    }

    /**
     * 批量删除社区资产
     * 
     * @param assetIds 需要删除的社区资产主键
     * @return 结果
     */
    @Override
    public int deleteCommunityAssetsByAssetIds(Long[] assetIds)
    {
        return communityAssetsMapper.deleteCommunityAssetsByAssetIds(assetIds);
    }

    /**
     * 删除社区资产信息
     * 
     * @param assetId 社区资产主键
     * @return 结果
     */
    @Override
    public int deleteCommunityAssetsByAssetId(Long assetId)
    {
        return communityAssetsMapper.deleteCommunityAssetsByAssetId(assetId);
    }
}
