Commit 1ed7ce11 authored by 耿迪迪's avatar 耿迪迪

xml 条件判断问题修改 gengdidi

parent 898b6d93
......@@ -68,7 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertTDeviceInfo" parameterType="TDeviceInfo" useGeneratedKeys="true" keyProperty="deviceId">
insert into t_device_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="enterpriseId != null">enterprise_id,</if>
<if test="enterpriseId != null and enterpriseId != 0">enterprise_id,</if>
<if test="pipeCode != null">pipe_code,</if>
<if test="deviceName != null">device_name,</if>
<if test="deviceCode != null">device_code,</if>
......@@ -86,7 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remarks != null">remarks,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="enterpriseId != null">#{enterpriseId},</if>
<if test="enterpriseId != null and enterpriseId != 0">#{enterpriseId},</if>
<if test="pipeCode != null">#{pipeCode},</if>
<if test="deviceName != null">#{deviceName},</if>
<if test="deviceCode != null">#{deviceCode},</if>
......@@ -108,7 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateTDeviceInfo" parameterType="TDeviceInfo">
update t_device_info
<trim prefix="SET" suffixOverrides=",">
<if test="enterpriseId != null">enterprise_id = #{enterpriseId},</if>
<if test="enterpriseId != null and enterpriseId != 0">enterprise_id = #{enterpriseId},</if>
<if test="pipeCode != null">pipe_code = #{pipeCode},</if>
<if test="deviceName != null">device_name = #{deviceName},</if>
<if test="deviceCode != null">device_code = #{deviceCode},</if>
......
......@@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTPipeList" parameterType="TPipe" resultMap="TPipeResult">
<include refid="selectTPipeVo"/>
<where>
<if test="enterpriseId != null "> and enterprise_id = #{enterpriseId}</if>
<if test="enterpriseId != null and enterpriseId != 0"> and enterprise_id = #{enterpriseId}</if>
<if test="pipeName != null and pipeName != ''"> and pipe_name like concat('%', #{pipeName}, '%')</if>
<if test="pipeCode != null and pipeCode != ''"> and pipe_code like concat('%', #{pipeCode}, '%')</if>
<if test="pipeAddr != null and pipeAddr != ''"> and pipe_addr = #{pipeAddr}</if>
......@@ -58,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertTPipe" parameterType="TPipe" useGeneratedKeys="true" keyProperty="pipeId">
insert into t_pipe
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="enterpriseId != null">enterprise_id,</if>
<if test="enterpriseId != null and enterpriseId != 0">enterprise_id,</if>
<if test="pipeName != null">pipe_name,</if>
<if test="pipeCode != null">pipe_code,</if>
<if test="pipeAddr != null">pipe_addr,</if>
......@@ -72,7 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remarks != null">remarks,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="enterpriseId != null">#{enterpriseId},</if>
<if test="enterpriseId != null and enterpriseId != 0">#{enterpriseId},</if>
<if test="pipeName != null">#{pipeName},</if>
<if test="pipeCode != null">#{pipeCode},</if>
<if test="pipeAddr != null">#{pipeAddr},</if>
......@@ -90,7 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateTPipe" parameterType="TPipe">
update t_pipe
<trim prefix="SET" suffixOverrides=",">
<if test="enterpriseId != null">enterprise_id = #{enterpriseId},</if>
<if test="enterpriseId != null and enterpriseId != 0">enterprise_id = #{enterpriseId},</if>
<if test="pipeName != null">pipe_name = #{pipeName},</if>
<if test="pipeCode != null">pipe_code = #{pipeCode},</if>
<if test="pipeAddr != null">pipe_addr = #{pipeAddr},</if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment