CreditExchangeRateMapper.xml
4.14 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
86
87
<?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.creditExchangeRate.mapper.CreditExchangeRateMapper">
<resultMap type="com.lhcredit.project.business.creditExchangeRate.domain.CreditExchangeRate" id="CreditExchangeRateResult">
<result property="id" column="id" />
<result property="currency" column="currency" />
<result property="ratio" column="ratio" />
<result property="status" column="status" />
<result property="crateTime" column="crateTime" />
<result property="updateTime" column="updateTime" />
</resultMap>
<sql id="selectCreditExchangeRateVo">
select id, currency, ratio, status, crateTime, updateTime from credit_exchange_rate
</sql>
<select id="selectCreditExchangeRateList" parameterType="com.lhcredit.project.business.creditExchangeRate.domain.CreditExchangeRate" resultMap="CreditExchangeRateResult">
<include refid="selectCreditExchangeRateVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="currency != null and currency != '' "> and currency = #{currency}</if>
<if test="ratio != null "> and ratio = #{ratio}</if>
<if test="status != null and status != '' "> and status = #{status}</if>
<if test="crateTime != null "> and crateTime = #{crateTime}</if>
<if test="updateTime != null "> and updateTime = #{updateTime}</if>
</where>
</select>
<select id="selectCreditExchangeRateByStatus" parameterType="String" resultMap="CreditExchangeRateResult">
<include refid="selectCreditExchangeRateVo"/>
where status = #{status} and currency = #{currency}
</select>
<select id="selectCreditExchangeRateById" parameterType="Integer" resultMap="CreditExchangeRateResult">
<include refid="selectCreditExchangeRateVo"/>
where id = #{id}
</select>
<insert id="insertCreditExchangeRate" parameterType="com.lhcredit.project.business.creditExchangeRate.domain.CreditExchangeRate" useGeneratedKeys="true" keyProperty="id">
insert into credit_exchange_rate
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="currency != null and currency != '' ">currency,</if>
<if test="ratio != null ">ratio,</if>
<if test="status != null and status != '' ">status,</if>
<if test="crateTime != null ">crateTime,</if>
<if test="updateTime != null ">updateTime,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="currency != null and currency != '' ">#{currency},</if>
<if test="ratio != null ">#{ratio},</if>
<if test="status != null and status != '' ">#{status},</if>
<if test="crateTime != null ">#{crateTime},</if>
<if test="updateTime != null ">#{updateTime},</if>
</trim>
</insert>
<update id="updateCreditExchangeRate" parameterType="com.lhcredit.project.business.creditExchangeRate.domain.CreditExchangeRate">
update credit_exchange_rate
<trim prefix="SET" suffixOverrides=",">
<if test="currency != null and currency != '' ">currency = #{currency},</if>
<if test="ratio != null ">ratio = #{ratio},</if>
<if test="status != null and status != '' ">status = #{status},</if>
<if test="crateTime != null ">crateTime = #{crateTime},</if>
<if test="updateTime != null ">updateTime = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<update id="updateByCurrency">
update credit_exchange_rate set status='1' where currency = #{currency}
</update>
<delete id="deleteCreditExchangeRateById" parameterType="Integer">
delete from credit_exchange_rate where id = #{id}
</delete>
<delete id="deleteCreditExchangeRateByIds" parameterType="String">
delete from credit_exchange_rate where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>