为了账号安全,请及时绑定邮箱和手机立即绑定

请教一下,谢谢!

请教一下,谢谢!

朴实 2016-10-11 15:47:02
<select id="queryEmp" resultType="entity.Emp" parameterType="Map">      select         <include refid="empColumns"></include>        <!--  -->        from e_emp e where 1=1 //这里为什么添加1=1  请解释一下。谢谢!                <if test="name!=null and name!=''">            and e.ename like '%${name}%'        </if>                <if test="sex != '全部'">            and e.esex = #{sex}        </if>                <if test="marge != 2">            and e.emarge = #{marge}        </if>            </select>
查看完整描述

2 回答

?
Caballarii

TA贡献1123条经验 获得超629个赞

如果没有1=1,那么语句里很可能出现where和and相连的情况,语法就报错了

查看完整回答
1 反对 回复 2016-10-11
  • 2 回答
  • 0 关注
  • 1176 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信