5edd056928031be1a958054f129837f94a807832.svn-base 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package com.chinacreator.videoalliance.order.dao;
  2. import com.chinacreator.common.support.cache.annotation.CacheName;
  3. import com.chinacreator.videoalliance.order.bean.SPInfo;
  4. import com.frameworkset.common.poolman.SQLExecutor;
  5. import java.sql.SQLException;
  6. import java.util.List;
  7. import org.springframework.cache.annotation.Cacheable;
  8. import org.springframework.stereotype.Component;
  9. @Component
  10. @CacheName("SPDao")
  11. public class SPDao
  12. {
  13. @Cacheable(value={"SPDao"}, key="'findByCP-' + #cpid")
  14. public List<SPInfo> findByCP(String cpid)
  15. throws SQLException
  16. {
  17. String sql = "select cpid, spid, spname, price, vacproductid, spcode, type, feetype, cancancelorder, canorder,mutex,relationSp from tb_sp_info where cpid=?";
  18. return SQLExecutor.queryListWithDBName(SPInfo.class, "net3g", sql, new Object[] { cpid });
  19. }
  20. @Cacheable(value={"SPDao"}, key="'findDefaultByCP-' + #cpid")
  21. public SPInfo findDefaultByCP(String cpid)
  22. throws SQLException
  23. {
  24. 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";
  25. return (SPInfo)SQLExecutor.queryObjectWithDBName(SPInfo.class, "net3g", sql, new Object[] { cpid });
  26. }
  27. @Cacheable(value={"SPDao"}, key="'findFlowerByCP-' + #cpid")
  28. public SPInfo findFlowerByCP(String cpid)
  29. throws SQLException
  30. {
  31. String sql = "select cpid, spid, spname, price, vacproductid, spcode, type, feetype, cancancelorder, canorder,errorhandle,paytype from tb_sp_info where cpid=? and type=6";
  32. return (SPInfo)SQLExecutor.queryObjectWithDBName(SPInfo.class, "net3g", sql, new Object[] { cpid });
  33. }
  34. @Cacheable(value={"SPDao"}, key="'findById-' + #spid")
  35. public SPInfo findById(String spid)
  36. throws SQLException
  37. {
  38. 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=?";
  39. return (SPInfo)SQLExecutor.queryObjectWithDBName(SPInfo.class, "net3g", sql, new Object[] { spid });
  40. }
  41. @Cacheable(value={"SPDao"}, key="'findByVacId-' + #vacproductid")
  42. public SPInfo findByVacId(String Vacid)
  43. throws SQLException
  44. {
  45. String sql = "select cpid, spid, spname, price, vacproductid, spcode, type, feetype, cancancelorder, canorder from tb_sp_info where vacproductid=?";
  46. return (SPInfo)SQLExecutor.queryObjectWithDBName(SPInfo.class, "net3g", sql, new Object[] { Vacid });
  47. }
  48. }