美文网首页
mybatis在注解上使用if判断

mybatis在注解上使用if判断

作者: 平面小狮子 | 来源:发表于2019-08-08 11:22 被阅读0次

    用script标签包围,然后像xml语法一样书写

    @Select({"<script> " +
                "select count(1) " +
                "from operationscheduling os " +
                "inner join operationanesthesia oa " +
                "on os.operation_id = oa.operation_id " +
                "where os.order_state = '已排班' and to_char(os.OPERATION_DATE, 'yyyy-MM-dd') = #{localDate} " +
                "<if test = 'roomId != null and roomId != \"\" '> " +
                "and os.room_id = #{roomId}" +
                "</if>" +
                "</script>"})
        Integer getSurgeryExecCount(String localDate, String roomId);
    

    相关文章

      网友评论

          本文标题:mybatis在注解上使用if判断

          本文链接:https://www.haomeiwen.com/subject/aqntjctx.html