package com.palmnest.dao.airconditioner.impl;

import com.palmnest.dao.airconditioner.ConditionerAddTimeOrderExtendDao;
import com.palmnest.dao.hibernate.GenericDaoHibernate;
import com.palmnest.model.airconditioner.AirConditionerAddTimeOrderExtend;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Repository;

/**
 * @author xc
 * @since 2023/8/9 09:42
 */
@Repository("conditionerAddTimeOrderExtendDao")
public class ConditionerAddTimeOrderExtendDaoImpl extends GenericDaoHibernate<AirConditionerAddTimeOrderExtend, Long> implements ConditionerAddTimeOrderExtendDao {
    private final Logger logger = Logger.getLogger(ConditionerAddTimeOrderExtendDaoImpl.class);
    public ConditionerAddTimeOrderExtendDaoImpl() {
        super(AirConditionerAddTimeOrderExtend.class);
    }

    @Override
    public AirConditionerAddTimeOrderExtend getByOrderNo(String orderNo) {
        String sql = "select * from tb_airconditioner_addtime_order_extend where code = ?";
        logger.info("根据空调加时订单获取扩展信息 sql: " + sql);
        return (AirConditionerAddTimeOrderExtend) getSession().createSQLQuery(sql).addEntity(AirConditionerAddTimeOrderExtend.class).setString(0, orderNo).uniqueResult();
    }
}
