123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468 |
- <?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="com.chinaitop.depot.intelligent.grainsituation.mapper.TTestdataMapper" >
- <resultMap id="BaseResultMap" type="com.chinaitop.depot.intelligent.grainsituation.model.TTestdata" >
- <result column="id" property="id" jdbcType="VARCHAR" />
- <result column="org_id" property="orgId" jdbcType="VARCHAR" />
- <result column="storehouse" property="storehouse" jdbcType="VARCHAR" />
- <result column="house" property="house" jdbcType="VARCHAR" />
- <result column="time" property="time" jdbcType="TIMESTAMP" />
- <result column="inTemp" property="intemp" jdbcType="DECIMAL" />
- <result column="inH" property="inh" jdbcType="DECIMAL" />
- <result column="outTemp" property="outtemp" jdbcType="DECIMAL" />
- <result column="outH" property="outh" jdbcType="DECIMAL" />
- <result column="max" property="max" jdbcType="DECIMAL" />
- <result column="min" property="min" jdbcType="DECIMAL" />
- <result column="avg" property="avg" jdbcType="DECIMAL" />
- <result column="data_source" property="dataSource" jdbcType="VARCHAR" />
- <result column="updatetime" property="updatetime" jdbcType="TIMESTAMP" />
- <result column="iLq_yq" property="ilqYq" jdbcType="VARCHAR" />
- </resultMap>
- <resultMap id="ResultMapWithBLOBs" type="com.chinaitop.depot.intelligent.grainsituation.model.TTestdata" extends="BaseResultMap" >
- <result column="t_points" property="tPoints" jdbcType="LONGVARCHAR" />
- </resultMap>
- <sql id="Example_Where_Clause" >
- <where >
- <foreach collection="oredCriteria" item="criteria" separator="or" >
- <if test="criteria.valid" >
- <trim prefix="(" suffix=")" prefixOverrides="and" >
- <foreach collection="criteria.criteria" item="criterion" >
- <choose >
- <when test="criterion.noValue" >
- and ${criterion.condition}
- </when>
- <when test="criterion.singleValue" >
- and ${criterion.condition} #{criterion.value}
- </when>
- <when test="criterion.betweenValue" >
- and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
- </when>
- <when test="criterion.listValue" >
- and ${criterion.condition}
- <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
- #{listItem}
- </foreach>
- </when>
- </choose>
- </foreach>
- </trim>
- </if>
- </foreach>
- </where>
- </sql>
- <sql id="Update_By_Example_Where_Clause" >
- <where >
- <foreach collection="example.oredCriteria" item="criteria" separator="or" >
- <if test="criteria.valid" >
- <trim prefix="(" suffix=")" prefixOverrides="and" >
- <foreach collection="criteria.criteria" item="criterion" >
- <choose >
- <when test="criterion.noValue" >
- and ${criterion.condition}
- </when>
- <when test="criterion.singleValue" >
- and ${criterion.condition} #{criterion.value}
- </when>
- <when test="criterion.betweenValue" >
- and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
- </when>
- <when test="criterion.listValue" >
- and ${criterion.condition}
- <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
- #{listItem}
- </foreach>
- </when>
- </choose>
- </foreach>
- </trim>
- </if>
- </foreach>
- </where>
- </sql>
- <sql id="Base_Column_List" >
- id, org_id, storehouse, house, time, inTemp, inH, outTemp, outH, max, min, avg, data_source,
- updatetime, iLq_yq
- </sql>
- <sql id="Blob_Column_List" >
- t_points
- </sql>
- <select id="selectByExampleWithBLOBs" resultMap="ResultMapWithBLOBs" parameterType="com.chinaitop.depot.intelligent.grainsituation.model.TTestdataExample" >
- select
- <if test="distinct" >
- distinct
- </if>
- <include refid="Base_Column_List" />
- ,
- <include refid="Blob_Column_List" />
- from t_testdata
- <if test="_parameter != null" >
- <include refid="Example_Where_Clause" />
- </if>
- <if test="orderByClause != null" >
- order by ${orderByClause}
- </if>
- </select>
- <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.intelligent.grainsituation.model.TTestdataExample" >
- select
- <if test="distinct" >
- distinct
- </if>
- <include refid="Base_Column_List" />
- from t_testdata
- <if test="_parameter != null" >
- <include refid="Example_Where_Clause" />
- </if>
- <if test="orderByClause != null" >
- order by ${orderByClause}
- </if>
- </select>
- <delete id="deleteByExample" parameterType="com.chinaitop.depot.intelligent.grainsituation.model.TTestdataExample" >
- delete from t_testdata
- <if test="_parameter != null" >
- <include refid="Example_Where_Clause" />
- </if>
- </delete>
- <insert id="insert" parameterType="com.chinaitop.depot.intelligent.grainsituation.model.TTestdata" >
- insert into t_testdata (id, org_id, storehouse,
- house, time, inTemp,
- inH, outTemp, outH,
- max, min, avg, data_source,
- updatetime, iLq_yq, t_points
- )
- values (#{id,jdbcType=VARCHAR}, #{orgId,jdbcType=VARCHAR}, #{storehouse,jdbcType=VARCHAR},
- #{house,jdbcType=VARCHAR}, #{time,jdbcType=TIMESTAMP}, #{intemp,jdbcType=DECIMAL},
- #{inh,jdbcType=DECIMAL}, #{outtemp,jdbcType=DECIMAL}, #{outh,jdbcType=DECIMAL},
- #{max,jdbcType=DECIMAL}, #{min,jdbcType=DECIMAL}, #{avg,jdbcType=DECIMAL}, #{dataSource,jdbcType=VARCHAR},
- #{updatetime,jdbcType=TIMESTAMP}, #{ilqYq,jdbcType=VARCHAR}, #{tPoints,jdbcType=LONGVARCHAR}
- )
- </insert>
- <insert id="insertSelective" parameterType="com.chinaitop.depot.intelligent.grainsituation.model.TTestdata" >
- insert into t_testdata
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="id != null" >
- id,
- </if>
- <if test="orgId != null" >
- org_id,
- </if>
- <if test="storehouse != null" >
- storehouse,
- </if>
- <if test="house != null" >
- house,
- </if>
- <if test="time != null" >
- time,
- </if>
- <if test="intemp != null" >
- inTemp,
- </if>
- <if test="inh != null" >
- inH,
- </if>
- <if test="outtemp != null" >
- outTemp,
- </if>
- <if test="outh != null" >
- outH,
- </if>
- <if test="max != null" >
- max,
- </if>
- <if test="min != null" >
- min,
- </if>
- <if test="avg != null" >
- avg,
- </if>
- <if test="dataSource != null" >
- data_source,
- </if>
- <if test="updatetime != null" >
- updatetime,
- </if>
- <if test="ilqYq != null" >
- iLq_yq,
- </if>
- <if test="tPoints != null" >
- t_points,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="id != null" >
- #{id,jdbcType=VARCHAR},
- </if>
- <if test="orgId != null" >
- #{orgId,jdbcType=VARCHAR},
- </if>
- <if test="storehouse != null" >
- #{storehouse,jdbcType=VARCHAR},
- </if>
- <if test="house != null" >
- #{house,jdbcType=VARCHAR},
- </if>
- <if test="time != null" >
- #{time,jdbcType=TIMESTAMP},
- </if>
- <if test="intemp != null" >
- #{intemp,jdbcType=DECIMAL},
- </if>
- <if test="inh != null" >
- #{inh,jdbcType=DECIMAL},
- </if>
- <if test="outtemp != null" >
- #{outtemp,jdbcType=DECIMAL},
- </if>
- <if test="outh != null" >
- #{outh,jdbcType=DECIMAL},
- </if>
- <if test="max != null" >
- #{max,jdbcType=DECIMAL},
- </if>
- <if test="min != null" >
- #{min,jdbcType=DECIMAL},
- </if>
- <if test="avg != null" >
- #{avg,jdbcType=DECIMAL},
- </if>
- <if test="dataSource != null" >
- #{dataSource,jdbcType=VARCHAR},
- </if>
- <if test="updatetime != null" >
- #{updatetime,jdbcType=TIMESTAMP},
- </if>
- <if test="ilqYq != null" >
- #{ilqYq,jdbcType=VARCHAR},
- </if>
- <if test="tPoints != null" >
- #{tPoints,jdbcType=LONGVARCHAR},
- </if>
- </trim>
- </insert>
- <select id="countByExample" parameterType="com.chinaitop.depot.intelligent.grainsituation.model.TTestdataExample" resultType="java.lang.Integer" >
- select count(*) from t_testdata
- <if test="_parameter != null" >
- <include refid="Example_Where_Clause" />
- </if>
- </select>
- <update id="updateByExampleSelective" parameterType="map" >
- update t_testdata
- <set >
- <if test="record.id != null" >
- id = #{record.id,jdbcType=VARCHAR},
- </if>
- <if test="record.orgId != null" >
- org_id = #{record.orgId,jdbcType=VARCHAR},
- </if>
- <if test="record.storehouse != null" >
- storehouse = #{record.storehouse,jdbcType=VARCHAR},
- </if>
- <if test="record.house != null" >
- house = #{record.house,jdbcType=VARCHAR},
- </if>
- <if test="record.time != null" >
- time = #{record.time,jdbcType=TIMESTAMP},
- </if>
- <if test="record.intemp != null" >
- inTemp = #{record.intemp,jdbcType=DECIMAL},
- </if>
- <if test="record.inh != null" >
- inH = #{record.inh,jdbcType=DECIMAL},
- </if>
- <if test="record.outtemp != null" >
- outTemp = #{record.outtemp,jdbcType=DECIMAL},
- </if>
- <if test="record.outh != null" >
- outH = #{record.outh,jdbcType=DECIMAL},
- </if>
- <if test="record.max != null" >
- max = #{record.max,jdbcType=DECIMAL},
- </if>
- <if test="record.min != null" >
- min = #{record.min,jdbcType=DECIMAL},
- </if>
- <if test="record.avg != null" >
- avg = #{record.avg,jdbcType=DECIMAL},
- </if>
- <if test="record.dataSource != null" >
- data_source = #{record.dataSource,jdbcType=VARCHAR},
- </if>
- <if test="record.updatetime != null" >
- updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
- </if>
- <if test="record.ilqYq != null" >
- iLq_yq = #{record.ilqYq,jdbcType=VARCHAR},
- </if>
- <if test="record.tPoints != null" >
- t_points = #{record.tPoints,jdbcType=LONGVARCHAR},
- </if>
- </set>
- <if test="_parameter != null" >
- <include refid="Update_By_Example_Where_Clause" />
- </if>
- </update>
- <update id="updateByExampleWithBLOBs" parameterType="map" >
- update t_testdata
- set id = #{record.id,jdbcType=VARCHAR},
- org_id = #{record.orgId,jdbcType=VARCHAR},
- storehouse = #{record.storehouse,jdbcType=VARCHAR},
- house = #{record.house,jdbcType=VARCHAR},
- time = #{record.time,jdbcType=TIMESTAMP},
- inTemp = #{record.intemp,jdbcType=DECIMAL},
- inH = #{record.inh,jdbcType=DECIMAL},
- outTemp = #{record.outtemp,jdbcType=DECIMAL},
- outH = #{record.outh,jdbcType=DECIMAL},
- max = #{record.max,jdbcType=DECIMAL},
- min = #{record.min,jdbcType=DECIMAL},
- avg = #{record.avg,jdbcType=DECIMAL},
- data_source = #{record.dataSource,jdbcType=VARCHAR},
- updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
- iLq_yq = #{record.ilqYq,jdbcType=VARCHAR},
- t_points = #{record.tPoints,jdbcType=LONGVARCHAR}
- <if test="_parameter != null" >
- <include refid="Update_By_Example_Where_Clause" />
- </if>
- </update>
- <update id="updateByExample" parameterType="map" >
- update t_testdata
- set id = #{record.id,jdbcType=VARCHAR},
- org_id = #{record.orgId,jdbcType=VARCHAR},
- storehouse = #{record.storehouse,jdbcType=VARCHAR},
- house = #{record.house,jdbcType=VARCHAR},
- time = #{record.time,jdbcType=TIMESTAMP},
- inTemp = #{record.intemp,jdbcType=DECIMAL},
- inH = #{record.inh,jdbcType=DECIMAL},
- outTemp = #{record.outtemp,jdbcType=DECIMAL},
- outH = #{record.outh,jdbcType=DECIMAL},
- max = #{record.max,jdbcType=DECIMAL},
- min = #{record.min,jdbcType=DECIMAL},
- avg = #{record.avg,jdbcType=DECIMAL},
- data_source = #{record.dataSource,jdbcType=VARCHAR},
- updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
- iLq_yq = #{record.ilqYq,jdbcType=VARCHAR}
- <if test="_parameter != null" >
- <include refid="Update_By_Example_Where_Clause" />
- </if>
- </update>
- <insert id="insertBatch" parameterType="java.util.List">
- insert into t_testdata (id, org_id, storehouse,
- house, time, inTemp,
- inH, outTemp, outH,
- max, min, avg, data_source,
- updatetime, iLq_yq, t_points
- )
- values
- <foreach collection="list" item="testData" index="index" separator=",">
- (#{testData.id,jdbcType=VARCHAR}, #{testData.orgId,jdbcType=VARCHAR}, #{testData.storehouse,jdbcType=VARCHAR},
- #{testData.house,jdbcType=VARCHAR}, #{testData.time,jdbcType=TIMESTAMP}, #{testData.intemp,jdbcType=DECIMAL},
- #{testData.inh,jdbcType=DECIMAL}, #{testData.outtemp,jdbcType=DECIMAL}, #{testData.outh,jdbcType=DECIMAL},
- #{testData.max,jdbcType=DECIMAL}, #{testData.min,jdbcType=DECIMAL}, #{testData.avg,jdbcType=DECIMAL}, #{testData.dataSource,jdbcType=VARCHAR},
- #{testData.updatetime,jdbcType=TIMESTAMP}, #{testData.ilqYq,jdbcType=VARCHAR}, #{testData.tPoints,jdbcType=LONGVARCHAR}
- )
- </foreach>
- </insert>
- <select id="getList" parameterType="Map" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List"/>
- from t_testdata
- <where>
- <if test="vDatatime != null and vDatatime != ''">
- time like #{vDatatime}
- </if>
- <if test="vCfCode != null and vCfCode != ''">
- and house = #{vCfCode}
- </if>
- </where>
- order by time desc
- </select>
- <select id="getByCfCdoes" parameterType="Map" resultMap="BaseResultMap">
- SELECT
- a.*
- FROM
- (
- SELECT
- <include refid="Base_Column_List"/>
- FROM
- t_testdata
- ORDER BY
- time DESC
- ) a
- WHERE 1=1
- <if test="orgId != null">
- AND a.orgId = #{orgId}
- </if>
- GROUP BY
- a.storehouse
- </select>
- <select id="getNewest" resultMap="BaseResultMap" parameterType="java.util.Map">
- SELECT
- t2.id,
- t2.org_id,
- t2.storehouse,
- t2.house,
- t2.time,
- t2.inTemp,
- t2.inH,
- t2.outTemp,
- t2.outH,
- t2.max,
- t2.min,
- t2.avg,
- t2.data_source,
- t2.updatetime,
- t2.iLq_yq
- FROM
- (
- SELECT
- MAX(time) time,
- org_id
- FROM
- t_testdata
- WHERE
- org_id = #{orgId}
- GROUP BY
- storehouse
- ) t1
- LEFT JOIN t_testdata t2 ON t1.time = t2.time
- AND t1.org_id = t2.org_id
- </select>
- <select id="getById" resultMap="ResultMapWithBLOBs" parameterType="java.lang.String">
- SELECT * FROM t_testdata WHERE id = #{id}
- </select>
- <select id="getOrgId" resultType="java.lang.String" parameterType="java.lang.String">
- SELECT
- org_id
- FROM
- basic_storehouse
- <if test="cfCode != null">
- WHERE storehouse_code = #{cfCode}
- </if>
- LIMIT 0,1
- </select>
- <select id="getGrainPointAll" resultType="java.util.Map" parameterType="java.util.Map">
- SELECT
- *
- FROM
- t_testdata
- <where>
- <if test="tHouse != null">
- storehouse = #{tHouse}
- </if>
- <if test="startTime != null and endTime != null">
- AND time BETWEEN #{startTime} AND #{endTime}
- </if>
- <if test="lqIds != null">
- AND id IN
- <foreach item="lqId" index="index" collection="lqIds" open="(" separator="," close=")">
- #{lqId}
- </foreach>
- </if>
- </where>
- </select>
- </mapper>
|