package com.ruoyi.system.service.impl;

import java.util.List;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.PropertyMapper;
import com.ruoyi.system.domain.Property;
import com.ruoyi.system.service.IPropertyService;

/**
 * 资产表 服务实现
 *
 * @author ruoyi
 */
@Service
public class PropertyServiceImpl implements IPropertyService
{
    @Autowired
    private PropertyMapper propertyMapper;

    /**
     * 查询资产集合
     *
     * @param property 资产信息
     * @return 资产集合
     */
    @Override
    public List<Property> selectPropertyList(Property property)
    {
        return propertyMapper.selectPropertyList(property);
    }

    /**
     * 分页查询资产集合
     *
     * @param property 资产信息
     * @return 分页数据
     */
    @Override
    public TableDataInfo selectPropertyListByPage(Property property, Integer pageNum, Integer pageSize)
    {
        if (pageNum == null) pageNum = 1;
        if (pageSize == null) pageSize = 10;
        PageHelper.startPage(pageNum, pageSize);
        List<Property> list = propertyMapper.selectPropertyList(property);
        PageInfo<Property> pageInfo = new PageInfo<>(list);
        return new TableDataInfo(list, pageInfo.getTotal());
    }

    /**
     * 根据ID查询资产信息
     *
     * @param id 主键ID
     * @return 资产信息
     */
    @Override
    public Property selectPropertyById(Long id)
    {
        return propertyMapper.selectPropertyById(id);
    }

    /**
     * 新增资产信息
     *
     * @param property 资产信息
     * @return 结果
     */
    @Override
    public int insertProperty(Property property)
    {
        return propertyMapper.insertProperty(property);
    }

    /**
     * 修改资产信息
     *
     * @param property 资产信息
     * @return 结果
     */
    @Override
    public int updateProperty(Property property)
    {
        return propertyMapper.updateProperty(property);
    }

    /**
     * 删除资产信息
     *
     * @param id 主键ID
     * @return 结果
     */
    @Override
    public int deletePropertyById(Long id)
    {
        return propertyMapper.deletePropertyById(id);
    }

    /**
     * 批量删除资产信息
     *
     * @param ids 需要删除的主键ID数组
     * @return 结果
     */
    @Override
    public int deletePropertyByIds(Long[] ids)
    {
        return propertyMapper.deletePropertyByIds(ids);
    }
}