JNBusiness/ruoyi-system/src/main/resources/mapper/sapAccount/SapAccountMapper.xml

76 lines
3.6 KiB
XML
Raw Normal View History

2024-03-11 12:59:39 +08:00
<?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.ruoyi.sapAccount.mapper.SapAccountMapper">
<resultMap type="SapAccount" id="SapAccountResult">
<result property="id" column="id" />
<result property="userName" column="user_name" />
<result property="nickName" column="nick_name" />
<result property="sapBm" column="sap_bm" />
<result property="sapName" column="sap_name" />
<result property="sapArea" column="sap_area" />
</resultMap>
<sql id="selectSapAccountVo">
select id, user_name, nick_name, sap_bm, sap_name, sap_area from sap_account
</sql>
<select id="selectSapAccountList" parameterType="SapAccount" resultMap="SapAccountResult">
<include refid="selectSapAccountVo"/>
<where>
<if test="userName != null and userName != ''"> and user_name = #{userName}</if>
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
<if test="sapBm != null and sapBm != ''"> and sap_bm = #{sapBm}</if>
<if test="sapName != null and sapName != ''"> and sap_name like concat('%', #{sapName}, '%')</if>
<if test="sapArea != null and sapArea != ''"> and sap_area = #{sapArea}</if>
</where>
</select>
<select id="selectSapAccountById" parameterType="Long" resultMap="SapAccountResult">
<include refid="selectSapAccountVo"/>
where id = #{id}
</select>
<insert id="insertSapAccount" parameterType="SapAccount" useGeneratedKeys="true" keyProperty="id">
insert into sap_account
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userName != null and userName != ''">user_name,</if>
<if test="nickName != null and nickName != ''">nick_name,</if>
<if test="sapBm != null and sapBm != ''">sap_bm,</if>
<if test="sapName != null and sapName != ''">sap_name,</if>
<if test="sapArea != null and sapArea != ''">sap_area,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userName != null and userName != ''">#{userName},</if>
<if test="nickName != null and nickName != ''">#{nickName},</if>
<if test="sapBm != null and sapBm != ''">#{sapBm},</if>
<if test="sapName != null and sapName != ''">#{sapName},</if>
<if test="sapArea != null and sapArea != ''">#{sapArea},</if>
</trim>
</insert>
<update id="updateSapAccount" parameterType="SapAccount">
update sap_account
<trim prefix="SET" suffixOverrides=",">
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
<if test="sapBm != null and sapBm != ''">sap_bm = #{sapBm},</if>
<if test="sapName != null and sapName != ''">sap_name = #{sapName},</if>
<if test="sapArea != null and sapArea != ''">sap_area = #{sapArea},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSapAccountById" parameterType="Long">
delete from sap_account where id = #{id}
</delete>
<delete id="deleteSapAccountByIds" parameterType="String">
delete from sap_account where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>