ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
列表/分页查询 ~~~ @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> ~~~