package com.template.services.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.template.mapper.SmartAuthorGroupMapper;
import com.template.model.pojo.SmartAuthorGroup;
import com.template.model.pojo.SmartAuthorGroup;
import com.template.mapper.SmartAuthorGroupMapper;
import com.template.model.result.PageUtils;
import com.template.services.SmartAuthorGroupService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.List;
/**
*
* 服务实现类
*
*
* @author ceshi
* @since 2023-12-04
*/
@Service
public class SmartAuthorGroupServiceImpl extends ServiceImpl implements SmartAuthorGroupService {
@Autowired
private SmartAuthorGroupMapper smartAuthorGroupMapper;
@Override
public int insertSmartAuthorGroup(SmartAuthorGroup sa) {
int result = smartAuthorGroupMapper.insert(sa);
return result;
}
@Override
public int updateSmartAuthorGroup(SmartAuthorGroup sa) {
int result = smartAuthorGroupMapper.updateById(sa);
return result;
}
@Override
public PageUtils queryPageSmartAuthorGroups(int currentPage, int pageCount, String name) {
Page page = new Page<>(currentPage, pageCount);
QueryWrapper queryWrapper = new QueryWrapper<>();
//queryWrapper.like(StringUtils.hasText(name), "name", name);
IPage result = smartAuthorGroupMapper.selectPage(page,queryWrapper);
return new PageUtils<>(result);
}
@Override
public int deleteSmartAuthorGroupById(int id) {
int result = smartAuthorGroupMapper.deleteById(id);
return result;
}
@Override
public SmartAuthorGroup getSmartById(int id) {
SmartAuthorGroup result = smartAuthorGroupMapper.selectById(id);
return result;
}
}