mybatis xml配置

该文档展示了一个MyBatis的MapperXML配置文件,包括了查询、插入、更新和删除等数据库操作,涉及实体类属性映射及动态SQL条件构造。

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE mapper

PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"

"" target="_blank">http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.morg.nbqypj.legrepinfsgm.mapper.NbqypjLegRepInfSgmMapper">

<resultMap type="NbqypjLegRepInfSgmt" id="NbqypjLegRepInfSgmResult">

<result property="iid" column="iid" />

<result property="entcertnum" column="entcertnum" />

<result property="legrepname" column="legrepname" />

<result property="legrepidtype" column="legrepidtype" />

<result property="legrepidnum" column="legrepidnum" />

<result property="legrephouseaddstat" column="legrephouseaddstat" />

<result property="legrepedulevel" column="legrepedulevel" />

<result property="legrepworkingyears" column="legrepworkingyears" />

<result property="sbzt" column="sbzt" />

<result property="sjzt" column="sjzt" />

<result property="bwbh" column="bwbh" />

<result property="disOrgId" column="dis_org_id" />

<result property="disDataDate" column="dis_data_date" />

</resultMap>

<sql id="selectNbqypjLegRepInfSgmVo">

select iid, entcertnum, legrepname, legrepidtype, legrepidnum, legrephouseaddstat, legrepedulevel, legrepworkingyears, sbzt, sjzt, bwbh, dis_org_id, dis_data_date from nbqypj_leg_rep_inf_sgm

</sql>

<select id="selectNbqypjLegRepInfSgmList" parameterType="NbqypjLegRepInfSgmt" resultMap="NbqypjLegRepInfSgmResult">

<include refid="selectNbqypjLegRepInfSgmVo"/>

<where>

<if test="legrepname != null and legrepname != ''"> and legrepname like concat('%', #{legrepname}, '%')</if>

<if test="legrepidtype != null and legrepidtype != ''"> and legrepidtype = #{legrepidtype}</if>

<if test="legrepidnum != null and legrepidnum != ''"> and legrepidnum = #{legrepidnum}</if>

<if test="legrephouseaddstat != null and legrephouseaddstat != ''"> and legrephouseaddstat = #{legrephouseaddstat}</if>

<if test="legrepedulevel != null and legrepedulevel != ''"> and legrepedulevel = #{legrepedulevel}</if>

<if test="legrepworkingyears != null "> and legrepworkingyears = #{legrepworkingyears}</if>

<if test="sbzt != null and sbzt != ''"> and sbzt = #{sbzt}</if>

<if test="sjzt != null and sjzt != ''"> and sjzt = #{sjzt}</if>

<if test="bwbh != null and bwbh != ''"> and bwbh = #{bwbh}</if>

<if test="entcertnum != null and entcertnum != ''"> and entcertnum = #{entcertnum}</if>

<if test="disOrgId != null and disOrgId != ''"> and dis_org_id = #{disOrgId}</if>

<if test="disDataDate != null and disDataDate != ''"> and dis_data_date = #{disDataDate}</if>

</where>

</select>

<select id="selectNbqypjLegRepInfSgmByIid" parameterType="Long" resultMap="NbqypjLegRepInfSgmResult">

<include refid="selectNbqypjLegRepInfSgmVo"/>

where iid = #{iid}

</select>

<select id="selectUniqueIdListByIds" parameterType="Long" resultMap="NbqypjLegRepInfSgmResult">

select entcertnum, dis_org_id, dis_data_date

from nbqypj_leg_rep_inf_sgm

where iid in

<foreach item="iid" collection="array" open="(" separator="," close=")">

#{iid}

</foreach>

</select>

<insert id="insertNbqypjLegRepInfSgm" parameterType="NbqypjLegRepInfSgmt">

insert into nbqypj_leg_rep_inf_sgm

<trim prefix="(" suffix=")" suffixOverrides=",">

<if test="entcertnum != null">entcertnum,</if>

<if test="legrepname != null">legrepname,</if>

<if test="legrepidtype != null">legrepidtype,</if>

<if test="legrepidnum != null">legrepidnum,</if>

<if test="legrephouseaddstat != null">legrephouseaddstat,</if>

<if test="legrepedulevel != null">legrepedulevel,</if>

<if test="legrepworkingyears != null">legrepworkingyears,</if>

<if test="sbzt != null">sbzt,</if>

<if test="sjzt != null">sjzt,</if>

<if test="bwbh != null">bwbh,</if>

<if test="disOrgId != null">dis_org_id,</if>

<if test="disDataDate != null">dis_data_date,</if>

</trim>

<trim prefix="values (" suffix=")" suffixOverrides=",">

<if test="entcertnum != null">#{entcertnum},</if>

<if test="legrepname != null">#{legrepname},</if>

<if test="legrepidtype != null">#{legrepidtype},</if>

<if test="legrepidnum != null">#{legrepidnum},</if>

<if test="legrephouseaddstat != null">#{legrephouseaddstat},</if>

<if test="legrepedulevel != null">#{legrepedulevel},</if>

<if test="legrepworkingyears != null">#{legrepworkingyears},</if>

<if test="sbzt != null">#{sbzt},</if>

<if test="sjzt != null">#{sjzt},</if>

<if test="bwbh != null">#{bwbh},</if>

<if test="disOrgId != null">#{disOrgId},</if>

<if test="disDataDate != null">#{disDataDate},</if>

</trim>

</insert>

<update id="updateNbqypjLegRepInfSgm" parameterType="NbqypjLegRepInfSgmt">

update nbqypj_leg_rep_inf_sgm

<trim prefix="SET" suffixOverrides=",">

<if test="legrepname != null">legrepname = #{legrepname},</if>

<if test="legrepidtype != null">legrepidtype = #{legrepidtype},</if>

<if test="legrepidnum != null">legrepidnum = #{legrepidnum},</if>

<if test="legrephouseaddstat != null">legrephouseaddstat = #{legrephouseaddstat},</if>

<if test="legrepedulevel != null">legrepedulevel = #{legrepedulevel},</if>

<if test="legrepworkingyears != null">legrepworkingyears = #{legrepworkingyears},</if>

<if test="sbzt != null">sbzt = #{sbzt},</if>

<if test="sjzt != null">sjzt = #{sjzt},</if>

<if test="bwbh != null">bwbh = #{bwbh},</if>

<if test="disOrgId != null">dis_org_id = #{disOrgId},</if>

<if test="disDataDate != null">dis_data_date = #{disDataDate},</if>

<if test="entcertnum != null and entcertnum != '' ">entcertnum = #{entcertnum},</if>

</trim>

where iid = #{iid}

</update>

<!-- 批量更新(逻辑删除)操作 -->

<update id="updateNbqypjLegRepInfSgmtSjztByIds" parameterType="Long">

update nbqypj_leg_rep_inf_sgm set sjzt = 'delete' where iid in

<foreach item="iid" collection="array" open="(" separator="," close=")">

#{iid}

</foreach>

</update>

<delete id="deleteNbqypjLegRepInfSgmByIid" parameterType="Long">

delete from nbqypj_leg_rep_inf_sgm where iid = #{iid}

</delete>

<delete id="deleteNbqypjLegRepInfSgmByKey" parameterType="NbqypjLegRepInfSgmt">

delete from nbqypj_leg_rep_inf_sgm where entcertnum = #{entcertnum} and dis_org_id = #{disOrgId} and dis_data_date = #{disDataDate}

</delete>

<delete id="deleteNbqypjLegRepInfSgmByIds" parameterType="String">

delete from nbqypj_leg_rep_inf_sgm where iid in

<foreach item="iid" collection="array" open="(" separator="," close=")">

#{iid}

</foreach>

</delete>

</mapper>

评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值