package com.jwipc.sys.service.impl;

import cn.hutool.core.date.LocalDateTimeUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jwipc.sys.entity.MoldMove;
import com.jwipc.sys.entity.MoldMove;

import com.jwipc.sys.mapper.MoldMoveMapper;

import com.jwipc.sys.model.po.MoldFormPO;
import com.jwipc.sys.model.po.MoldMovePO;
import com.jwipc.sys.model.query.MoldMoveQuery;
import com.jwipc.sys.service.IMoldMoveService;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author AL
 * @since 2024-02-28
 */
@Service
public class MoldMoveServiceImpl extends ServiceImpl<MoldMoveMapper, MoldMove> implements IMoldMoveService {
    @Override
    public List<MoldMovePO> findPageByQuery(Page<MoldMove> dbPage, MoldMoveQuery query) {
        if (dbPage==null){
            return baseMapper.findPageByQuery(query);
        }
        return baseMapper.findPageByQuery(dbPage,query);
    }
    @Override
    public MoldMovePO getDataById(Long id) {
        MoldMovePO moldMovePO = baseMapper.getDataById(id);
        if(moldMovePO.getCreateTime() != null){
            moldMovePO.setCreateTimeDesc(LocalDateTimeUtil.format(moldMovePO.getCreateTime(),"yyyy-MM-dd"));
        }
        return moldMovePO;
    }
}
