mybatis 查询同一父级下的数据不能重复录入

	<select id="findXXX" resultType="Integer">
		SELECT ifnull(count(1),0)
		FROM   t_set
		<where>
			parent_code = #{parentCode}
			and (x_code = #{xCode} or x_name = #{xName})
			and status = 0
			<if test="id != null and id.length()>0"> AND id !=#{id}</if>
		</where>
	</select>

猜你喜欢

转载自blog.csdn.net/qq_39822451/article/details/89470810