您的位置:首页 > 其它

mybatis 增删改查

2015-09-30 11:38 155 查看
<?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" >

<insert id="insert" parameterType="com.form.baseinfo.industryinfo.tbl_bse_initfee_limit">
insert into tbl_bse_initfee_limit
<trim prefix="(" suffixOverrides=",">
<if test="record_id      != null">record_id     ,</if>
<if test="mchnt_id != null">mchnt_id ,</if>
<if test="card_type != null">card_type ,</if>
<if test="req_date != null">req_date ,</if>
<if test="req_time != null">req_time ,</if>
<if test="limit_amt !=null">limit_amt ,</if>
<if test="card_seq_rec_id !=null">card_seq_rec_id ,</if>
<if test=" create_uid != null"> create_uid ,</if>
<if test=" create_time!= null"> create_time,</if>
</trim>
)
values
<trim prefix="(" suffixOverrides=",">
<if test="record_id     != null">#{record_id     },</if>
<if test="mchnt_id != null">#{mchnt_id},</if>
<if test="card_type != null">#{card_type},</if>
<if test="req_date != null">#{req_date},</if>
<if test="req_time != null">#{req_time},</if>
<if test="limit_amt !=null">#{limit_amt},</if>
<if test="card_seq_rec_id !=null">#{card_seq_rec_id},</if>
<if test=" create_uid != null">#{ create_uid },</if>
<if test=" create_time!= null">#{ create_time},</if>
</trim>
)
</insert>

<delete id="delete" parameterType="com.form.baseinfo.industryinfo.tbl_bse_initfee_limit">
delete from tbl_bse_initfee_limit
where record_id=#{record_id} and mchnt_id=#{mchnt_id}
</delete>

<update id="update" parameterType="com.form.baseinfo.industryinfo.tbl_bse_initfee_limit">
update tbl_bse_initfee_limit
<set>
<if test="record_id != null">record_id=#{record_id     },</if>
<if test="mchnt_id != null">mchnt_id=#{mchnt_id},</if>
<if test="card_type != null">card_type=#{card_type},</if>
<if test="limit_amt !=null">limit_amt=#{limit_amt},</if>
<if test="card_seq_rec_id !=null">card_seq_rec_id=#{card_seq_rec_id},</if>
<if test="chk_st !=null">chk_st=#{chk_st},</if>
<if test=" create_uid != null">create_uid=#{ create_uid },</if>
<if test=" rec_upd_time != null">rec_upd_time=#{ rec_upd_time},</if>
</set>
where record_id=#{record_id}
</update>

<select id="select" parameterType="com.form.baseinfo.industryinfo.tbl_bse_initfee_limit"
resultType="com.form.baseinfo.industryinfo.tbl_bse_initfee_limit">
<![CDATA[
select tt.*,
d.dictvaluedesc as chk_stdesc,
d1.dictvaluedesc as card_typedesc,
d2.mchnt_name as mchnt_iddesc
from (
]]>
select * from (select a.*,rownum as rn from (
select t.* from tbl_bse_initfee_limit t
<where>
<if test="record_id != null and record_id !='' ">
t.record_id = #{record_id}
</if>
<if test="mchnt_id != null and mchnt_id !='' ">
and t.mchnt_id=#{mchnt_id}
</if>
<if test="card_type != null and card_type !='' ">
and t.card_type =#{card_type}
</if>
</where>
) a where #{to} >=rownum) b where b.rn >= #{from}
) tt
left join dictinfotb d on tt.chk_st=d.dictvalue and d.dicttype=20010 and d.locale='zh_CN'
left join dictinfotb d1 on tt.card_type=d1.dictvalue and d1.dicttype=20075 and d1.locale='zh_CN'
left join tbl_bse_inf_mchnt d2 on tt.mchnt_id = d2.mchnt_id
<if test="sortString != null">
order by req_date desc , req_time desc
</if>
</select>
<!--无分页查询-->
<select id="selectNoPage" parameterType="com.form.baseinfo.industryinfo.tbl_bse_initfee_limit"
resultType="com.form.baseinfo.industryinfo.tbl_bse_initfee_limit">
<![CDATA[
select tt.*,
d.dictvaluedesc as chk_stdesc,
d1.dictvaluedesc as card_typedesc,
d2.mchnt_name as mchnt_iddesc
from (
]]>
select  record_id,
mchnt_id,
card_type,
(to_char(nvl(sum(limit_amt)/100,0),'fm9999999990.00')) as limit_amt,
req_date,
req_time,
chk_st,card_seq_rec_id,
create_uid,create_time,chk_uid,chk_time,rec_upd_time

from tbl_bse_initfee_limit t
group by record_id,mchnt_id,
card_type,req_date,req_time,chk_st,card_seq_rec_id,create_uid,create_time,chk_uid,chk_time,rec_upd_time
order by req_date desc,req_time desc
<where>
<if test="record_id != null and record_id !='' ">
t.record_id = #{record_id}
</if>
<if test="mchnt_id != null and mchnt_id !='' ">
and t.mchnt_id=#{mchnt_id}
</if>
<if test="card_type != null and card_type !='' ">
and t.card_type =#{card_type}
</if>
</where>
) tt
left join dictinfotb d on tt.chk_st=d.dictvalue and d.dicttype=20010 and d.locale='zh_CN'
left join dictinfotb d1 on tt.card_type=d1.dictvalue and d1.dicttype=20075 and d1.locale='zh_CN'
left join tbl_bse_inf_mchnt d2 on tt.mchnt_id = d2.mchnt_id

</select>

<select id="selectCount" parameterType="com.form.batch.tbl_bat_run_log"
resultType="java.lang.Integer">
select count(1) from tbl_bat_run_log t
<where>
<if test="rec_id != null and rec_id !='' ">
and t.rec_id=#{rec_id}
</if>
<if test="settleDateStart !=null and settleDateStart !='' ">
<![CDATA[and settle_Date>=#{settleDateStart}]]>
</if>
<if test="settleDateEnd !=null and settleDateEnd !='' ">
<![CDATA[and settle_Date<=#{settleDateEnd}]]>
</if>
<if test="run_result != null and run_result !='' ">
and t.run_result=#{run_result}
</if>
</where>
</select>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: