package com.younike.system.service.impl;

import java.util.List;
import java.time.LocalDateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.younike.system.mapper.PublishAddressMapper;
import com.younike.system.domain.PublishAddress;
import com.younike.system.service.IPublishAddressService;

/**
 * 需求地址Service业务层处理
 * 
 * @author elev
 * @date 2022-01-20
 */
@Service
public class PublishAddressServiceImpl implements IPublishAddressService {
    @Autowired
    private PublishAddressMapper publishAddressMapper;

    /**
     * 查询需求地址
     * 
     * @param publishId 需求地址主键
     * @return 需求地址
     */
    @Override
    public PublishAddress selectPublishAddressByPublishId(Long publishId) {
        return publishAddressMapper.selectPublishAddressByPublishId(publishId);
    }

    /**
     * 查询需求地址列表
     * 
     * @param publishAddress 需求地址
     * @return 需求地址
     */
    @Override
    public List<PublishAddress> selectPublishAddressList(PublishAddress publishAddress) {
        return publishAddressMapper.selectPublishAddressList(publishAddress);
    }

    /**
     * 新增需求地址
     * 
     * @param publishAddress 需求地址
     * @return 结果
     */
    @Override
    public int insertPublishAddress(PublishAddress publishAddress) {
        publishAddress.setCreateTime(LocalDateTime.now());
        return publishAddressMapper.insertPublishAddress(publishAddress);
    }

    /**
     * 修改需求地址
     * 
     * @param publishAddress 需求地址
     * @return 结果
     */
    @Override
    public int updatePublishAddress(PublishAddress publishAddress) {
        publishAddress.setUpdateTime(LocalDateTime.now());
        return publishAddressMapper.updatePublishAddress(publishAddress);
    }

    /**
     * 批量删除需求地址
     * 
     * @param publishIds 需要删除的需求地址主键
     * @return 结果
     */
    @Override
    public int deletePublishAddressByPublishIds(Long[] publishIds) {
        return publishAddressMapper.deletePublishAddressByPublishIds(publishIds);
    }

    /**
     * 删除需求地址信息
     * 
     * @param publishId 需求地址主键
     * @return 结果
     */
    @Override
    public int deletePublishAddressByPublishId(Long publishId)
    {
        return publishAddressMapper.deletePublishAddressByPublishId(publishId);
    }
}
