package com.kmall.admin.service.impl.mk;

import com.kmall.admin.dao.mk.MkCenterMenuDao;
import com.kmall.admin.entity.mk.MkCenterMenuEntity;
import com.kmall.admin.service.mk.MkCenterMenuService;
import com.kmall.admin.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 营销中心菜单表Service实现类
 *
 * @author huangyq
 * @email admin@qhdswl.com
 * @date 2019-04-15 11:23:38
 */
@Service("mkCenterMenuService")
public class MkCenterMenuServiceImpl implements MkCenterMenuService {
    @Autowired
    private MkCenterMenuDao mkCenterMenuDao;

    @Override
    public MkCenterMenuEntity queryObject(Integer id) {
        return mkCenterMenuDao.queryObject(id);
    }

    @Override
    public List<MkCenterMenuEntity> queryList(Map<String, Object> map) {
        return mkCenterMenuDao.queryList(map);
    }

    @Override
    public List<MkCenterMenuEntity> queryCenterByList(Map<String, Object> map) {
        return mkCenterMenuDao.queryCenterByList(map);
    }

    @Override
    public List<MkCenterMenuEntity> queryListByStore(Map<String, Object> map) {
        return mkCenterMenuDao.queryListByStore(map);
    }
    @Override
    public int queryTotal(Map<String, Object> map) {
        return mkCenterMenuDao.queryTotal(map);
    }

    @Override
    public int save(MkCenterMenuEntity mkCenterMenu) {
        mkCenterMenu.setCreaterSn(ShiroUtils.getUserEntity().getUsername());
        mkCenterMenu.setCreateTime(new Date());
        mkCenterMenu.setModerSn(ShiroUtils.getUserEntity().getUsername());
        mkCenterMenu.setModTime(new Date());
        return mkCenterMenuDao.save(mkCenterMenu);
    }

    @Override
    public int update(MkCenterMenuEntity mkCenterMenu) {
        mkCenterMenu.setCreaterSn(ShiroUtils.getUserEntity().getUsername());
        mkCenterMenu.setCreateTime(new Date());
        mkCenterMenu.setModerSn(ShiroUtils.getUserEntity().getUsername());
        mkCenterMenu.setModTime(new Date());
        return mkCenterMenuDao.update(mkCenterMenu);
    }

    @Override
    public int delete(Integer id) {
        return mkCenterMenuDao.delete(id);
    }

    @Override
    public int deleteBatch(Integer[]ids) {
        return mkCenterMenuDao.deleteBatch(ids);
    }
}
