You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.example.demo.mapper.sqlserver.HistoryRecordMapper">
<select id="getOldHistoryRecord" resultType="com.example.demo.domain.vo.coin.HistoryRecord"> </select>
<!-- 新增分页查询方法 --> <select id="getNewHistoryRecord" resultType="com.example.demo.domain.vo.coin.HistoryRecord"> SELECT ui.Name AS name, ugr.jwcode AS jwcode, (ugr.buy_jb + ugr.free + ugr.core_jb) AS num, ugt.remark_cn AS updateType, ugr.buy_jb AS permanentGold, ugr.free AS freeGold, ugr.core_jb AS taskGold, ugr.cz_user AS operator, ugr.cz_time AS createTime, ugr.cz_bz AS remark FROM [hwhcGold].[dbo].[user_gold_records] ugr LEFT JOIN [hwerp].[dbo].[UserInfo] ui ON ugr.jwcode = ui.Jwcode LEFT JOIN [hwhcGold].[dbo].[user_gold_typeInfo] ugt ON ugr.gtype = ugt.id <where> <if test="startTime != null">AND ugr.cz_time >= #{startTime}</if> <if test="endTime != null">AND ugr.cz_time <= #{endTime}</if> <if test="jwcode != null and jwcode!=''">AND ugr.jwcode = #{jwcode}</if> <if test="name != null and name!=''">AND ui.Name = #{name}</if> <!-- 修复姓名关联字段 --> </where> ORDER BY ugr.cz_time DESC -- SQL Server 手动分页语法 OFFSET #{offset} ROWS FETCH NEXT #{pageSize} ROWS ONLY </select>
<!-- 新增统计总条数的方法 --> <select id="countNewHistoryRecord" resultType="java.lang.Long"> SELECT COUNT(0) FROM [hwhcGold].[dbo].[user_gold_records] ugr LEFT JOIN [hwerp].[dbo].[UserInfo] ui ON ugr.jwcode = ui.Jwcode LEFT JOIN [hwhcGold].[dbo].[user_gold_typeInfo] ugt ON ugr.gtype = ugt.id <where> <if test="startTime != null">AND ugr.cz_time >= #{startTime}</if> <if test="endTime != null"> <!-- 给 endTime 加 1 秒,语法:DATEADD(second, 1, 时间值) --> AND ugr.cz_time <= DATEADD(second, 1, #{endTime}) </if> <if test="jwcode != null and jwcode!=''">AND ugr.jwcode = #{jwcode}</if> <if test="name != null and name!=''">AND ui.Name = #{name}</if> <!-- 修复姓名关联字段 --> </where> </select> </mapper>
|