package com.gk.firework.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.firework.Domain.DictionaryTypeInfo; import com.gk.firework.Domain.Utils.PageInfo; import com.gk.firework.Domain.Utils.StringUtils; import com.gk.firework.Mapper.DictionaryTypeInfoMapper; import com.gk.firework.Service.DictionaryTypeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; @Service("DictionaryTypeService") public class DictionaryTypeServiceImpl extends ServiceImpl implements DictionaryTypeService { @Autowired DictionaryTypeInfoMapper dictionaryTypeInfoMapper; @Override public void selectDataGrid(PageInfo pageInfo) { Page page = new Page<>(pageInfo.getPageIndex(), pageInfo.getPageSize()); List orderItems = new ArrayList<>(); OrderItem orderItem = new OrderItem(); orderItem.setAsc(false); orderItem.setColumn("createddate"); orderItems.add(orderItem); page.setOrders(orderItems); List list = dictionaryTypeInfoMapper.selectDataGrid(page,pageInfo.getCondition()); pageInfo.setResult(list); pageInfo.setTotalCount(page.getTotal()); } @Override public DictionaryTypeInfo selctByCode(String code) { DictionaryTypeInfo dictionaryTypeInfo = new DictionaryTypeInfo(); dictionaryTypeInfo.setCode(code); dictionaryTypeInfo.setStatus((byte)1); QueryWrapper queryWrapper = new QueryWrapper<>(dictionaryTypeInfo); return dictionaryTypeInfoMapper.selectOne(queryWrapper); } @Override public DictionaryTypeInfo selctByText(String text) { DictionaryTypeInfo dictionaryTypeInfo = new DictionaryTypeInfo(); dictionaryTypeInfo.setText(text); dictionaryTypeInfo.setStatus((byte)1); QueryWrapper queryWrapper = new QueryWrapper<>(dictionaryTypeInfo); return dictionaryTypeInfoMapper.selectOne(queryWrapper); } @Override public List selectExistInfo(Long id, String code, String text) { return dictionaryTypeInfoMapper.selectExistInfo(id, code, text); } }