123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- <?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.quotation.mapper.TSeapriceMapper">
- <resultMap type="TSeaprice" id="TSeapriceResult">
- <result property="fId" column="f_id"/>
- <result property="fBilltype" column="f_billtype"/>
- <result property="fCorpid" column="f_corpid"/>
- <result property="polId" column="pol_id"/>
- <result property="podId" column="pod_id"/>
- <result property="fValiddate" column="f_validdate"/>
- <result property="fDateChanged" column="f_date_changed"/>
- <result property="fBillstatus" column="f_billstatus"/>
- <result property="delFlag" column="del_flag"/>
- <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="remarks" column="remarks"/>
- <result property="fLineid" column="f_lineid"/>
- <result property="fBookagentid" column="f_bookagentid"/>
- </resultMap>
- <sql id="selectTSeapriceVo">
- select f_id,
- f_billtype,
- f_corpid,
- pol_id,
- pod_id,
- f_validdate,
- f_date_changed,
- f_billstatus,
- del_flag,
- create_by,
- create_time,
- update_by,
- update_time,
- remarks,
- f_lineid,
- f_bookagentid
- from t_seaprice
- </sql>
- <select id="selectTSeapriceList" parameterType="TSeaprice" resultMap="TSeapriceResult">
- <include refid="selectTSeapriceVo"/>
- <where>
- <if test="fBilltype != null ">and f_billtype = #{fBilltype}</if>
- <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
- <if test="polId != null ">and pol_id = #{polId}</if>
- <if test="podId != null ">and pod_id = #{podId}</if>
- <if test="fBillstatus != null ">and f_billstatus = #{fBillstatus}</if>
- <if test="remarks != null and remarks != ''">and remarks = #{remarks}</if>
- <if test='validdateList != null and validdateList[0] != null and validdateList[0]!= ""'>
- and f_validdate >= #{validdateList[0]}
- </if>
- <if test='validdateList != null and validdateList[1] != null and validdateList[1]!= ""'>
- and f_validdate <= #{validdateList[1]}
- </if>
- <if test="fLineid != null and fLineid != ''">and f_lineid = #{fLineid}</if>
- <if test="fBookagentid != null and fBookagentid != ''">and f_bookagentid = #{fBookagentid}</if>
- </where>
- </select>
- <select id="selectTSeapriceById" parameterType="Long" resultMap="TSeapriceResult">
- <include refid="selectTSeapriceVo"/>
- where f_id = #{fId}
- </select>
- <select id="selectTSeapriceMapList" parameterType="TSeaprice" resultType="Map">
- SELECT
- s.f_id fId,
- t.dict_label fBilltype,
- c.f_cname fCorpid,
- CASE
- WHEN s.f_billstatus = '0' THEN
- '正常'
- WHEN s.f_billstatus = '1' THEN
- '停用'
- END AS fBillstatus,
- pol.dict_label polId,
- pod.dict_label podId,
- s.create_by createBy,
- s.f_validdate fValiddate,
- s.remarks,
- s.f_lineid fLineid,
- s.f_bookagentid fBookagentid,
- j.f_name fLineName,
- q.f_name fBookagentName
- FROM
- t_seaprice s
- LEFT JOIN sys_dict_data t ON t.dict_value = s.f_billtype AND t.dict_type = 'data_billType'
- LEFT JOIN sys_dict_data pol ON pol.dict_value = s.pol_id AND pol.dict_type = 'port_start'
- LEFT JOIN sys_dict_data pod ON pod.dict_value = s.pod_id AND pod.dict_type = 'port_end'
- LEFT JOIN t_corps c ON c.f_id = s.f_corpid
- LEFT JOIN t_address j ON s.f_lineid = j.f_id
- LEFT JOIN t_corps q ON s.f_bookagentid = q.f_id
- <where>
- <if test="fBilltype != null ">and s.f_billtype = #{fBilltype}</if>
- <if test="fCorpid != null ">and s.f_corpid = #{fCorpid}</if>
- <if test="polId != null ">and s.pol_id = #{polId}</if>
- <if test="podId != null ">and s.pod_id = #{podId}</if>
- <if test="fValiddate != null ">and s.f_validdate = #{fValiddate}</if>
- <if test="fBillstatus != null ">and s.f_billstatus = #{fBillstatus}</if>
- <if test="remarks != null and remarks != ''">and remarks = #{remarks}</if>
- </where>
- ORDER BY s.f_id DESC
- </select>
- <select id="checkSeapriceByValiddate" parameterType="TSeaprice" resultType="int">
- SELECT COUNT(f_id)
- FROM t_seaprice
- WHERE f_id != #{fId}
- AND f_billtype = #{fBilltype}
- AND f_corpid = #{fCorpid}
- AND pol_id = #{polId}
- AND pod_id = #{podId}
- AND pod_id = #{podId}
- AND f_validdate >= #{fValiddate}
- </select>
- <select id="selectSeapriceItemAmt" parameterType="TSeaprice" resultType="BigDecimal">
- SELECT IFNULL(SUM(IF(#{fType} = '0', s.${fSpecification}, s.f_unitprice)), 0)
- FROM t_seaprice t
- LEFT JOIN t_seapriceitem s ON s.f_pid = t.f_id
- WHERE t.f_billtype = #{fBilltype}
- AND t.f_corpid = #{fCorpid}
- AND t.f_validdate >= #{fValiddate}
- AND t.f_billstatus = 0
- AND t.del_flag = '0'
- AND s.f_type = #{fType}
- </select>
- <select id="selectSeapriceItem" parameterType="TSeaprice" resultType="Map">
- SELECT f.f_name fFeeid,
- IF
- (s.f_type = '0', s.${fSpecification}, s.f_unitprice) fUnitprice
- FROM t_seaprice t
- LEFT JOIN t_seapriceitem s ON s.f_pid = t.f_id
- LEFT JOIN t_fees f ON f.f_id = s.f_feeid
- WHERE t.f_billtype = #{fBilltype}
- AND t.f_corpid = #{fCorpid}
- AND t.f_validdate >= #{fValiddate}
- AND t.f_billstatus = 0
- AND t.del_flag = '0'
- AND f.f_name != '海运费'
- ORDER BY s.f_type, s.f_id asc
- </select>
- <select id="selectShippingFee" parameterType="TSeaprice" resultType="com.ruoyi.quotation.domain.TSeapriceitem">
- SELECT s.f_id fId,
- s.f_feeid fFeeid,
- IFNULL(s.${fSpecification}, 0) fUnitprice,
- IFNULL(s.f_exrate, 0) fExrate,
- IFNULL(IFNULL(s.${fSpecification}, 0) * IFNULL(s.f_exrate, 0), 0) rmb
- FROM t_seaprice t
- LEFT JOIN t_seapriceitem s ON s.f_pid = t.f_id
- LEFT JOIN t_fees f ON f.f_id = s.f_feeid
- WHERE t.f_billtype = #{fBilltype}
- AND t.f_corpid = #{fCorpid}
- AND t.f_validdate >= #{fValiddate}
- AND t.f_billstatus = 0
- AND t.del_flag = '0'
- AND f.f_name = '海运费'
- ORDER BY s.f_id asc
- LIMIT 0, 1
- </select>
- <insert id="insertTSeaprice" parameterType="TSeaprice" useGeneratedKeys="true" keyProperty="fId">
- insert into t_seaprice
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="fBilltype != null">f_billtype,</if>
- <if test="fCorpid != null">f_corpid,</if>
- <if test="polId != null">pol_id,</if>
- <if test="podId != null">pod_id,</if>
- <if test="fValiddate != null">f_validdate,</if>
- <if test="fDateChanged != null">f_date_changed,</if>
- <if test="fBillstatus != null">f_billstatus,</if>
- <if test="delFlag != null">del_flag,</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="remarks != null">remarks,</if>
- <if test="fLineid != null">f_lineid,</if>
- <if test="fBookagentid != null">f_bookagentid,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="fBilltype != null">#{fBilltype},</if>
- <if test="fCorpid != null">#{fCorpid},</if>
- <if test="polId != null">#{polId},</if>
- <if test="podId != null">#{podId},</if>
- <if test="fValiddate != null">#{fValiddate},</if>
- <if test="fDateChanged != null">#{fDateChanged},</if>
- <if test="fBillstatus != null">#{fBillstatus},</if>
- <if test="delFlag != null">#{delFlag},</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="remarks != null">#{remarks},</if>
- <if test="fLineid != null">#{fLineid},</if>
- <if test="fBookagentid != null">#{fBookagentid},</if>
- </trim>
- </insert>
- <update id="updateTSeaprice" parameterType="TSeaprice">
- update t_seaprice
- <trim prefix="SET" suffixOverrides=",">
- <if test="fBilltype != null">f_billtype = #{fBilltype},</if>
- <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
- <if test="polId != null">pol_id = #{polId},</if>
- <if test="podId != null">pod_id = #{podId},</if>
- <if test="fValiddate != null">f_validdate = #{fValiddate},</if>
- <if test="fBillstatus != null">f_billstatus = #{fBillstatus},</if>
- <if test="fDateChanged != null">f_date_changed = #{fDateChanged},</if>
- <if test="delFlag != null">del_flag = #{delFlag},</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="remarks != null">remarks = #{remarks},</if>
- <if test="fLineid != null">f_lineid = #{fLineid},</if>
- <if test="fBookagentid != null">f_bookagentid = #{fBookagentid},</if>
- </trim>
- where f_id = #{fId}
- </update>
- <delete id="deleteTSeapriceById" parameterType="Long">
- delete
- from t_seaprice
- where f_id = #{fId}
- </delete>
- <delete id="deleteTSeapriceByIds" parameterType="String">
- delete from t_seaprice where f_id in
- <foreach item="fId" collection="array" open="(" separator="," close=")">
- #{fId}
- </foreach>
- </delete>
- </mapper>
|