123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486 |
- <?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.steerinfo.ems.foldthevalues.mapper.FoldTheValuesMapper">
- <resultMap id="BaseResultMap" type="com.steerinfo.ems.foldthevalues.model.FoldTheValues">
- <id column="ID" jdbcType="VARCHAR" property="id" />
- <result column="MATERIALSOURCE" jdbcType="VARCHAR" property="materialsource" />
- <result column="CLOCK" jdbcType="VARCHAR" property="clock" />
- <result column="CODE" jdbcType="VARCHAR" property="code" />
- <result column="DESCRIPTION" jdbcType="VARCHAR" property="description" />
- <result column="ISAVAILABLE" jdbcType="VARCHAR" property="isavailable" />
- <result column="REVISOR" jdbcType="VARCHAR" property="revisor" />
- <result column="REVISETIME" jdbcType="VARCHAR" property="revisetime" />
- <result column="UNITID" jdbcType="VARCHAR" property="unitid" />
- <result column="BZ" jdbcType="VARCHAR" property="bz" />
- <result column="MATERIALNO" jdbcType="VARCHAR" property="materialno"/>
- <result column="TIMEGRANID" jdbcType="VARCHAR" property="timegranid"/>
- <result column="ESTIMATEDVALUE" jdbcType="VARCHAR" property="estimatedvalue"/>
- </resultMap>
- <sql id="columns">
- ID, MATERIALSOURCE, CLOCK, CODE, DESCRIPTION, ISAVAILABLE, REVISOR, REVISETIME,
- UNITID, BZ,MATERIALNO,TIMEGRANID,ESTIMATEDVALUE
- </sql>
- <sql id="columns_alias">
- t.ID, t.MATERIALSOURCE, t.CLOCK, t.CODE, t.DESCRIPTION, t.ISAVAILABLE, t.REVISOR,
- t.REVISETIME, t.UNITID, t.BZ,t.MATERIALNO
- </sql>
- <sql id="select">
- SELECT <include refid="columns"/> FROM FOLD_THE_VALUES
- </sql>
- <sql id="select_alias">
- SELECT <include refid="columns_alias"/> FROM FOLD_THE_VALUES t
- </sql>
- <sql id="where">
- <where>
- <if test="id != null and id != ''">
- and ID = #{id}
- </if>
- <if test="materialsource != null and materialsource != ''">
- and MATERIALSOURCE = #{materialsource}
- </if>
- <if test="clock != null and clock != ''">
- and CLOCK = #{clock}
- </if>
- <if test="code != null and code != ''">
- and CODE = #{code}
- </if>
- <if test="description != null and description != ''">
- and DESCRIPTION = #{description}
- </if>
- <if test="isavailable != null and isavailable != ''">
- and ISAVAILABLE = #{isavailable}
- </if>
- <if test="revisor != null and revisor != ''">
- and REVISOR = #{revisor}
- </if>
- <if test="revisetime != null and revisetime != ''">
- and REVISETIME = #{revisetime}
- </if>
- <if test="unitid != null and unitid != ''">
- and UNITID = #{unitid}
- </if>
- <if test="bz != null and bz != ''">
- and BZ = #{bz}
- </if>
- </where>
- </sql>
- <sql id="whereLike">
- <where>
- <if test="id != null and id != ''">
- and ID LIKE '%${id}%'
- </if>
- <if test="materialsource != null and materialsource != ''">
- and MATERIALSOURCE LIKE '%${materialsource}%'
- </if>
- <if test="clock != null and clock != ''">
- and CLOCK LIKE '%${clock}%'
- </if>
- <if test="code != null and code != ''">
- and CODE LIKE '%${code}%'
- </if>
- <if test="description != null and description != ''">
- and DESCRIPTION LIKE '%${description}%'
- </if>
- <if test="isavailable != null and isavailable != ''">
- and ISAVAILABLE LIKE '%${isavailable}%'
- </if>
- <if test="revisor != null and revisor != ''">
- and REVISOR LIKE '%${revisor}%'
- </if>
- <if test="revisetime != null and revisetime != ''">
- and REVISETIME LIKE '%${revisetime}%'
- </if>
- <if test="unitid != null and unitid != ''">
- and UNITID LIKE '%${unitid}%'
- </if>
- <if test="bz != null and bz != ''">
- and BZ LIKE '%${bz}%'
- </if>
- </where>
- </sql>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
- delete from FOLD_THE_VALUES
- where ID = #{id,jdbcType=VARCHAR}
- </delete>
- <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
- delete from FOLD_THE_VALUES
- where 1!=1
- <if test="materialsource != null and materialsource != ''">
- or MATERIALSOURCE = #{materialsource}
- </if>
- <if test="clock != null and clock != ''">
- or CLOCK = #{clock}
- </if>
- <if test="code != null and code != ''">
- or CODE = #{code}
- </if>
- <if test="description != null and description != ''">
- or DESCRIPTION = #{description}
- </if>
- <if test="isavailable != null and isavailable != ''">
- or ISAVAILABLE = #{isavailable}
- </if>
- <if test="revisor != null and revisor != ''">
- or REVISOR = #{revisor}
- </if>
- <if test="revisetime != null and revisetime != ''">
- or REVISETIME = #{revisetime}
- </if>
- <if test="unitid != null and unitid != ''">
- or UNITID = #{unitid}
- </if>
- <if test="bz != null and bz != ''">
- or BZ = #{bz}
- </if>
- </delete>
- <insert id="insert" parameterType="com.steerinfo.ems.foldthevalues.model.FoldTheValues">
- insert into FOLD_THE_VALUES (ID, MATERIALSOURCE, CLOCK,
- CODE, DESCRIPTION, ISAVAILABLE,
- REVISOR, REVISETIME,MATERIALNO,
- UNITID, BZ,TIMEGRANID,ESTIMATEDVALUE)
- values (#{id,jdbcType=VARCHAR}, #{materialsource,jdbcType=VARCHAR}, #{clock,jdbcType=VARCHAR},
- #{code,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{isavailable,jdbcType=VARCHAR},
- #{revisor,jdbcType=VARCHAR}, #{revisetime,jdbcType=VARCHAR},#{materialno,jdbcType=VARCHAR},
- #{unitid,jdbcType=VARCHAR}, #{bz,jdbcType=VARCHAR},#{timegranid,jdbcType=VARCHAR},#{estimatedvalue,jdbcType=VARCHAR})
- </insert>
- <insert id="insertSelective" parameterType="com.steerinfo.ems.foldthevalues.model.FoldTheValues">
- insert into FOLD_THE_VALUES
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">
- ID,
- </if>
- <if test="materialsource != null">
- MATERIALSOURCE,
- </if>
- <if test="clock != null">
- CLOCK,
- </if>
- <if test="code != null">
- CODE,
- </if>
- <if test="description != null">
- DESCRIPTION,
- </if>
- <if test="isavailable != null">
- ISAVAILABLE,
- </if>
- <if test="revisor != null">
- REVISOR,
- </if>
- <if test="revisetime != null">
- REVISETIME,
- </if>
- <if test="unitid != null">
- UNITID,
- </if>
- <if test="bz != null">
- BZ,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">
- #{id,jdbcType=VARCHAR},
- </if>
- <if test="materialsource != null">
- #{materialsource,jdbcType=VARCHAR},
- </if>
- <if test="clock != null">
- #{clock,jdbcType=VARCHAR},
- </if>
- <if test="code != null">
- #{code,jdbcType=VARCHAR},
- </if>
- <if test="description != null">
- #{description,jdbcType=VARCHAR},
- </if>
- <if test="isavailable != null">
- #{isavailable,jdbcType=VARCHAR},
- </if>
- <if test="revisor != null">
- #{revisor,jdbcType=VARCHAR},
- </if>
- <if test="revisetime != null">
- #{revisetime,jdbcType=VARCHAR},
- </if>
- <if test="unitid != null">
- #{unitid,jdbcType=VARCHAR},
- </if>
- <if test="bz != null">
- #{bz,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKey" parameterType="com.steerinfo.ems.foldthevalues.model.FoldTheValues">
- update FOLD_THE_VALUES
- set
- CLOCK = #{clock,jdbcType=VARCHAR},
- CODE = #{code,jdbcType=VARCHAR},
- DESCRIPTION = #{description,jdbcType=VARCHAR},
- ISAVAILABLE = #{isavailable,jdbcType=VARCHAR},
- REVISOR = #{revisor,jdbcType=VARCHAR},
- REVISETIME = #{revisetime,jdbcType=VARCHAR},
- UNITID = #{unitid,jdbcType=VARCHAR},
- BZ = #{bz,jdbcType=VARCHAR},
- TIMEGRANID = #{timegranid,jdbcType=VARCHAR},
- ESTIMATEDVALUE = #{estimatedvalue,jdbcType=VARCHAR}
- where ID = #{id,jdbcType=VARCHAR}
- </update>
- <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.ems.foldthevalues.model.FoldTheValues">
- update FOLD_THE_VALUES
- <set>
- <if test="materialsource != null">
- MATERIALSOURCE = #{materialsource,jdbcType=VARCHAR},
- </if>
- <if test="clock != null">
- CLOCK = #{clock,jdbcType=VARCHAR},
- </if>
- <if test="code != null">
- CODE = #{code,jdbcType=VARCHAR},
- </if>
- <if test="description != null">
- DESCRIPTION = #{description,jdbcType=VARCHAR},
- </if>
- <if test="isavailable != null">
- ISAVAILABLE = #{isavailable,jdbcType=VARCHAR},
- </if>
- <if test="revisor != null">
- REVISOR = #{revisor,jdbcType=VARCHAR},
- </if>
- <if test="revisetime != null">
- REVISETIME = #{revisetime,jdbcType=VARCHAR},
- </if>
- <if test="unitid != null">
- UNITID = #{unitid,jdbcType=VARCHAR},
- </if>
- <if test="bz != null">
- BZ = #{bz,jdbcType=VARCHAR},
- </if>
- </set>
- where ID = #{id,jdbcType=VARCHAR}
- </update>
- <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
- <include refid="select"/>
- where ID = #{id,jdbcType=VARCHAR}
- </select>
- <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- <include refid="select"/>
- <include refid="where"/>
- </select>
- <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- <include refid="select"/>
- <include refid="whereLike"/>
- </select>
- <insert id="batchInsert" parameterType="java.util.List">
- insert into FOLD_THE_VALUES
- (ID,
- MATERIALSOURCE, CLOCK, CODE,
- DESCRIPTION, ISAVAILABLE, REVISOR,
- REVISETIME, UNITID,
- BZ)
- ( <foreach collection="list" item="item" separator="union all">
- select
- #{item.id,jdbcType=VARCHAR},
- #{item.materialsource,jdbcType=VARCHAR}, #{item.clock,jdbcType=VARCHAR}, #{item.code,jdbcType=VARCHAR},
- #{item.description,jdbcType=VARCHAR}, #{item.isavailable,jdbcType=VARCHAR}, #{item.revisor,jdbcType=VARCHAR},
- #{item.revisetime,jdbcType=VARCHAR}, #{item.unitid,jdbcType=VARCHAR},
- #{item.bz,jdbcType=VARCHAR} from dual
- </foreach> )
- </insert>
- <update id="batchUpdate" parameterType="java.util.List">
- update FOLD_THE_VALUES
- set
- ID=
- <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
- when #{item.id,jdbcType=VARCHAR} then #{item.id,jdbcType=VARCHAR}
- </foreach>
- ,MATERIALSOURCE=
- <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
- when #{item.id,jdbcType=VARCHAR} then #{item.materialsource,jdbcType=VARCHAR}
- </foreach>
- ,CLOCK=
- <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
- when #{item.id,jdbcType=VARCHAR} then #{item.clock,jdbcType=VARCHAR}
- </foreach>
- ,CODE=
- <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
- when #{item.id,jdbcType=VARCHAR} then #{item.code,jdbcType=VARCHAR}
- </foreach>
- ,DESCRIPTION=
- <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
- when #{item.id,jdbcType=VARCHAR} then #{item.description,jdbcType=VARCHAR}
- </foreach>
- ,ISAVAILABLE=
- <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
- when #{item.id,jdbcType=VARCHAR} then #{item.isavailable,jdbcType=VARCHAR}
- </foreach>
- ,REVISOR=
- <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
- when #{item.id,jdbcType=VARCHAR} then #{item.revisor,jdbcType=VARCHAR}
- </foreach>
- ,REVISETIME=
- <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
- when #{item.id,jdbcType=VARCHAR} then #{item.revisetime,jdbcType=VARCHAR}
- </foreach>
- ,UNITID=
- <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
- when #{item.id,jdbcType=VARCHAR} then #{item.unitid,jdbcType=VARCHAR}
- </foreach>
- ,BZ=
- <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
- when #{item.id,jdbcType=VARCHAR} then #{item.bz,jdbcType=VARCHAR}
- </foreach>
- where ID in
- <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
- #{item.id,jdbcType=VARCHAR}
- </foreach>
- </update>
- <delete id="batchDelete" parameterType="java.util.List">
- delete from FOLD_THE_VALUES
- where ID in
- <foreach collection="list" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </delete>
- <!-- 友情提示!!!-->
- <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
- <select id="getDateForPage" parameterType="java.util.HashMap" resultType="Map">
- select t.*, t1.id as energyid, t1.name as energyname
- from Fold_the_values t
- left join t_rm_energy t1
- on t.materialno = t1.id
- <where>
- <if test = "startTime != null and startTime != '' and endTime != null and endTime != '' " >
- and t.clock between #{startTime} and #{endTime}
- </if >
- <if test = "energyid != null and energyid != '' " >
- and t.materialno in (${energyid})
- </if >
- <if test="timegranid != null and timegranid != ''">
- and t.timegranid = #{timegranid}
- </if>
- </where>
- order by t.clock desc
- </select>
- <!---->
- <select id="getNewData" resultMap="BaseResultMap">
- select t.batchno as id,
- '三电厂' as materialsource,
- to_char(to_date(t.monitordate, 'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd') as clock,
- t.monitoringvalue as estimatedvalue,
- (t.MONITORINGVALUE * 0.03412 / 100) as code,
- t.powersystemname as materialno
- from t_cm_0348 t
- where t.SITEM = 'BFHYD_05'
- and t.powersystemname in ('P00006', 'P00007', 'P00008')
- and t.powermonitorname in ('007', '008', '009')
- and t.batchno not in (select distinct ID from FOLD_THE_VALUES)
- </select>
- <!--获取最近最新的数据-->
- <select id="getNewOne" parameterType="java.lang.String" resultMap="BaseResultMap">
- select *
- from (select *
- from FOLD_THE_VALUES
- <where>
- <if test="materialno != null and materialno !=''">
- materialno = #{materialno}
- </if>
- </where>
- order by CLOCK desc)
- where rownum = 1
- </select>
- <!--查询出昨天没有折标值的数据-->
- <select id="getNozbzData" parameterType="java.lang.String" resultMap="BaseResultMap">
- select distinct t.materialno
- from FOLD_THE_VALUES t
- where t.materialno not in
- (select materialno from FOLD_THE_VALUES
- <where>
- <if test="clock != null and clock != ''">
- clock = #{clock}
- </if>
- </where>
- )
- </select>
- <update id="updateByClockAndMaterialno" parameterType="com.steerinfo.ems.foldthevalues.model.FoldTheValues">
- update FOLD_THE_VALUES
- set
- CLOCK = #{clock,jdbcType=VARCHAR},
- CODE = #{code,jdbcType=VARCHAR},
- ISAVAILABLE = #{isavailable,jdbcType=VARCHAR},
- UNITID = #{unitid,jdbcType=VARCHAR},
- TIMEGRANID = #{timegranid,jdbcType=VARCHAR},
- MATERIALNO = #{materialno,jdbcType=VARCHAR}
- <where>
- <if test="clock != null and clock != ''">
- and CLOCK = #{clock,jdbcType=VARCHAR}
- </if>
- <if test="materialno != null and materialno != ''">
- and MATERIALNO = #{materialno,jdbcType=VARCHAR}
- </if>
- </where>
- </update>
- <select id="getByClockAndMaterialno" parameterType="com.steerinfo.ems.foldthevalues.model.FoldTheValues" resultMap="BaseResultMap">
- select * from FOLD_THE_VALUES
- <where>
- <if test="clock != null and clock != ''">
- and CLOCK = #{clock,jdbcType=VARCHAR}
- </if>
- <if test="materialno != null and materialno != ''">
- and MATERIALNO = #{materialno,jdbcType=VARCHAR}
- </if>
- </where>
- </select>
- <!--获取月指标数据-->
- <select id="getDataForMoth" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- select sum(t.ESTIMATEDVALUE) as estimatedvalue, t.MATERIALSOURCE,t.MATERIALNO
- from FOLD_THE_VALUES t
- <where>
- <if test="startTime != null and startTime != '' and endTime != null and endTime !=''">
- T.clock between #{startTime} AND
- #{endTime}
- </if>
- </where>
- group by t.MATERIALNO,MATERIALSOURCE
- </select>
- <!--获取物料日折标数据-->
- <select id="getDateForwl" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- select t2.*
- from (select to_char(t.id, 'yyyymmdd') || t.MATERIALNO as id,
- t.code as ESTIMATEDVALUE,
- to_char(ROUND(((29727 + (10 - t.code) * 334) / 29307.6), 3),
- '0.999') as code,
- t.MATERIALNO,
- MATERIALSOURCE,
- to_char(t.id, 'yyyy-mm-dd') as clock
- from (select Dates as id,
- code,
- MATERIALNO,
- '机焦厂' as MATERIALSOURCE
- from EMS_SCQK_JJ unpivot(code for MATERIALNO in(A as
- 'X010'))
- union all
- select Dates as id,
- code,
- MATERIALNO,
- '机焦厂' as MATERIALSOURCE
- from EMS_SCQK_JJ unpivot(code for MATERIALNO in(JM_HF as
- 'X005'))
- union all
- select Dates as id,
- code,
- MATERIALNO,
- '机焦厂' as MATERIALSOURCE
- from EMS_SCQK_JJ unpivot(code for MATERIALNO in(A as
- 'X018'))) t
- <where>
- <if test="clock != null and clock != ''">
- and t.id = to_date(#{clock}, 'yyyy-mm-dd')
- </if>
- </where>) t2
- where t2.id not in
- (select distinct t.id
- from FOLD_THE_VALUES t
- where
- t.materialno in ('X005', 'X018', 'X010'))
- </select>
- </mapper>
|