123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482 |
- <?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.emsprodplanmonth.mapper.EmsProdplanMonthMapper">
- <resultMap id="BaseResultMap" type="com.steerinfo.ems.emsprodplanmonth.model.EmsProdplanMonth">
- <id column="ID" jdbcType="VARCHAR" property="id" />
- <result column="PRODUCTID" jdbcType="VARCHAR" property="productid" />
- <result column="WORKPROCID" jdbcType="VARCHAR" property="workprocid" />
- <result column="MAY" jdbcType="TIMESTAMP" property="may" />
- <result column="WEIGHT_MONTH" jdbcType="DECIMAL" property="weightMonth" />
- <result column="WEIGHT_DAY" jdbcType="DECIMAL" property="weightDay" />
- <result column="UNIT" jdbcType="VARCHAR" property="unit" />
- <result column="JXDAYS" jdbcType="VARCHAR" property="jxdays" />
- <result column="CREATETIME" jdbcType="TIMESTAMP" property="createtime" />
- <result column="CREATEMAN" jdbcType="VARCHAR" property="createman" />
- <result column="UPDATETIME" jdbcType="TIMESTAMP" property="updatetime" />
- <result column="UPDATEMAN" jdbcType="VARCHAR" property="updateman" />
- <result column="MEMO" jdbcType="VARCHAR" property="memo" />
- <result column="STATE" jdbcType="VARCHAR" property="state" />
- <result column="YXF_WEIGHT" jdbcType="DECIMAL" property="yxf_weight" />
- <result column="KXF_WEIGHT" jdbcType="DECIMAL" property="kxf_weight" />
- <result column="SQNO" jdbcType="DECIMAL" property="sqno" />
- </resultMap>
- <sql id="columns">
- ID, PRODUCTID, WORKPROCID, MAY, WEIGHT_MONTH, WEIGHT_DAY, UNIT, JXDAYS, CREATETIME,
- CREATEMAN, UPDATETIME, UPDATEMAN, MEMO,STATE,YXF_WEIGHT,KXF_WEIGHT,SQNO
- </sql>
- <sql id="columns_alias">
- t.ID, t.PRODUCTID, t.WORKPROCID, t.MAY, t.WEIGHT_MONTH, t.WEIGHT_DAY, t.UNIT, t.JXDAYS,
- t.CREATETIME, t.CREATEMAN, t.UPDATETIME, t.UPDATEMAN, t.MEMO,T.STATE
- </sql>
- <sql id="select">
- SELECT <include refid="columns"/> FROM EMS_PRODPLAN_MONTH
- </sql>
- <sql id="select_alias">
- SELECT <include refid="columns_alias"/> FROM EMS_PRODPLAN_MONTH t
- </sql>
- <sql id="where">
- <where>
- <if test="id != null and id != ''">
- and ID = #{id}
- </if>
- <if test="productid != null and productid != ''">
- and PRODUCTID = #{productid}
- </if>
- <if test="workprocid != null and workprocid != ''">
- and WORKPROCID in (${workprocid})
- </if>
- <if test="weightMonth != null">
- and WEIGHT_MONTH = #{weightMonth}
- </if>
- <if test="weightDay != null">
- and WEIGHT_DAY = #{weightDay}
- </if>
- <if test="unit != null and unit != ''">
- and UNIT = #{unit}
- </if>
- <if test="jxdays != null and jxdays != ''">
- and JXDAYS = #{jxdays}
- </if>
- <if test="createman != null and createman != ''">
- and CREATEMAN = #{createman}
- </if>
- <if test="updatetime != null">
- and TO_CHAR(UPDATETIME,'yyyy-MM-dd') = #{updatetime}
- </if>
- <if test="updateman != null and updateman != ''">
- and UPDATEMAN = #{updateman}
- </if>
- <if test="memo != null and memo != ''">
- and MEMO = #{memo}
- </if>
- <if test="state != null and state != ''">
- and STATE = #{state}
- </if>
- <if test="startTime != null and startTime != '' and endTime != null and endTime != '' ">
- and MAY between to_date(#{startTime},'yyyy-mm-dd') and to_date(#{endTime},'yyyy-mm-dd')
- </if>
- </where>
- ORDER BY WORKPROCID,MAY
- </sql>
- <sql id="whereLike">
- <where>
- <if test="id != null and id != ''">
- and ID LIKE '%${id}%'
- </if>
- <if test="productid != null and productid != ''">
- and PRODUCTID LIKE '%${productid}%'
- </if>
- <if test="workprocid != null and workprocid != ''">
- and WORKPROCID LIKE '%${workprocid}%'
- </if>
- <if test="may != null">
- and TO_CHAR(MAY,'yyyy-MM-dd') = #{may}
- </if>
- <if test="weightMonth != null">
- and WEIGHT_MONTH = #{weightMonth}
- </if>
- <if test="weightDay != null">
- and WEIGHT_DAY = #{weightDay}
- </if>
- <if test="unit != null and unit != ''">
- and UNIT LIKE '%${unit}%'
- </if>
- <if test="jxdays != null and jxdays != ''">
- and JXDAYS LIKE '%${jxdays}%'
- </if>
- <if test="createtime != null">
- and TO_CHAR(CREATETIME,'yyyy-MM-dd') = #{createtime}
- </if>
- <if test="createman != null and createman != ''">
- and CREATEMAN LIKE '%${createman}%'
- </if>
- <if test="updatetime != null">
- and TO_CHAR(UPDATETIME,'yyyy-MM-dd') = #{updatetime}
- </if>
- <if test="updateman != null and updateman != ''">
- and UPDATEMAN LIKE '%${updateman}%'
- </if>
- <if test="memo != null and memo != ''">
- and MEMO LIKE '%${memo}%'
- </if>
- </where>
- </sql>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
- delete from EMS_PRODPLAN_MONTH
- where ID = #{id,jdbcType=VARCHAR}
- </delete>
- <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
- delete from EMS_PRODPLAN_MONTH
- where 1!=1
- <if test="productid != null and productid != ''">
- or PRODUCTID = #{productid}
- </if>
- <if test="workprocid != null and workprocid != ''">
- or WORKPROCID = #{workprocid}
- </if>
- <if test="may != null">
- or TO_CHAR(MAY,'yyyy-MM-dd') = '#{may}'
- </if>
- <if test="weightMonth != null">
- or WEIGHT_MONTH = #{weightMonth}
- </if>
- <if test="weightDay != null">
- or WEIGHT_DAY = #{weightDay}
- </if>
- <if test="unit != null and unit != ''">
- or UNIT = #{unit}
- </if>
- <if test="jxdays != null and jxdays != ''">
- or JXDAYS = #{jxdays}
- </if>
- <if test="createtime != null">
- or TO_CHAR(CREATETIME,'yyyy-MM-dd') = '#{createtime}'
- </if>
- <if test="createman != null and createman != ''">
- or CREATEMAN = #{createman}
- </if>
- <if test="updatetime != null">
- or TO_CHAR(UPDATETIME,'yyyy-MM-dd') = '#{updatetime}'
- </if>
- <if test="updateman != null and updateman != ''">
- or UPDATEMAN = #{updateman}
- </if>
- <if test="memo != null and memo != ''">
- or MEMO = #{memo}
- </if>
- </delete>
- <insert id="insert" parameterType="com.steerinfo.ems.emsprodplanmonth.model.EmsProdplanMonth">
- insert into EMS_PRODPLAN_MONTH (ID, PRODUCTID, WORKPROCID,
- MAY, WEIGHT_MONTH, WEIGHT_DAY,
- UNIT, JXDAYS, CREATETIME,
- CREATEMAN, UPDATETIME, UPDATEMAN, STATE,
- MEMO,YXF_WEIGHT,KXF_WEIGHT,SQNO)
- values (#{id,jdbcType=VARCHAR}, #{productid,jdbcType=VARCHAR}, #{workprocid,jdbcType=VARCHAR},
- #{may,jdbcType=TIMESTAMP}, #{weightMonth,jdbcType=DECIMAL}, #{weightDay,jdbcType=DECIMAL},
- #{unit,jdbcType=VARCHAR}, #{jxdays,jdbcType=VARCHAR}, #{createtime,jdbcType=TIMESTAMP},
- #{createman,jdbcType=VARCHAR}, #{updatetime,jdbcType=TIMESTAMP}, #{updateman,jdbcType=VARCHAR},
- #{state,jdbcType=VARCHAR}, #{memo,jdbcType=VARCHAR},#{yxf_weight,jdbcType=DECIMAL},#{kxf_weight,jdbcType=DECIMAL},#{sqno,jdbcType=DECIMAL})
- </insert>
- <insert id="insertSelective" parameterType="com.steerinfo.ems.emsprodplanmonth.model.EmsProdplanMonth">
- insert into EMS_PRODPLAN_MONTH
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">
- ID,
- </if>
- <if test="productid != null">
- PRODUCTID,
- </if>
- <if test="workprocid != null">
- WORKPROCID,
- </if>
- <if test="may != null">
- MAY,
- </if>
- <if test="weightMonth != null">
- WEIGHT_MONTH,
- </if>
- <if test="weightDay != null">
- WEIGHT_DAY,
- </if>
- <if test="unit != null">
- UNIT,
- </if>
- <if test="jxdays != null">
- JXDAYS,
- </if>
- <if test="createtime != null">
- CREATETIME,
- </if>
- <if test="createman != null">
- CREATEMAN,
- </if>
- <if test="updatetime != null">
- UPDATETIME,
- </if>
- <if test="updateman != null">
- UPDATEMAN,
- </if>
- <if test="memo != null">
- MEMO,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">
- #{id,jdbcType=VARCHAR},
- </if>
- <if test="productid != null">
- #{productid,jdbcType=VARCHAR},
- </if>
- <if test="workprocid != null">
- #{workprocid,jdbcType=VARCHAR},
- </if>
- <if test="may != null">
- #{may,jdbcType=TIMESTAMP},
- </if>
- <if test="weightMonth != null">
- #{weightMonth,jdbcType=DECIMAL},
- </if>
- <if test="weightDay != null">
- #{weightDay,jdbcType=DECIMAL},
- </if>
- <if test="unit != null">
- #{unit,jdbcType=VARCHAR},
- </if>
- <if test="jxdays != null">
- #{jxdays,jdbcType=VARCHAR},
- </if>
- <if test="createtime != null">
- #{createtime,jdbcType=TIMESTAMP},
- </if>
- <if test="createman != null">
- #{createman,jdbcType=VARCHAR},
- </if>
- <if test="updatetime != null">
- #{updatetime,jdbcType=TIMESTAMP},
- </if>
- <if test="updateman != null">
- #{updateman,jdbcType=VARCHAR},
- </if>
- <if test="memo != null">
- #{memo,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKey" parameterType="com.steerinfo.ems.emsprodplanmonth.model.EmsProdplanMonth">
- update EMS_PRODPLAN_MONTH
- set PRODUCTID = #{productid,jdbcType=VARCHAR},
- WORKPROCID = #{workprocid,jdbcType=VARCHAR},
- MAY = #{may,jdbcType=TIMESTAMP},
- WEIGHT_MONTH = #{weightMonth,jdbcType=DECIMAL},
- WEIGHT_DAY = #{weightDay,jdbcType=DECIMAL},
- UNIT = #{unit,jdbcType=VARCHAR},
- JXDAYS = #{jxdays,jdbcType=VARCHAR},
- CREATETIME = #{createtime,jdbcType=TIMESTAMP},
- CREATEMAN = #{createman,jdbcType=VARCHAR},
- UPDATETIME = #{updatetime,jdbcType=TIMESTAMP},
- UPDATEMAN = #{updateman,jdbcType=VARCHAR},
- MEMO = #{memo,jdbcType=VARCHAR},
- YXF_WEIGHT = #{yxf_weight,jdbcType=DECIMAL},
- KXF_WEIGHT = #{kxf_weight,jdbcType=DECIMAL}
- where ID = #{id,jdbcType=VARCHAR}
- </update>
- <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.ems.emsprodplanmonth.model.EmsProdplanMonth">
- update EMS_PRODPLAN_MONTH
- <set>
- <if test="productid != null">
- PRODUCTID = #{productid,jdbcType=VARCHAR},
- </if>
- <if test="workprocid != null">
- WORKPROCID = #{workprocid,jdbcType=VARCHAR},
- </if>
- <if test="may != null">
- MAY = #{may,jdbcType=TIMESTAMP},
- </if>
- <if test="weightMonth != null">
- WEIGHT_MONTH = #{weightMonth,jdbcType=DECIMAL},
- </if>
- <if test="weightDay != null">
- WEIGHT_DAY = #{weightDay,jdbcType=DECIMAL},
- </if>
- <if test="unit != null">
- UNIT = #{unit,jdbcType=VARCHAR},
- </if>
- <if test="jxdays != null">
- JXDAYS = #{jxdays,jdbcType=VARCHAR},
- </if>
- <if test="createtime != null">
- CREATETIME = #{createtime,jdbcType=TIMESTAMP},
- </if>
- <if test="createman != null">
- CREATEMAN = #{createman,jdbcType=VARCHAR},
- </if>
- <if test="updatetime != null">
- UPDATETIME = #{updatetime,jdbcType=TIMESTAMP},
- </if>
- <if test="updateman != null">
- UPDATEMAN = #{updateman,jdbcType=VARCHAR},
- </if>
- <if test="memo != null">
- MEMO = #{memo,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 EMS_PRODPLAN_MONTH
- (ID,
- PRODUCTID, WORKPROCID, MAY,
- WEIGHT_MONTH, WEIGHT_DAY, UNIT,
- JXDAYS, CREATETIME, CREATEMAN,
- UPDATETIME, UPDATEMAN, MEMO,STATE
- )
- ( <foreach collection="list" item="item" separator="union all">
- select
- #{item.id,jdbcType=VARCHAR},
- #{item.productid,jdbcType=VARCHAR}, #{item.workprocid,jdbcType=VARCHAR}, #{item.may,jdbcType=TIMESTAMP},
- #{item.weightMonth,jdbcType=DECIMAL}, #{item.weightDay,jdbcType=DECIMAL}, #{item.unit,jdbcType=VARCHAR},
- #{item.jxdays,jdbcType=VARCHAR}, #{item.createtime,jdbcType=TIMESTAMP}, #{item.createman,jdbcType=VARCHAR},
- #{item.updatetime,jdbcType=TIMESTAMP}, #{item.updateman,jdbcType=VARCHAR}, #{item.memo,jdbcType=VARCHAR},
- #{item.state,jdbcType=VARCHAR}
- from dual
- </foreach> )
- </insert>
- <update id="batchUpdate" parameterType="java.util.List">
- update EMS_PRODPLAN_MONTH
- 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>
- ,PRODUCTID=
- <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
- when #{item.id,jdbcType=VARCHAR} then #{item.productid,jdbcType=VARCHAR}
- </foreach>
- ,WORKPROCID=
- <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
- when #{item.id,jdbcType=VARCHAR} then #{item.workprocid,jdbcType=VARCHAR}
- </foreach>
- ,MAY=
- <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
- when #{item.id,jdbcType=VARCHAR} then #{item.may,jdbcType=TIMESTAMP}
- </foreach>
- ,WEIGHT_MONTH=
- <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
- when #{item.id,jdbcType=VARCHAR} then #{item.weightMonth,jdbcType=DECIMAL}
- </foreach>
- ,WEIGHT_DAY=
- <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
- when #{item.id,jdbcType=VARCHAR} then #{item.weightDay,jdbcType=DECIMAL}
- </foreach>
- ,UNIT=
- <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
- when #{item.id,jdbcType=VARCHAR} then #{item.unit,jdbcType=VARCHAR}
- </foreach>
- ,JXDAYS=
- <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
- when #{item.id,jdbcType=VARCHAR} then #{item.jxdays,jdbcType=VARCHAR}
- </foreach>
- ,CREATETIME=
- <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
- when #{item.id,jdbcType=VARCHAR} then #{item.createtime,jdbcType=TIMESTAMP}
- </foreach>
- ,CREATEMAN=
- <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
- when #{item.id,jdbcType=VARCHAR} then #{item.createman,jdbcType=VARCHAR}
- </foreach>
- ,UPDATETIME=
- <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
- when #{item.id,jdbcType=VARCHAR} then #{item.updatetime,jdbcType=TIMESTAMP}
- </foreach>
- ,UPDATEMAN=
- <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
- when #{item.id,jdbcType=VARCHAR} then #{item.updateman,jdbcType=VARCHAR}
- </foreach>
- ,STATE=
- <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
- when #{item.id,jdbcType=VARCHAR} then #{item.state,jdbcType=VARCHAR}
- </foreach>
- ,MEMO=
- <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
- when #{item.id,jdbcType=VARCHAR} then #{item.memo,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 EMS_PRODPLAN_MONTH
- where ID in
- <foreach collection="list" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </delete>
- <!-- 友情提示!!!-->
- <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
- <!--获取编辑页面-->
- <select id="getDateEdit" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- select to_date(#{may},'yyyy-mm-dd') as may, c.productid ,c.workprocid, '0' state , c.unit from (
- select a.*,
- row_number() over(PARTITION BY a.WORKPROCID order by a.WORKPROCID ) as row_flg
- from EMS_PRODPLAN_MONTH a
- left join T_RM_WORKPROC b
- on a.workprocid = b.id
- where a.workprocid not in (select t.workprocid from EMS_PRODPLAN_MONTH t where t.may = to_date(#{may},'yyyy-MM-dd'))
- ) c
- </select>
- <select id="getDateLc" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- select t.id,t.may,t.workprocid,t.weight_month,t.unit,t.kxf_weight,t.yxf_weight,t.sqno from EMS_PRODPLAN_MONTH t
- <where>
- <if test="type != null and type != ''">
- <if test="type=='gx'">
- and t.workprocid in ('AT2005','AT2006')
- </if>
- <if test="type =='lg'">
- and t.workprocid = 'AT2004'
- </if>
- <if test="type == 'xg'">
- and t.workprocid ='AT2007'
- </if>
- </if>
- <if test="may != null">
- and trunc(t.may) = to_date(#{may},'yyyy-mm')
- </if>
- <if test="workprocid != null and workprocid != '' ">
- and t.workprocid = #{workprocid}
- </if>
- </where>
- </select>
- <select id="getBymayAndWorkprocid" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- select t.* from EMS_PRODPLAN_MONTH t
- <where>
- <if test="may != null and may != '' " >
- and trunc(t.may) = to_date(#{may},'yyyy-mm')
- </if>
- <if test="workprocid != null and workprocid != '' " >
- and t.workprocid = #{workprocid}
- </if>
- <if test="id != null and id != '' " >
- and t.id = #{id}
- </if>
- </where>
- </select>
-
- <select id="getMaxSqno" resultMap="BaseResultMap">
- select nvl(max(t.sqno+1),0) sqno from ems_prodplan_month t
- </select>
- </mapper>
|