package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi;

import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesEnumDetailService;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.mes.bean.MesEnumDetail;
import cn.estsh.i3plus.pojo.mes.repository.MesEnumDetailRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @Description : 枚举明细配置
 * @Reference :
 * @Author : junsheng.li
 * @CreateDate 2024/6/9 19:20
 * @Modify:
 **/
@Service
@Slf4j
public class MesEnumDetailServiceImpl implements IMesEnumDetailService {

    @Autowired
    private MesEnumDetailRepository mesEnumDetailRDao;

    @Override
    public List<MesEnumDetail> findMesEnumDetail(MesEnumDetail mesEnumDetail) {
        DdlPackBean packBean = DdlPackBean.getDdlPackBean(mesEnumDetail.getOrganizeCode());
        DdlPreparedPack.getStringEqualPack(mesEnumDetail.getEnumCode(), "enumCode", packBean);
        DdlPreparedPack.getStringEqualPack(mesEnumDetail.getDetailCode(), "detailCode", packBean);
        DdlPreparedPack.getStringEqualPack(mesEnumDetail.getDetailName(), "detailName", packBean);
        DdlPreparedPack.getStringEqualPack(mesEnumDetail.getDetailValue(), "detailValue", packBean);
        return mesEnumDetailRDao.findByHqlWhere(packBean);
    }
}
