郑永安
2023-09-19 69185134fcfaf913ea45f1255677225a2cc311a4
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package com.gk.hotwork.Service.ServiceImpl;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gk.hotwork.Domain.DictionaryItemInfo;
import com.gk.hotwork.Domain.DictionaryTypeInfo;
import com.gk.hotwork.Domain.Utils.PageInfo;
import com.gk.hotwork.Mapper.DictionaryItemInfoMapper;
import com.gk.hotwork.Service.DictionaryItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.ArrayList;
import java.util.List;
 
@Service("DictionaryItemService")
public class DictionaryItemServiceImpl extends ServiceImpl<DictionaryItemInfoMapper, DictionaryItemInfo> implements DictionaryItemService {
 
    @Autowired
    DictionaryItemInfoMapper dictionaryItemInfoMapper;
 
    @Override
    public void selectDataGrid(PageInfo pageInfo) {
        Page<DictionaryItemInfo> page = new Page<>(pageInfo.getPageIndex(), pageInfo.getPageSize());
        List<OrderItem> orderItems = new ArrayList<>();
        OrderItem orderItem = new OrderItem();
        orderItem.setAsc(true);
        orderItem.setColumn("sort");
        orderItems.add(orderItem);
        page.setOrders(orderItems);
        List<DictionaryItemInfo> list = dictionaryItemInfoMapper.selectDataGrid(page,pageInfo.getCondition());
 
        pageInfo.setResult(list);
        pageInfo.setTotalCount(page.getTotal());
    }
 
    @Override
    public DictionaryItemInfo selctByText(String text) {
        DictionaryItemInfo dictionaryItemInfo = new DictionaryItemInfo();
        dictionaryItemInfo.setText(text);
        QueryWrapper<DictionaryItemInfo> queryWrapper = new QueryWrapper<>(dictionaryItemInfo);
        return dictionaryItemInfoMapper.selectOne(queryWrapper);
    }
 
    @Override
    public DictionaryItemInfo selctByValue(String value) {
        DictionaryItemInfo dictionaryItemInfo = new DictionaryItemInfo();
        dictionaryItemInfo.setValue(value);
        QueryWrapper<DictionaryItemInfo> queryWrapper = new QueryWrapper<>(dictionaryItemInfo);
        return dictionaryItemInfoMapper.selectOne(queryWrapper);
    }
 
    @Override
    public List<DictionaryTypeInfo> selectExistInfo(Long id, String value, String text) {
        return dictionaryItemInfoMapper.selectExistInfo(id,value,text);
    }
 
    @Override
    public List<DictionaryItemInfo> selectByType(String dictionaryType) {
        return dictionaryItemInfoMapper.selectByType(dictionaryType);
    }
}