<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                MiniDao SQL分離寫法 === ### 第一步: 定義接口 EmployeeDao.java (不需要實現) ``` @Repository public interface EmployeeDao { @Sql("select * from employee where id = :id") Employee get(@Param("id") String id); int update(@Param("employee") Employee employee); void insert(@Param("employee") Employee employee); @ResultType(Employee.class) public MiniDaoPage<Employee> getAll(@Param("employee") Employee employee,@Param("page") int page,@Param("rows") int rows); @Sql("delete from employee where id = :id") public void delete(@Param("id") String id); } ``` minidao 代理機制會自動實現接口,將實現bean注入到spring容器里面,這個比mybatis要簡易很多。 ### 第二步:創建接口方法對應SQL文件 SQL文件目錄規則,與minidao接口保持相同目錄(或者放在對應resource目錄下) SQL文件命名規則:{Dao接口名}_{方法名}.sql ![](https://img.kancloud.cn/d0/f7/d0f7964c2ac1ffdd8cdc4638ae02dd00_397x328.png) ### 第三步:編寫SQL SQL文件采用模板語言Freemarker作為解析引擎,可以靈活運用,甚至可以寫腳本語言,宏處理等; **示例:** ``` SELECT * FROM employee where 1=1 <#if employee.age ?exists> and age = '${employee.age}' </#if> <#if employee.name ?exists> and name = :employee.name </#if> <#if employee.empno ?exists> and empno = :employee.empno </#if> ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看