package com.chinacreator.videoalliance.order.dao; import com.chinacreator.common.support.cache.annotation.CacheName; import com.chinacreator.videoalliance.order.bean.SPInfo; import com.frameworkset.common.poolman.SQLExecutor; import java.sql.SQLException; import java.util.List; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Component; @Component @CacheName("SPDao") public class SPDao { @Cacheable(value={"SPDao"}, key="'findByCP-' + #cpid") public List findByCP(String cpid) throws SQLException { String sql = "select cpid, spid, spname, price, vacproductid, spcode, type, feetype, cancancelorder, canorder,mutex,relationSp from tb_sp_info where cpid=?"; return SQLExecutor.queryListWithDBName(SPInfo.class, "net3g", sql, new Object[] { cpid }); } @Cacheable(value={"SPDao"}, key="'findDefaultByCP-' + #cpid") public SPInfo findDefaultByCP(String cpid) throws SQLException { String sql = "select cpid, spid, spname, price, vacproductid, spcode, type, feetype, cancancelorder, canorder,duration,canaccumulation,mutex,relationSp, paytype from tb_sp_info where cpid=? and isdefault=1"; return (SPInfo)SQLExecutor.queryObjectWithDBName(SPInfo.class, "net3g", sql, new Object[] { cpid }); } @Cacheable(value={"SPDao"}, key="'findFlowerByCP-' + #cpid") public SPInfo findFlowerByCP(String cpid) throws SQLException { String sql = "select cpid, spid, spname, price, vacproductid, spcode, type, feetype, cancancelorder, canorder,errorhandle,paytype from tb_sp_info where cpid=? and type=6"; return (SPInfo)SQLExecutor.queryObjectWithDBName(SPInfo.class, "net3g", sql, new Object[] { cpid }); } @Cacheable(value={"SPDao"}, key="'findById-' + #spid") public SPInfo findById(String spid) throws SQLException { String sql = "select cpid, spid, spname, price, vacproductid, spcode, type, feetype, cancancelorder, canorder,errorhandle,duration,canaccumulation,mutex,relationSp,paytype,needUnifiedAuthSync,spcodename,haslocal,directype from tb_sp_info where spid=?"; return (SPInfo)SQLExecutor.queryObjectWithDBName(SPInfo.class, "net3g", sql, new Object[] { spid }); } @Cacheable(value={"SPDao"}, key="'findByVacId-' + #vacproductid") public SPInfo findByVacId(String Vacid) throws SQLException { String sql = "select cpid, spid, spname, price, vacproductid, spcode, type, feetype, cancancelorder, canorder from tb_sp_info where vacproductid=?"; return (SPInfo)SQLExecutor.queryObjectWithDBName(SPInfo.class, "net3g", sql, new Object[] { Vacid }); } }