package com.yonge.cooleshow.biz.dal.service.impl;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.beans.BeanUtils;
import lombok.extern.slf4j.Slf4j;
import com.yonge.cooleshow.biz.dal.entity.WxConfigInfo;
import com.yonge.cooleshow.biz.dal.wrapper.WxConfigInfoWrapper;
import com.yonge.cooleshow.biz.dal.mapper.WxConfigInfoMapper;
import com.yonge.cooleshow.biz.dal.service.WxConfigInfoService;

/**
 * 微信配置信息
 * 2023-07-21 17:32:49
 */
@Slf4j
@Service
public class WxConfigInfoServiceImpl extends ServiceImpl<WxConfigInfoMapper, WxConfigInfo> implements WxConfigInfoService {

	/**
     * 查询详情
     * @param id 详情ID
     * @return WxConfigInfo
     */
	@Override
    public WxConfigInfo detail(Long id) {
        
        return baseMapper.selectById(id);
    }
    
    /**
     * 分页查询
     * @param page IPage<WxConfigInfo>
     * @param query WxConfigInfoWrapper.WxConfigInfoQuery
     * @return IPage<WxConfigInfo>
     */
    @Override
    public IPage<WxConfigInfo> selectPage(IPage<WxConfigInfo> page, WxConfigInfoWrapper.WxConfigInfoQuery query) {
        
        return page.setRecords(baseMapper.selectPage(page, query));
    }
	
    /**
     * 添加
     * @param wxConfigInfo WxConfigInfoWrapper.WxConfigInfo
     * @return Boolean
     */
    @Override
    public Boolean add(WxConfigInfoWrapper.WxConfigInfo wxConfigInfo) {    	
        
        return this.save(JSON.parseObject(wxConfigInfo.jsonString(), WxConfigInfo.class));
    }

    /**
     * 更新
     * @param wxConfigInfo WxConfigInfoWrapper.WxConfigInfo
     * @return Boolean
     */
    @Override
    public Boolean update(WxConfigInfoWrapper.WxConfigInfo wxConfigInfo){

        return this.updateById(JSON.parseObject(wxConfigInfo.jsonString(), WxConfigInfo.class));       
    }
}