package jnpf.model.personnels.dto.goods;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import jnpf.model.personnels.po.FtbPersonnelsGoodsReceive;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotNull;

@EqualsAndHashCode(callSuper = true)
@Data
public class FtbPersonnelsGoodsReceiveUpdateDTO extends FtbPersonnelsGoodsReceiveAddDTO {
    /**
     * 领取Id
     */
    @NotNull(message = "领取Id不能为空")
    private String id;

    public LambdaUpdateWrapper<FtbPersonnelsGoodsReceive> convert(FtbPersonnelsGoodsReceiveUpdateDTO receiveUpdateDTO) {
        LambdaUpdateWrapper<FtbPersonnelsGoodsReceive> updateWrapper = Wrappers.lambdaUpdate();
        updateWrapper.eq(FtbPersonnelsGoodsReceive::getId, receiveUpdateDTO.getId());
        updateWrapper.set(FtbPersonnelsGoodsReceive::getReceiptTime, receiveUpdateDTO.getReceiptTime());
        updateWrapper.set(FtbPersonnelsGoodsReceive::getRemark, receiveUpdateDTO.getRemark());
        return updateWrapper;
    }

}
