mybatis在注解上使用if判断

2019-08-08  本文已影响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);
上一篇下一篇

猜你喜欢

热点阅读