ExchangeRateMapper.xml
3.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?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.lhcredit.project.business.exchangeRate.mapper.ExchangeRateMapper">
<resultMap type="ExchangeRate" id="ExchangeRateResult">
<result property="id" column="id" />
<result property="sourceUrrency" column="source_urrency" />
<result property="usdCurrency" column="usd_currency" />
<result property="rate" column="rate" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectExchangeRateVo">
select id, source_urrency, usd_currency, rate, remark, create_time from exchange_rate
</sql>
<select id="selectExchangeRateList" parameterType="ExchangeRate" resultMap="ExchangeRateResult">
<include refid="selectExchangeRateVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="sourceUrrency != null and sourceUrrency != '' "> and source_urrency = #{sourceUrrency}</if>
<if test="usdCurrency != null and usdCurrency != '' "> and usd_currency = #{usdCurrency}</if>
<if test="rate != null "> and rate = #{rate}</if>
<if test="remark != null and remark != '' "> and remark = #{remark}</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
</where>
</select>
<select id="selectExchangeRateById" parameterType="Integer" resultMap="ExchangeRateResult">
<include refid="selectExchangeRateVo"/>
where id = #{id}
</select>
<select id="selectExchangeRateBySourceurrency" parameterType="String" resultMap="ExchangeRateResult">
<include refid="selectExchangeRateVo"/>
where source_urrency = #{sourceUrrency}
</select>
<insert id="insertExchangeRate" parameterType="ExchangeRate" useGeneratedKeys="true" keyProperty="id">
insert into exchange_rate
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sourceUrrency != null and sourceUrrency != '' ">source_urrency,</if>
<if test="usdCurrency != null and usdCurrency != '' ">usd_currency,</if>
<if test="rate != null ">rate,</if>
<if test="remark != null and remark != '' ">remark,</if>
<if test="createTime != null ">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sourceUrrency != null and sourceUrrency != '' ">#{sourceUrrency},</if>
<if test="usdCurrency != null and usdCurrency != '' ">#{usdCurrency},</if>
<if test="rate != null ">#{rate},</if>
<if test="remark != null and remark != '' ">#{remark},</if>
<if test="createTime != null ">#{createTime},</if>
</trim>
</insert>
<update id="updateExchangeRate" parameterType="ExchangeRate">
update exchange_rate
<trim prefix="SET" suffixOverrides=",">
<if test="sourceUrrency != null and sourceUrrency != '' ">source_urrency = #{sourceUrrency},</if>
<if test="usdCurrency != null and usdCurrency != '' ">usd_currency = #{usdCurrency},</if>
<if test="rate != null ">rate = #{rate},</if>
<if test="remark != null and remark != '' ">remark = #{remark},</if>
<if test="createTime != null ">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteExchangeRateById" parameterType="Integer">
delete from exchange_rate where id = #{id}
</delete>
<delete id="deleteExchangeRateByIds" parameterType="String">
delete from exchange_rate where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>