package com.ema.admin.modules.system.service.impl;

import cn.hutool.core.util.StrUtil;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.ema.admin.modules.system.entity.SysDictType;
import com.ema.admin.modules.system.mapper.SysDictTypeMapper;
import com.ema.admin.modules.system.service.SysDictTypeService;
import com.ema.admin.modules.system.vo.SysDictTypeQueryVo;
import org.springframework.stereotype.Service;

/**
 * 系统字典类型表 服务层实现。
 *
 * @author lijian
 * @since 2025-07-31
 */
@Service
public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDictType>  implements SysDictTypeService {

    @Override
    public Page<SysDictType> page(SysDictTypeQueryVo queryVo) {
        QueryWrapper queryWrapper = QueryWrapper.create();
        queryWrapper.like(SysDictType::getName, queryVo.getName(), StrUtil.isNotBlank(queryVo.getName()));
        queryWrapper.like(SysDictType::getCode, queryVo.getCode(), StrUtil.isNotBlank(queryVo.getCode()));
        queryWrapper.orderBy(SysDictType::getSort);
        return this.page(new Page<>(queryVo.getPageNumber(), queryVo.getPageSize()), queryWrapper);
    }
}
