148 lines
8.4 KiB
XML
148 lines
8.4 KiB
XML
<?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.xdadan.erp.emis.mapper.EmisExchangeRateMapper">
|
|
|
|
<resultMap type="EmisExchangeRate" id="EmisExchangeRateResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
|
|
<result property="id" column="id" />
|
|
<result property="currency" column="currency" />
|
|
<result property="destCurrency" column="dest_currency" />
|
|
<result property="rate" column="rate" />
|
|
<result property="startDate" column="start_date" />
|
|
<result property="endDate" column="end_date" />
|
|
<result property="blValid" column="bl_valid" />
|
|
</resultMap>
|
|
|
|
<sql id="selectEmisExchangeRateVo">
|
|
select id, currency, dest_currency, rate, start_date, end_date, bl_valid, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site from emis_exchange_rate
|
|
</sql>
|
|
|
|
<select id="selectEmisExchangeRateList" parameterType="EmisExchangeRate" resultMap="EmisExchangeRateResult">
|
|
<include refid="selectEmisExchangeRateVo"/>
|
|
<where>
|
|
del_flag='0'
|
|
<if test="id != null "> and id = #{id}</if>
|
|
<if test="currency != null and currency != ''"> and currency like concat('%', #{currency}, '%')</if>
|
|
<if test="destCurrency != null and destCurrency != ''"> and dest_currency like concat('%', #{destCurrency}, '%')</if>
|
|
<if test="rate != null and rate != ''"> and rate like concat('%', #{rate}, '%')</if>
|
|
<if test="startDate != null "> and start_date = #{startDate}</if>
|
|
<if test="endDate != null "> and end_date = #{endDate}</if>
|
|
<if test="blValid != null and blValid != ''"> and bl_valid like concat('%', #{blValid}, '%')</if>
|
|
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
|
|
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
|
|
<if test="createTime != null "> and create_time = #{createTime}</if>
|
|
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
|
|
<if test="updateTime != null "> and update_time = #{updateTime}</if>
|
|
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
|
|
<if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>
|
|
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
|
|
</where>
|
|
order by create_time desc
|
|
</select>
|
|
|
|
<select id="checkUnique" parameterType="EmisExchangeRate" resultType="int">
|
|
select count(1) from emis_exchange_rate
|
|
where
|
|
del_flag='0'
|
|
<if test="id != null "> and id != #{id}</if>
|
|
and currency = #{currency}
|
|
and dest_currency = #{destCurrency}
|
|
and (
|
|
(start_date <![CDATA[ <= ]]> #{startDate} and #{startDate} <![CDATA[ <= ]]> end_date )
|
|
or
|
|
(start_date <![CDATA[ <= ]]> #{endDate} and #{endDate} <![CDATA[ <= ]]> end_date )
|
|
)
|
|
|
|
limit 1
|
|
</select>
|
|
|
|
<select id="selectEmisExchangeRateById" parameterType="Long" resultMap="EmisExchangeRateResult">
|
|
select id, currency, dest_currency, rate, start_date, end_date, bl_valid, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site
|
|
from emis_exchange_rate a
|
|
where a.id = #{id}
|
|
</select>
|
|
|
|
<select id="getValidExchangeRate" parameterType="String" resultMap="EmisExchangeRateResult">
|
|
select id, currency, dest_currency, rate, start_date, end_date, bl_valid, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site
|
|
from emis_exchange_rate a
|
|
where a.currency=#{from} and a.dest_currency=#{to}
|
|
<if test="rateDate != null and rateDate != ''">
|
|
and start_date <![CDATA[ <= ]]> #{rateDate} and #{rateDate} <![CDATA[ <= ]]> end_date
|
|
</if>
|
|
<if test="rateDate == null">
|
|
and start_date <![CDATA[ <= ]]> now() and now() <![CDATA[ <= ]]> end_date
|
|
</if>
|
|
|
|
</select>
|
|
|
|
<insert id="insertEmisExchangeRate" parameterType="EmisExchangeRate" useGeneratedKeys="true" keyProperty="id">
|
|
insert into emis_exchange_rate
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">id,</if>
|
|
<if test="currency != null and currency != ''">currency,</if>
|
|
<if test="destCurrency != null and destCurrency != ''">dest_currency,</if>
|
|
<if test="rate != null and rate != ''">rate,</if>
|
|
<if test="startDate != null">start_date,</if>
|
|
<if test="endDate != null">end_date,</if>
|
|
<if test="blValid != null and blValid != ''">bl_valid,</if>
|
|
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="remark != null and remark != ''">remark,</if>
|
|
<if test="createSite != null and createSite != ''">create_site,</if>
|
|
<if test="updateSite != null and updateSite != ''">update_site,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">#{id},</if>
|
|
<if test="currency != null and currency != ''">#{currency},</if>
|
|
<if test="destCurrency != null and destCurrency != ''">#{destCurrency},</if>
|
|
<if test="rate != null and rate != ''">#{rate},</if>
|
|
<if test="startDate != null">#{startDate},</if>
|
|
<if test="endDate != null">#{endDate},</if>
|
|
<if test="blValid != null and blValid != ''">#{blValid},</if>
|
|
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="remark != null and remark != ''">#{remark},</if>
|
|
<if test="createSite != null and createSite != ''">#{createSite},</if>
|
|
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateEmisExchangeRate" parameterType="EmisExchangeRate">
|
|
update emis_exchange_rate
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="currency != null and currency != ''">currency = #{currency},</if>
|
|
<if test="destCurrency != null and destCurrency != ''">dest_currency = #{destCurrency},</if>
|
|
<if test="rate != null and rate != ''">rate = #{rate},</if>
|
|
<if test="startDate != null">start_date = #{startDate},</if>
|
|
<if test="endDate != null">end_date = #{endDate},</if>
|
|
<if test="blValid != null and blValid != ''">bl_valid = #{blValid},</if>
|
|
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
|
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
|
<if test="createSite != null and createSite != ''">create_site = #{createSite},</if>
|
|
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteEmisExchangeRateById" parameterType="Long">
|
|
delete from emis_exchange_rate where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteEmisExchangeRateByIds" parameterType="String">
|
|
delete from emis_exchange_rate where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |