You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SRuml/TypeService.java

75 lines
1.4 KiB

package com.example.service;
import com.example.entity.Type;
import com.example.mapper.TypeMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 分类信息表业务处理
**/
@Service
public class TypeService {
@Resource
private TypeMapper typeMapper;
/**
* 新增
*/
public void add(Type type) {
typeMapper.insert(type);
}
/**
* 删除
*/
public void deleteById(Integer id) {
typeMapper.deleteById(id);
}
/**
* 批量删除
*/
public void deleteBatch(List<Integer> ids) {
for (Integer id : ids) {
typeMapper.deleteById(id);
}
}
/**
* 修改
*/
public void updateById(Type type) {
typeMapper.updateById(type);
}
/**
* 根据ID查询
*/
public Type selectById(Integer id) {
return typeMapper.selectById(id);
}
/**
* 查询所有
*/
public List<Type> selectAll(Type type) {
return typeMapper.selectAll(type);
}
/**
* 分页查询
*/
public PageInfo<Type> selectPage(Type type, Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum, pageSize);
List<Type> list = typeMapper.selectAll(type);
return PageInfo.of(list);
}
}