package com.hxhq.business.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hxhq.system.api.domain.SysUser;
import org.springframework.stereotype.Service;
import com.hxhq.business.mapper.GspRkjlJcgjMapper;
import com.hxhq.business.domain.GspRkjlJcgj;
import com.hxhq.business.service.IGspRkjlJcgjService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 供试品入库记录-稽查轨迹Service业务层处理
 *
 * @author hxhq
 * @date 2025-12-30
 */
@Service
public class GspRkjlJcgjServiceImpl extends ServiceImpl<GspRkjlJcgjMapper, GspRkjlJcgj> implements IGspRkjlJcgjService
{
    /**
     * 查询供试品入库记录-稽查轨迹列表
     *
     * @param gspRkjlJcgj 供试品入库记录-稽查轨迹
     * @return 供试品入库记录-稽查轨迹
     */
    @Override
    public List<GspRkjlJcgj> queryList(GspRkjlJcgj gspRkjlJcgj)
    {
        QueryWrapper<GspRkjlJcgj> queryWrapper = Wrappers.query();
        if(gspRkjlJcgj.getGspRkjlId() != null) {
            queryWrapper.eq("gsp_rkjl_id", gspRkjlJcgj.getGspRkjlId());
        }
        queryWrapper.orderByDesc("id");
        return this.list(queryWrapper);
    }

    @Override
    public void saveJcgj(Long  gspRkjlId, Integer jcgjlx, String jcmc, String jcmcEn, Integer jcmcys, String jcnr, String jcnrEn, SysUser qmr) {
        GspRkjlJcgj gspRkjlJcgj = new GspRkjlJcgj();
        gspRkjlJcgj.setGspRkjlId(gspRkjlId);
        gspRkjlJcgj.setJcgjlx(jcgjlx);
        gspRkjlJcgj.setJcmc(jcmc);
        gspRkjlJcgj.setJcmcEn(jcmcEn);
        gspRkjlJcgj.setJcmcys(jcmcys);
        gspRkjlJcgj.setJcnr(jcnr);
        gspRkjlJcgj.setJcnrEn(jcnrEn);
        gspRkjlJcgj.setQmrId(qmr.getUserId());
        gspRkjlJcgj.setQmrMc(qmr.getNickName());
        gspRkjlJcgj.setQmrMcEn(qmr.getUserName());
        this.save(gspRkjlJcgj);
    }

}
