<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.com.victorysoft.business.sys.dao.WellTestDao">
  <sql id="Base_Column_List">
    wellname, testdate, opentime, dp, s, n, hp, hf, hj, hs, qt, qo, qg, fw, gor, pt, pc, ptr, ht, twell,
    inputp, freq, nozzle, updatetime, qp, liftmode, dp2, qtin, qtin_t, qtin_type, qtin_fw, hf_date, sand
  </sql>

  <select id="selectByPrimaryKey" resultType="WellTest">
    select
    <include refid="Base_Column_List" />
    from well_test
    where wellname = #{wellname} and testdate = #{testdate}
  </select>

  <select id="selectOneDayList" resultType="WellTest">
    select
    <include refid="Base_Column_List" />
    from well_test
    where testdate = #{testdate}
    and wellname in
    <foreach collection="wellnames" item = "code" open="(" separator="," close=")" index="index">
      #{code}
    </foreach>
  </select>

  <select id="selectGroupWellTest" resultType="WellTest">
    select
    <include refid="Base_Column_List" />
    from well_test
    where testdate &lt;= #{testdate}
    and testdate >= #{testdate} - 30
    and wellname in
    <foreach collection="wellnames" item = "code" open="(" separator="," close=")" index="index">
      #{code}
    </foreach>
    order by wellname, testdate
  </select>

</mapper>
