package cn.minestar.agriculture.service.impl;

import java.util.List;

import cn.minestar.agriculture.entity.WxMiniLabel;
import cn.minestar.agriculture.mapper.WxMiniLabelMapper;
import cn.minestar.agriculture.service.IWxMiniLabelService;
import cn.minestar.common.utils.DateUtils;
import cn.minestar.weixin.utils.ThirdSessionHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 标签Service业务层处理
 * 
 * @author www.minestar.cn/
 * @date 2021-08-12
 */
@Service
public class WxMiniLabelServiceImpl implements IWxMiniLabelService
{
    @Autowired
    private WxMiniLabelMapper wxMiniLabelMapper;

    /**
     * 查询【请填写功能名称】
     * 
     * @param id 【请填写功能名称】ID
     * @return 【请填写功能名称】
     */
    @Override
    public WxMiniLabel selectWxMiniLabelById(Long id)
    {
        return wxMiniLabelMapper.selectWxMiniLabelById(id);
    }

    /**
     * 查询【请填写功能名称】列表
     * 
     * @param wxMiniLabel 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public List<WxMiniLabel> selectWxMiniLabelList(WxMiniLabel wxMiniLabel)
    {
        return wxMiniLabelMapper.selectWxMiniLabelList(wxMiniLabel);
    }

    /**
     * 新增
     * 
     * @param wxMiniLabel
     * @return 结果
     */
    @Override
    public int insertWxMiniLabel(WxMiniLabel wxMiniLabel)
    {
        String wxUserId = ThirdSessionHolder.getThirdSession().getWxUserId();
        wxMiniLabel.setCreateBy(wxUserId);
        wxMiniLabel.setCreateTime(DateUtils.getNowDate());
        return wxMiniLabelMapper.insert(wxMiniLabel);
    }

    /**
     * 修改
     * 
     * @param wxMiniLabel 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int updateWxMiniLabel(WxMiniLabel wxMiniLabel)
    {
        String wxUserId = ThirdSessionHolder.getThirdSession().getWxUserId();
        wxMiniLabel.setUpdateBy(wxUserId);
        wxMiniLabel.setUpdateTime(DateUtils.getNowDate());
        return wxMiniLabelMapper.updateWxMiniLabel(wxMiniLabel);
    }

    /**
     * 批量删除
     * 
     * @param ids 需要删除的ID
     * @return 结果
     */
    @Override
    public int deleteWxMiniLabelByIds(Long[] ids)
    {
        return wxMiniLabelMapper.deleteWxMiniLabelByIds(ids);
    }

    /**
     * 删除【请填写功能名称】信息
     * 
     * @param id 【请填写功能名称】ID
     * @return 结果
     */
    @Override
    public int deleteWxMiniLabelById(Long id)
    {
        return wxMiniLabelMapper.deleteWxMiniLabelById(id);
    }
}
