mybatis常用xml语法

刘百会 / 2023-07-28 / 原文

    @Select("<script> " +
            "select " +
            "vga.plate_type as plateType," +
            "count(plate_info) as counts " +
            " from" +
            " vehicle_gangqu_all vga" +
            "<where>" +
            "<if test='crossCode != null and crossCode.size &gt;0'>" +
            " and  vga.cross_code in " +
            "                <foreach collection=\"crossCode\" item=\"item\" open=\"(\" separator=\",\" close=\")\">\n" +
            "                     #{item} \n" +
            "                </foreach>" +
            "</if>" +
            "<if test='searchCarParamDTO.startTime != null and searchCarParamDTO.startTime.length &gt;0 '>" +
            "   and toStartOfDay(vga.pass_time) BETWEEN  #{searchCarParamDTO.startTime} AND  #{searchCarParamDTO.startTime} " +
            "</if>" +
            "</where>" +
            "group by " +
            " vga.plate_type  </script>")
    L