whyclxw
2025-05-08 4c0f551e508bce3e853737a57a7cb09c0fbbb56f
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
32
33
34
35
36
37
38
39
40
41
package com.whyc.service;
 
import com.alibaba.druid.sql.PagerUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.whyc.mapper.PageParam2Mapper;
import com.whyc.pojo.PageParam2;
import com.whyc.util.ActionUtil;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.util.List;
 
@Service
public class PageParam2Service {
 
    @Resource
    private PageParam2Mapper mapper;
 
    public List<PageParam2> getList(int categoryId) {
        QueryWrapper<PageParam2> query = Wrappers.query();
        query.eq("categoryId",categoryId);
        return mapper.selectList(query);
 
    }
 
    public PageParam2 getById(int id) {
        return mapper.selectById(id);
    }
 
    public void updateById(PageParam2 param) {
        mapper.updateById(param);
    }
 
    public void updateVisitCount() {
        UpdateWrapper<PageParam2> update = Wrappers.update();
        update.setSql("value=value+1").eq("id",5);
        mapper.update((PageParam2)ActionUtil.objeNull,update);
    }
}