💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
列表/分页查询 ~~~ @Resource(name = "sqlSessionDao") private Dao dao; //查询列表,实体类方式 TfNList cond = new TfNList(); cond.setListType("10").asCondition(); List<TfNList> list = dao.selectList(cond); //查询列表,写sql方式 List<TfNList> list = dao.selectList("NameListSQL.queryNameList", param); //查询分页对象 Pagination pagination = new Pagination(); pagination.setRange(start, pageSize); pagination.setCurrPage(currPage); PageData<TfNList> pageData = dao.selectList("NameListSQL.queryNameList", param, pagination); //获取分页列表 List<TfNList> list = pageData.getRows(); //获取记录总数 long total = pageData.getTotal(); //对应sql文件 src/main/resources/sql/oracle/namelist/NameListSQL.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="NameListSQL"> <select id="queryNameList" resultType="com.walk.example.mvc.entity.TfNList"> SELECT A.* FROM TF_N_LIST A <where> <if test="listId != null and listId != ''"> AND A.LIST_ID = #{listId} </if> <if test="listName != null and listName != ''"> AND A.LIST_NAME LIKE #{listName} || '%' </if> <if test="custType != null and custType != ''"> AND A.CUST_TYPE = #{custType} </if> <if test="subCustType != null and subCustType != ''"> AND A.SUB_CUST_TYPE = #{subCustType} </if> </where> </select> </mapper> ~~~