package com.chaozhanggui.admin.system.service;

import com.chaozhanggui.common.system.config.RespBody;
import com.chaozhanggui.dao.system.dao.TbPlussAppMenuMapper;
import com.chaozhanggui.dao.system.entity.TbPlussAppGuide;
import com.chaozhanggui.dao.system.entity.TbPlussAppMenu;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


/**
 * @author lyf
 */
@Service
@Slf4j
public class AppMenuService {
    @Resource
    private TbPlussAppMenuMapper appMenuMapper;
    public RespBody getAppMenuList(Integer pageNum, Integer pageSize){
        PageHelper.startPage(pageNum, pageSize);
        List<TbPlussAppMenu> appGuides = appMenuMapper.selectAppMenuList();
        PageInfo pageInfo=new PageInfo(appGuides);
        return new RespBody("000000",pageInfo);
    }
    public RespBody saveAppMenu(TbPlussAppMenu entity){
        int insert = appMenuMapper.insertSelective(entity);
        if (insert>0) {
            return new RespBody("000000");
        }
        log.error("增加错误");
        return new RespBody("000052");
    }
    public RespBody updateAppMenu(TbPlussAppMenu entity){
        int insert = appMenuMapper.insertSelective(entity);
        if (insert>0) {
            return new RespBody("000000");
        }
        log.error("增加错误");
        return new RespBody("000052");
    }
}
