|
@@ -0,0 +1,335 @@
|
|
|
+<?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.dil.mapper.SaleLogMapper">
|
|
|
+ <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.SaleLog">
|
|
|
+ <id column="RESULT_ID" jdbcType="DECIMAL" property="resultId" />
|
|
|
+ <result column="ORDER_ID" jdbcType="DECIMAL" property="orderId" />
|
|
|
+ <result column="SALE_ORDER_ID" jdbcType="DECIMAL" property="saleOrderId" />
|
|
|
+ <result column="DESCRIPTION" jdbcType="VARCHAR" property="description" />
|
|
|
+ <result column="OPRATION_TYPE" jdbcType="VARCHAR" property="oprationType" />
|
|
|
+ <result column="JSON_DATA" jdbcType="VARCHAR" property="jsonData" />
|
|
|
+ <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
|
|
|
+ <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
|
|
|
+ </resultMap>
|
|
|
+ <sql id="columns">
|
|
|
+ RESULT_ID, ORDER_ID, SALE_ORDER_ID, DESCRIPTION, OPRATION_TYPE, JSON_DATA, INSERT_TIME,
|
|
|
+ INSERT_USERNAME
|
|
|
+ </sql>
|
|
|
+ <sql id="columns_alias">
|
|
|
+ t.RESULT_ID, t.ORDER_ID, t.SALE_ORDER_ID, t.DESCRIPTION, t.OPRATION_TYPE, t.JSON_DATA,
|
|
|
+ t.INSERT_TIME, t.INSERT_USERNAME
|
|
|
+ </sql>
|
|
|
+ <sql id="select">
|
|
|
+ SELECT <include refid="columns"/> FROM SALE_LOG
|
|
|
+ </sql>
|
|
|
+ <sql id="select_alias">
|
|
|
+ SELECT <include refid="columns_alias"/> FROM SALE_LOG t
|
|
|
+ </sql>
|
|
|
+ <sql id="where">
|
|
|
+ <where>
|
|
|
+ <if test="resultId != null">
|
|
|
+ and RESULT_ID = #{resultId}
|
|
|
+ </if>
|
|
|
+ <if test="orderId != null">
|
|
|
+ and ORDER_ID = #{orderId}
|
|
|
+ </if>
|
|
|
+ <if test="saleOrderId != null">
|
|
|
+ and SALE_ORDER_ID = #{saleOrderId}
|
|
|
+ </if>
|
|
|
+ <if test="description != null and description != ''">
|
|
|
+ and DESCRIPTION = #{description}
|
|
|
+ </if>
|
|
|
+ <if test="oprationType != null and oprationType != ''">
|
|
|
+ and OPRATION_TYPE = #{oprationType}
|
|
|
+ </if>
|
|
|
+ <if test="jsonData != null and jsonData != ''">
|
|
|
+ and JSON_DATA = #{jsonData}
|
|
|
+ </if>
|
|
|
+ <if test="insertTime != null">
|
|
|
+ and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
|
|
|
+ </if>
|
|
|
+ <if test="insertUsername != null and insertUsername != ''">
|
|
|
+ and INSERT_USERNAME = #{insertUsername}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+ <sql id="whereLike">
|
|
|
+ <where>
|
|
|
+ <if test="resultId != null">
|
|
|
+ and RESULT_ID = #{resultId}
|
|
|
+ </if>
|
|
|
+ <if test="orderId != null">
|
|
|
+ and ORDER_ID = #{orderId}
|
|
|
+ </if>
|
|
|
+ <if test="saleOrderId != null">
|
|
|
+ and SALE_ORDER_ID = #{saleOrderId}
|
|
|
+ </if>
|
|
|
+ <if test="description != null and description != ''">
|
|
|
+ and DESCRIPTION LIKE '%${description}%'
|
|
|
+ </if>
|
|
|
+ <if test="oprationType != null and oprationType != ''">
|
|
|
+ and OPRATION_TYPE LIKE '%${oprationType}%'
|
|
|
+ </if>
|
|
|
+ <if test="jsonData != null and jsonData != ''">
|
|
|
+ and JSON_DATA LIKE '%${jsonData}%'
|
|
|
+ </if>
|
|
|
+ <if test="insertTime != null">
|
|
|
+ and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
|
|
|
+ </if>
|
|
|
+ <if test="insertUsername != null and insertUsername != ''">
|
|
|
+ and INSERT_USERNAME LIKE '%${insertUsername}%'
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+ <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
|
|
|
+ delete from SALE_LOG
|
|
|
+ where RESULT_ID = #{resultId,jdbcType=DECIMAL}
|
|
|
+ </delete>
|
|
|
+ <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
|
|
|
+ delete from SALE_LOG
|
|
|
+ where 1!=1
|
|
|
+ <if test="orderId != null">
|
|
|
+ or ORDER_ID = #{orderId}
|
|
|
+ </if>
|
|
|
+ <if test="saleOrderId != null">
|
|
|
+ or SALE_ORDER_ID = #{saleOrderId}
|
|
|
+ </if>
|
|
|
+ <if test="description != null and description != ''">
|
|
|
+ or DESCRIPTION = #{description}
|
|
|
+ </if>
|
|
|
+ <if test="oprationType != null and oprationType != ''">
|
|
|
+ or OPRATION_TYPE = #{oprationType}
|
|
|
+ </if>
|
|
|
+ <if test="jsonData != null and jsonData != ''">
|
|
|
+ or JSON_DATA = #{jsonData}
|
|
|
+ </if>
|
|
|
+ <if test="insertTime != null">
|
|
|
+ or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
|
|
|
+ </if>
|
|
|
+ <if test="insertUsername != null and insertUsername != ''">
|
|
|
+ or INSERT_USERNAME = #{insertUsername}
|
|
|
+ </if>
|
|
|
+ </delete>
|
|
|
+ <insert id="insert" parameterType="com.steerinfo.dil.model.SaleLog">
|
|
|
+ insert into SALE_LOG (RESULT_ID, ORDER_ID, SALE_ORDER_ID,
|
|
|
+ DESCRIPTION, OPRATION_TYPE, JSON_DATA,
|
|
|
+ INSERT_TIME, INSERT_USERNAME)
|
|
|
+ values (#{resultId,jdbcType=DECIMAL}, #{orderId,jdbcType=DECIMAL}, #{saleOrderId,jdbcType=DECIMAL},
|
|
|
+ #{description,jdbcType=VARCHAR}, #{oprationType,jdbcType=VARCHAR}, #{jsonData,jdbcType=VARCHAR},
|
|
|
+ #{insertTime,jdbcType=TIMESTAMP}, #{insertUsername,jdbcType=VARCHAR})
|
|
|
+ </insert>
|
|
|
+ <insert id="insertSelective" parameterType="com.steerinfo.dil.model.SaleLog">
|
|
|
+ insert into SALE_LOG
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="resultId != null">
|
|
|
+ RESULT_ID,
|
|
|
+ </if>
|
|
|
+ <if test="orderId != null">
|
|
|
+ ORDER_ID,
|
|
|
+ </if>
|
|
|
+ <if test="saleOrderId != null">
|
|
|
+ SALE_ORDER_ID,
|
|
|
+ </if>
|
|
|
+ <if test="description != null">
|
|
|
+ DESCRIPTION,
|
|
|
+ </if>
|
|
|
+ <if test="oprationType != null">
|
|
|
+ OPRATION_TYPE,
|
|
|
+ </if>
|
|
|
+ <if test="jsonData != null">
|
|
|
+ JSON_DATA,
|
|
|
+ </if>
|
|
|
+ <if test="insertTime != null">
|
|
|
+ INSERT_TIME,
|
|
|
+ </if>
|
|
|
+ <if test="insertUsername != null">
|
|
|
+ INSERT_USERNAME,
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="resultId != null">
|
|
|
+ #{resultId,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="orderId != null">
|
|
|
+ #{orderId,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="saleOrderId != null">
|
|
|
+ #{saleOrderId,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="description != null">
|
|
|
+ #{description,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="oprationType != null">
|
|
|
+ #{oprationType,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="jsonData != null">
|
|
|
+ #{jsonData,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="insertTime != null">
|
|
|
+ #{insertTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="insertUsername != null">
|
|
|
+ #{insertUsername,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+ <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.SaleLog">
|
|
|
+ update SALE_LOG
|
|
|
+ set ORDER_ID = #{orderId,jdbcType=DECIMAL},
|
|
|
+ SALE_ORDER_ID = #{saleOrderId,jdbcType=DECIMAL},
|
|
|
+ DESCRIPTION = #{description,jdbcType=VARCHAR},
|
|
|
+ OPRATION_TYPE = #{oprationType,jdbcType=VARCHAR},
|
|
|
+ JSON_DATA = #{jsonData,jdbcType=VARCHAR},
|
|
|
+ INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
|
|
|
+ INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR}
|
|
|
+ where RESULT_ID = #{resultId,jdbcType=DECIMAL}
|
|
|
+ </update>
|
|
|
+ <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.SaleLog">
|
|
|
+ update SALE_LOG
|
|
|
+ <set>
|
|
|
+ <if test="orderId != null">
|
|
|
+ ORDER_ID = #{orderId,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="saleOrderId != null">
|
|
|
+ SALE_ORDER_ID = #{saleOrderId,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="description != null">
|
|
|
+ DESCRIPTION = #{description,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="oprationType != null">
|
|
|
+ OPRATION_TYPE = #{oprationType,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="jsonData != null">
|
|
|
+ JSON_DATA = #{jsonData,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="insertTime != null">
|
|
|
+ INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="insertUsername != null">
|
|
|
+ INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where RESULT_ID = #{resultId,jdbcType=DECIMAL}
|
|
|
+ </update>
|
|
|
+ <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
|
|
|
+ <include refid="select"/>
|
|
|
+ where RESULT_ID = #{resultId,jdbcType=DECIMAL}
|
|
|
+ </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 SALE_LOG
|
|
|
+ (RESULT_ID,
|
|
|
+ ORDER_ID, SALE_ORDER_ID, DESCRIPTION,
|
|
|
+ OPRATION_TYPE, JSON_DATA, INSERT_TIME,
|
|
|
+ INSERT_USERNAME)
|
|
|
+ ( <foreach collection="list" item="item" separator="union all">
|
|
|
+ select
|
|
|
+ #{item.resultId,jdbcType=DECIMAL},
|
|
|
+ #{item.orderId,jdbcType=DECIMAL}, #{item.saleOrderId,jdbcType=DECIMAL}, #{item.description,jdbcType=VARCHAR},
|
|
|
+ #{item.oprationType,jdbcType=VARCHAR}, #{item.jsonData,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
|
|
|
+ #{item.insertUsername,jdbcType=VARCHAR} from dual
|
|
|
+ </foreach> )
|
|
|
+ </insert>
|
|
|
+ <update id="batchUpdate" parameterType="java.util.List">
|
|
|
+ update SALE_LOG
|
|
|
+ set
|
|
|
+ RESULT_ID=
|
|
|
+ <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
|
|
|
+ when #{item.resultId,jdbcType=DECIMAL} then #{item.resultId,jdbcType=DECIMAL}
|
|
|
+ </foreach>
|
|
|
+ ,ORDER_ID=
|
|
|
+ <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
|
|
|
+ when #{item.resultId,jdbcType=DECIMAL} then #{item.orderId,jdbcType=DECIMAL}
|
|
|
+ </foreach>
|
|
|
+ ,SALE_ORDER_ID=
|
|
|
+ <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
|
|
|
+ when #{item.resultId,jdbcType=DECIMAL} then #{item.saleOrderId,jdbcType=DECIMAL}
|
|
|
+ </foreach>
|
|
|
+ ,DESCRIPTION=
|
|
|
+ <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
|
|
|
+ when #{item.resultId,jdbcType=DECIMAL} then #{item.description,jdbcType=VARCHAR}
|
|
|
+ </foreach>
|
|
|
+ ,OPRATION_TYPE=
|
|
|
+ <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
|
|
|
+ when #{item.resultId,jdbcType=DECIMAL} then #{item.oprationType,jdbcType=VARCHAR}
|
|
|
+ </foreach>
|
|
|
+ ,JSON_DATA=
|
|
|
+ <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
|
|
|
+ when #{item.resultId,jdbcType=DECIMAL} then #{item.jsonData,jdbcType=VARCHAR}
|
|
|
+ </foreach>
|
|
|
+ ,INSERT_TIME=
|
|
|
+ <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
|
|
|
+ when #{item.resultId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
|
|
|
+ </foreach>
|
|
|
+ ,INSERT_USERNAME=
|
|
|
+ <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
|
|
|
+ when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
|
|
|
+ </foreach>
|
|
|
+ where RESULT_ID in
|
|
|
+ <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
|
|
|
+ #{item.resultId,jdbcType=DECIMAL}
|
|
|
+ </foreach>
|
|
|
+ </update>
|
|
|
+ <delete id="batchDelete" parameterType="java.util.List">
|
|
|
+ delete from SALE_LOG
|
|
|
+ where RESULT_ID in
|
|
|
+ <foreach collection="list" item="id" open="(" close=")" separator=",">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+ <!-- 友情提示!!!-->
|
|
|
+ <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
|
|
|
+ <select id="selectAllLog" resultType="java.util.Map">
|
|
|
+ SELECT
|
|
|
+ OO .ORDER_NUMBER "orderNumber",
|
|
|
+ ASO .SALE_NUMBER "saleNumber",
|
|
|
+ RC .CAPACITY_NUMBER "capacityNumber",
|
|
|
+ SL .DESCRIPTION "description",
|
|
|
+ SL .OPRATION_TYPE "operationType",
|
|
|
+ SL .INSERT_USERNAME "insertUserName",
|
|
|
+ SL .INSERT_TIME "insertTime"
|
|
|
+ FROM SALE_LOG SL
|
|
|
+ LEFT JOIN OMSTRUCK_ORDER OO ON OO .ORDER_ID =SL .ORDER_ID
|
|
|
+ LEFT JOIN AMS_SALE_ORDER ASO ON ASO .SALE_ORDER_ID = SL .SALE_ORDER_ID
|
|
|
+ LEFT JOIN RMS_CAPACITY RC ON RC .CAPACITY_ID=OO .CAPACITY_ID
|
|
|
+ <where>
|
|
|
+ <if test="con!=null and con!=''.toString()">
|
|
|
+ OO .ORDER_NUMBER || ASO .SALE_NUMBER || RC .CAPACITY_NUMBER || SL .DESCRIPTION
|
|
|
+ LIKE CONCAT('%',CONCAT(#{con},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="orderId!=null ">
|
|
|
+ AND SL .ORDER_ID = #{orderId}
|
|
|
+ </if>
|
|
|
+ <if test="saleOrderId!=null ">
|
|
|
+ AND SL .SALE_ORDER_ID = #{saleOrderId}
|
|
|
+ </if>
|
|
|
+ <if test="operationType!=null">
|
|
|
+ AND SL .OPRATION_TYPE in
|
|
|
+ <foreach collection="operationType" item="item" open="(" separator="," close=")" >
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="capacityNumber!=null">
|
|
|
+ AND RC .CAPACITY_NUMBER in
|
|
|
+ <foreach collection="capacityNumber" item="item" open="(" separator="," close=")" >
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+ <select id="getUserNameById" resultType="java.lang.String">
|
|
|
+ SELECT USER_NAME FROM SSO.SYS_USER
|
|
|
+ WHERE USER_ID = #{userId}
|
|
|
+ FETCH NEXT 1 ROWS ONLY
|
|
|
+ </select>
|
|
|
+ <select id="getOrderIds" resultType="java.math.BigDecimal">
|
|
|
+ SELECT DISTINCT ORDER_ID FROM OMSTRUCK_ORDER WHERE ORDER_NUMBER = #{orderNumber}
|
|
|
+ </select>
|
|
|
+</mapper>
|