123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509 |
- <?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.supervise.mapper.TDepotStyleMapper">
- <resultMap id="BaseResultMap" type="com.chinaitop.depot.intelligent.supervise.model.TDepotStyle">
- <id column="id" property="id" jdbcType="INTEGER"/>
- <result column="org_id" property="orgId" jdbcType="INTEGER"/>
- <result column="type" property="type" jdbcType="VARCHAR"/>
- <result column="indexid" property="indexid" jdbcType="INTEGER"/>
- <result column="styles" property="styles" jdbcType="VARCHAR"/>
- </resultMap>
- <resultMap id="ResultMapWithBLOBs" type="com.chinaitop.depot.intelligent.supervise.model.TDepotStyle"
- extends="BaseResultMap">
- <result column="imgdata" property="imgdata" jdbcType="LONGVARBINARY"/>
- </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, type, indexid, styles
- </sql>
- <sql id="Blob_Column_List">
- imgdata
- </sql>
- <select id="selectByExampleWithBLOBs" resultMap="ResultMapWithBLOBs"
- parameterType="com.chinaitop.depot.intelligent.supervise.model.TDepotStyleExample">
- select
- <if test="distinct">
- distinct
- </if>
- <include refid="Base_Column_List"/>
- ,
- <include refid="Blob_Column_List"/>
- from t_depot_style
- <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.supervise.model.TDepotStyleExample">
- select
- <if test="distinct">
- distinct
- </if>
- <include refid="Base_Column_List"/>
- from t_depot_style
- <if test="_parameter != null">
- <include refid="Example_Where_Clause"/>
- </if>
- <if test="orderByClause != null">
- order by ${orderByClause}
- </if>
- </select>
- <select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer">
- select
- <include refid="Base_Column_List"/>
- ,
- <include refid="Blob_Column_List"/>
- from t_depot_style
- where id = #{id,jdbcType=INTEGER}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
- delete from t_depot_style
- where id = #{id,jdbcType=INTEGER}
- </delete>
- <delete id="deleteByExample" parameterType="com.chinaitop.depot.intelligent.supervise.model.TDepotStyleExample">
- delete from t_depot_style
- <if test="_parameter != null">
- <include refid="Example_Where_Clause"/>
- </if>
- </delete>
- <insert id="insert" parameterType="com.chinaitop.depot.intelligent.supervise.model.TDepotStyle">
- insert into t_depot_style (id, org_id, type,
- indexid, styles, imgdata
- )
- values (#{id,jdbcType=INTEGER}, #{orgId,jdbcType=INTEGER}, #{type,jdbcType=VARCHAR},
- #{indexid,jdbcType=INTEGER}, #{styles,jdbcType=VARCHAR}, #{imgdata,jdbcType=LONGVARBINARY}
- )
- </insert>
- <insert id="insertSelective" parameterType="com.chinaitop.depot.intelligent.supervise.model.TDepotStyle">
- insert into t_depot_style
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">
- id,
- </if>
- <if test="orgId != null">
- org_id,
- </if>
- <if test="type != null">
- type,
- </if>
- <if test="indexid != null">
- indexid,
- </if>
- <if test="styles != null">
- styles,
- </if>
- <if test="imgdata != null">
- imgdata,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">
- #{id,jdbcType=INTEGER},
- </if>
- <if test="orgId != null">
- #{orgId,jdbcType=INTEGER},
- </if>
- <if test="type != null">
- #{type,jdbcType=VARCHAR},
- </if>
- <if test="indexid != null">
- #{indexid,jdbcType=INTEGER},
- </if>
- <if test="styles != null">
- #{styles,jdbcType=VARCHAR},
- </if>
- <if test="imgdata != null">
- #{imgdata,jdbcType=LONGVARBINARY},
- </if>
- </trim>
- </insert>
- <select id="countByExample" parameterType="com.chinaitop.depot.intelligent.supervise.model.TDepotStyleExample"
- resultType="java.lang.Integer">
- select count(*) from t_depot_style
- <if test="_parameter != null">
- <include refid="Example_Where_Clause"/>
- </if>
- </select>
- <update id="updateByExampleSelective" parameterType="map">
- update t_depot_style
- <set>
- <if test="record.id != null">
- id = #{record.id,jdbcType=INTEGER},
- </if>
- <if test="record.orgId != null">
- org_id = #{record.orgId,jdbcType=INTEGER},
- </if>
- <if test="record.type != null">
- type = #{record.type,jdbcType=VARCHAR},
- </if>
- <if test="record.indexid != null">
- indexid = #{record.indexid,jdbcType=INTEGER},
- </if>
- <if test="record.styles != null">
- styles = #{record.styles,jdbcType=VARCHAR},
- </if>
- <if test="record.imgdata != null">
- imgdata = #{record.imgdata,jdbcType=LONGVARBINARY},
- </if>
- </set>
- <if test="_parameter != null">
- <include refid="Update_By_Example_Where_Clause"/>
- </if>
- </update>
- <update id="updateByExampleWithBLOBs" parameterType="map">
- update t_depot_style
- set id = #{record.id,jdbcType=INTEGER},
- org_id = #{record.orgId,jdbcType=INTEGER},
- type = #{record.type,jdbcType=VARCHAR},
- indexid = #{record.indexid,jdbcType=INTEGER},
- styles = #{record.styles,jdbcType=VARCHAR},
- imgdata = #{record.imgdata,jdbcType=LONGVARBINARY}
- <if test="_parameter != null">
- <include refid="Update_By_Example_Where_Clause"/>
- </if>
- </update>
- <update id="updateByExample" parameterType="map">
- update t_depot_style
- set id = #{record.id,jdbcType=INTEGER},
- org_id = #{record.orgId,jdbcType=INTEGER},
- type = #{record.type,jdbcType=VARCHAR},
- indexid = #{record.indexid,jdbcType=INTEGER},
- styles = #{record.styles,jdbcType=VARCHAR}
- <if test="_parameter != null">
- <include refid="Update_By_Example_Where_Clause"/>
- </if>
- </update>
- <update id="updateByPrimaryKeySelective"
- parameterType="com.chinaitop.depot.intelligent.supervise.model.TDepotStyle">
- update t_depot_style
- <set>
- <if test="orgId != null">
- org_id = #{orgId,jdbcType=INTEGER},
- </if>
- <if test="type != null">
- type = #{type,jdbcType=VARCHAR},
- </if>
- <if test="indexid != null">
- indexid = #{indexid,jdbcType=INTEGER},
- </if>
- <if test="styles != null">
- styles = #{styles,jdbcType=VARCHAR},
- </if>
- <if test="imgdata != null">
- imgdata = #{imgdata,jdbcType=LONGVARBINARY},
- </if>
- </set>
- where id = #{id,jdbcType=INTEGER}
- </update>
- <update id="updateByPrimaryKeyWithBLOBs"
- parameterType="com.chinaitop.depot.intelligent.supervise.model.TDepotStyle">
- update t_depot_style
- set org_id = #{orgId,jdbcType=INTEGER},
- type = #{type,jdbcType=VARCHAR},
- indexid = #{indexid,jdbcType=INTEGER},
- styles = #{styles,jdbcType=VARCHAR},
- imgdata = #{imgdata,jdbcType=LONGVARBINARY}
- where id = #{id,jdbcType=INTEGER}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.chinaitop.depot.intelligent.supervise.model.TDepotStyle">
- update t_depot_style
- set org_id = #{orgId,jdbcType=INTEGER},
- type = #{type,jdbcType=VARCHAR},
- indexid = #{indexid,jdbcType=INTEGER},
- styles = #{styles,jdbcType=VARCHAR}
- where id = #{id,jdbcType=INTEGER}
- </update>
- <select id="selectByGrainSituaiton" parameterType="java.util.Map" resultType="java.util.HashMap">
- SELECT DISTINCT
- style.styles,
- style.imgdata,
- hw.input_year TestDate,
- house.storehouse_name barnName,
- house.storehouse_code vCf,
- t3.inTemp _InT,
- t3.outTemp OutT,
- t3.inH InH,
- t3.outH OutH,
- t3.avg AvgT,
- t3.min MinT,
- t3.max MaxT,
- t3.storehouse vCfCode,
- t3.time time,
- house.storehouse_id house_id,
- house.storehouse_name,
- house.storehouse_type,
- hw.sub_type
- FROM
- basic_storehouse house
- LEFT JOIN t_depot_style style ON style.indexid = house.storehouse_id
- LEFT JOIN storage_foodbasicinfo hw ON house.storehouse_id = hw.house_id
- LEFT JOIN (
- SELECT
- *
- FROM
- (
- SELECT
- *
- FROM
- t_testdata
- WHERE iLq_yq = 0
- AND org_id =#{orgId}
- ORDER BY
- time DESC
- limit 10000000000
- ) a
- GROUP BY
- a.storehouse
- ) t3 ON house.storehouse_code = t3.storehouse
- WHERE
- 1 = 1
- AND style.type = 2
- GROUP BY
- house.storehouse_id
- </select>
- <select id="selectByQT" parameterType="java.util.Map" resultType="java.util.HashMap">
- SELECT DISTINCT
- style.styles,
- style.imgdata,
- hw.input_year TestDate,
- house.storehouse_name barnName,
- house.storehouse_code vCf,
- t3.co2avg co2avg,
- t3.ph3avg ph3avg,
- t3.o2avg o2avg,
- t3.vValueTime time,
- t3.vCfCode vCfCode,
- house.storehouse_id house_id,
- house.storehouse_name,
- house.storehouse_type,
- hw.sub_type
- FROM
- basic_storehouse house
- LEFT JOIN t_depot_style style ON style.indexid = house.storehouse_id
- LEFT JOIN storage_foodbasicinfo hw ON house.storehouse_id = hw.house_id
- LEFT JOIN (
- SELECT
- a.vCfCode,
- a.vValueTime,
- MAX(
- CASE a.v_dev_kind_code
- WHEN "6964" THEN
- a.cpo_avg
- ELSE
- 0
- END
- ) AS "co2avg",
- MAX(
- CASE a.v_dev_kind_code
- WHEN "6965" THEN
- a.cpo_avg
- ELSE
- 0
- END
- ) AS "ph3avg",
- MAX(
- CASE a.v_dev_kind_code
- WHEN "6962" THEN
- a.cpo_avg
- ELSE
- 0
- END
- ) AS "o2avg"
- FROM
- (
- SELECT
- v_cf_code AS "vCfCode",
- v_value_time AS "vValueTime",
- v_dev_kind_code,
- cpo_avg
- FROM
- t_qtdevinfo_value
- WHERE org_id =#{orgId}
- ORDER BY
- vValueTime DESC
- limit 10000000000
- ) a
- GROUP BY
- a.vCfCode
- ) t3 ON house.storehouse_code = t3.vCfCode
- WHERE
- 1 = 1
- AND style.type = 2
- GROUP BY
- house.storehouse_id
- </select>
- <select id="selectByInsect" parameterType="java.util.Map" resultType="java.util.HashMap">
- SELECT DISTINCT
- style.styles,
- style.imgdata,
- hw.input_year TestDate,
- house.storehouse_name barnName,
- house.storehouse_code vCf,
- t3.max max,
- t3.min min,
- t3.avg avg,
- t3.vUpdateTime time,
- t3.vCfCode vCfCode,
- house.storehouse_id house_id,
- house.storehouse_name,
- house.storehouse_type,
- hw.sub_type
- FROM
- basic_storehouse house
- LEFT JOIN t_depot_style style ON style.indexid = house.storehouse_id
- LEFT JOIN storage_foodbasicinfo hw ON house.storehouse_id = hw.house_id
- LEFT JOIN (
- SELECT
- a.*
- FROM
- (
- SELECT
- v_cf_code AS vCfCode,
- v_max AS max,
- v_min AS min,
- v_avg AS avg,
- v_update_time AS vUpdateTime
- FROM
- t_ccvalue
- WHERE org_id =#{orgId}
- ORDER BY
- vUpdateTime DESC
- limit 10000000000
- ) a
- GROUP BY
- a.vCfCode
- ) t3 ON house.storehouse_code = t3.vCfCode
- WHERE
- 1 = 1
- AND style.type = 2
- GROUP BY
- house.storehouse_id
- </select>
- <select id="selectByWarning" parameterType="java.util.Map" resultType="java.util.HashMap">
- SELECT DISTINCT
- style.styles,
- style.imgdata,
- hw.input_year TestDate,
- house.storehouse_name barnName,
- house.storehouse_code vCf,
- t3.wThreshold wThreshold,
- t3.threshold threshold,
- t3.wRemark wRemark,
- t3.time time,
- t3.vCfCode vCfCode,
- house.storehouse_id house_id,
- house.storehouse_name,
- house.storehouse_type,
- hw.sub_type
- FROM
- basic_storehouse house
- LEFT JOIN t_depot_style style ON style.indexid = house.storehouse_id
- LEFT JOIN storage_foodbasicinfo hw ON house.storehouse_id = hw.house_id
- LEFT JOIN (
- SELECT
- a.v_cf_code vCfCode,
- a.w_time time,
- a.w_threshold wThreshold,
- a.threshold threshold,
- a.w_remark wRemark
- FROM
- (
- SELECT
- *
- FROM
- t_warning_threshold_history
- WHERE w_warning = 0
- AND org_id =#{orgId}
- ORDER BY
- w_time DESC
- ) a
- WHERE 1=1
- <if test="times != null">
- AND a.w_time in
- <foreach item="time" index="index" collection="times" open="(" separator="," close=")">
- #{time}
- </foreach>
- </if>
- <if test="cfCodes != null">
- AND a.v_cf_code in
- <foreach item="cfCode" index="index" collection="cfCodes" open="(" separator="," close=")">
- #{cfCode}
- </foreach>
- </if>
- GROUP BY
- a.v_cf_code
- ) t3 ON house.storehouse_code = t3.vCfCode
- WHERE
- 1 = 1
- AND style.type = 2
- GROUP BY
- house.storehouse_id
- </select>
- </mapper>
|