|
|
|
@ -4,25 +4,37 @@ |
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|
|
|
<mapper namespace="com.zdxt.enforcementcode.mapper.TestEnfDemoMapper"> |
|
|
|
|
|
|
|
<!-- 自定义SQL分页查询demo --> |
|
|
|
<!-- 自定义SQL分页查询demo(手动添加 del_flag=0 逻辑删除条件,因为自定义SQL不会被@TableLogic自动处理) --> |
|
|
|
<select id="customPageList" resultType="com.zdxt.enforcementcode.domain.vo.TestEnfDemoVo"> |
|
|
|
SELECT id, enf_text, enf_content, dept_id, user_id, order_num, test_key, value |
|
|
|
FROM test_enf_demo |
|
|
|
${ew.customSqlSegment} |
|
|
|
WHERE del_flag = 0 |
|
|
|
<if test="ew != null and ew.sqlSegment != null and ew.sqlSegment != ''"> |
|
|
|
<if test="ew.nonEmptyOfNormal"> AND </if> |
|
|
|
${ew.sqlSegment} |
|
|
|
</if> |
|
|
|
</select> |
|
|
|
|
|
|
|
<!-- 方案A: 手动分页 - 自定义count查询 --> |
|
|
|
<select id="manualCount" resultType="java.lang.Long"> |
|
|
|
SELECT COUNT(*) |
|
|
|
FROM test_enf_demo |
|
|
|
${ew.customSqlSegment} |
|
|
|
WHERE del_flag = 0 |
|
|
|
<if test="ew != null and ew.sqlSegment != null and ew.sqlSegment != ''"> |
|
|
|
<if test="ew.nonEmptyOfNormal"> AND </if> |
|
|
|
${ew.sqlSegment} |
|
|
|
</if> |
|
|
|
</select> |
|
|
|
|
|
|
|
<!-- 方案A: 手动分页 - 自带LIMIT的数据查询 --> |
|
|
|
<select id="manualSelectList" resultType="com.zdxt.enforcementcode.domain.vo.TestEnfDemoVo"> |
|
|
|
SELECT id, enf_text, enf_content, dept_id, user_id, order_num, test_key, value |
|
|
|
FROM test_enf_demo |
|
|
|
${ew.customSqlSegment} |
|
|
|
WHERE del_flag = 0 |
|
|
|
<if test="ew != null and ew.sqlSegment != null and ew.sqlSegment != ''"> |
|
|
|
<if test="ew.nonEmptyOfNormal"> AND </if> |
|
|
|
${ew.sqlSegment} |
|
|
|
</if> |
|
|
|
LIMIT #{offset}, #{pageSize} |
|
|
|
</select> |
|
|
|
|
|
|
|
|