whycxzp
2023-03-28 aaa2e601eb2a6806e761d4424fcaaf43a95fdcfd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.whyc.service;
 
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.dto.Response;
import com.whyc.mapper.BattScrapMapper;
import com.whyc.pojo.BattScrap;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.util.List;
 
@Service
public class BattScrapService {
 
    @Resource
    private BattScrapMapper mapper;
 
    public Response searchByCondition(int pageNum,int pageSize,BattScrap scrap){
        PageHelper.startPage(pageNum,pageSize);
        List<BattScrap> list = mapper.searchByCondition(scrap);
        PageInfo<BattScrap> pageInfo = new PageInfo<>(list);
        return new Response().set(1,pageInfo,"查询成功");
    }
 
 
    public Response add(BattScrap scrap){
        mapper.insert(scrap);
        return new Response().set(1,true,"添加成功");
    }
}