123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <?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.ruoyi.shipping.mapper.TCtnpriceItemsMapper">
- <resultMap type="TCtnpriceItems" id="TCtnpriceItemsResult">
- <result property="fId" column="f_id"/>
- <result property="fPid" column="f_pid"/>
- <result property="fCntrid" column="f_cntrid"/>
- <result property="fPrice" column="f_price"/>
- <result property="fStatus" column="f_status"/>
- <result property="createBy" column="create_by"/>
- <result property="createTime" column="create_time"/>
- <result property="updateBy" column="update_by"/>
- <result property="updateTime" column="update_time"/>
- <result property="remark" column="remark"/>
- </resultMap>
- <sql id="selectTCtnpriceItemsVo">
- select f_id,
- f_pid,
- f_cntrid,
- f_price,
- f_status,
- create_by,
- create_time,
- update_by,
- update_time,
- remark
- from t_ctnprice_items
- </sql>
- <select id="selectTCtnpriceItemsList" parameterType="TCtnpriceItems" resultMap="TCtnpriceItemsResult">
- SELECT
- ti.f_id,
- ti.f_pid,
- ti.f_cntrid,
- tc.f_no cntridName,
- ti.f_price,
- CASE
- WHEN ti.f_status = 'T' THEN
- '正常' ELSE '停用'
- END AS f_status,
- ti.create_by,
- ti.create_time,
- ti.update_by,
- ti.update_time,
- ti.remark
- FROM
- t_ctnprice_items ti
- LEFT JOIN t_cntr tc ON ti.f_cntrid = tc.f_id
- <where>
- <if test="fPid != null ">and ti.f_pid = #{fPid}</if>
- <if test="fCntrid != null ">and ti.f_cntrid = #{fCntrid}</if>
- <if test="fPrice != null ">and ti.f_price = #{fPrice}</if>
- <if test="fStatus != null and fStatus != ''">and ti.f_status = #{fStatus}</if>
- <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
- and ti.create_time >= #{cLoadDate[0]}
- </if>
- <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
- and ti.create_time <= #{cLoadDate[1]}
- </if>
- </where>
- </select>
- <select id="selectTCtnpriceItemsById" parameterType="Long" resultMap="TCtnpriceItemsResult">
- <include refid="selectTCtnpriceItemsVo"/>
- where f_id = #{fId}
- </select>
- <insert id="insertTCtnpriceItems" parameterType="TCtnpriceItems" useGeneratedKeys="true" keyProperty="fId">
- insert into t_ctnprice_items
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="fPid != null">f_pid,</if>
- <if test="fCntrid != null">f_cntrid,</if>
- <if test="fPrice != null">f_price,</if>
- <if test="fStatus != null">f_status,</if>
- <if test="createBy != null">create_by,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateBy != null">update_by,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="remark != null">remark,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="fPid != null">#{fPid},</if>
- <if test="fCntrid != null">#{fCntrid},</if>
- <if test="fPrice != null">#{fPrice},</if>
- <if test="fStatus != null">#{fStatus},</if>
- <if test="createBy != null">#{createBy},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateBy != null">#{updateBy},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="remark != null">#{remark},</if>
- </trim>
- </insert>
- <update id="updateTCtnpriceItems" parameterType="TCtnpriceItems">
- update t_ctnprice_items
- <trim prefix="SET" suffixOverrides=",">
- <if test="fPid != null">f_pid = #{fPid},</if>
- <if test="fCntrid != null">f_cntrid = #{fCntrid},</if>
- <if test="fPrice != null">f_price = #{fPrice},</if>
- <if test="fStatus != null">f_status = #{fStatus},</if>
- <if test="createBy != null">create_by = #{createBy},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="remark != null">remark = #{remark},</if>
- </trim>
- where f_id = #{fId}
- </update>
- <delete id="deleteTCtnpriceItemsById" parameterType="Long">
- delete
- from t_ctnprice_items
- where f_id = #{fId}
- </delete>
- <delete id="deleteTCtnpriceItemsByIds" parameterType="String">
- delete from t_ctnprice_items where f_id in
- <foreach item="fId" collection="array" open="(" separator="," close=")">
- #{fId}
- </foreach>
- </delete>
- <delete id="deleteTCtnpriceItemsByfPid" parameterType="Long">
- delete
- from t_ctnprice_items
- where f_pid = #{fPid}
- </delete>
- <delete id="deleteTCtnpriceItemsByfPids" parameterType="Long">
- delete from t_ctnprice_items where f_pid in
- <foreach item="fPid" collection="array" open="(" separator="," close=")">
- #{fPid}
- </foreach>
- </delete>
- <select id="selectMoney" resultType="string">
- SELECT IFNULL(min(ti.f_price), 0) price
- FROM t_ctnprice_items ti
- LEFT JOIN t_ctnprice tc ON ti.f_pid = tc.f_id
- LEFT JOIN t_cntr tr ON ti.f_cntrid = tr.f_id
- WHERE tc.f_portofloadid = #{fPortofloadid}
- AND tc.f_distinationid = #{fDistinationid}
- AND tr.f_no = #{fNo}
- AND tc.f_status = 'T'
- AND ti.f_status = 'T'
- </select>
- <select id="selectPriceMoney" resultType="string">
- SELECT CASE
- WHEN
- ti.f_price IS NULL THEN
- 0
- ELSE ti.f_price END AS pric
- FROM t_ctnprice_items ti
- LEFT JOIN t_ctnprice tc ON ti.f_pid = tc.f_id
- LEFT JOIN t_cntr tr ON ti.f_cntrid = tr.f_id
- WHERE tc.f_portofloadid = #{fPortofloadid}
- AND tc.f_distinationid = #{fDistinationid}
- AND tr.f_no = #{fNo}
- AND tc.f_status = 'T'
- AND ti.f_status = 'T'
- <if test="fPortoftransshipment != null "> and tc.f_portoftransshipment = #{fPortoftransshipment}</if>
- <if test="fPortoftransshipment == null "> and tc.f_portoftransshipment IS NULL</if>
- </select>
- <select id="containerPrice" parameterType="object" resultType="long">
- SELECT ti.f_price
- FROM t_ctnprice_items ti
- LEFT JOIN t_cntr tc
- ON ti.f_cntrid = tc.f_id
- LEFT JOIN t_ctnprice tp ON ti.f_pid = tp.f_id
- WHERE tc.f_no = #{cntridName}
- AND tp.f_portofloadid = #{fPortofloadid}
- AND tp.f_distinationid = #{fDistinationid}
- AND #{fEtd} BETWEEN tp.f_begindate AND tp.f_end
- AND tc.f_status = 'T'
- AND tp.f_status = 'T'
- <if test="fPortoftransshipment != null">AND tp.f_portoftransshipment = #{fPortoftransshipment}</if>
- </select>
- <select id="selectItemMeaasge" parameterType="TCtnpriceItems" resultMap="TCtnpriceItemsResult">
- select f_id,
- f_pid,
- f_cntrid,
- f_price,
- f_status,
- create_by,
- create_time,
- update_by,
- update_time,
- remark
- from t_ctnprice_items
- where f_pid = #{fPid}
- AND f_cntrid = #{fCntrid}
- </select>
- </mapper>
|