<?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.webmanage.mapper.PointsFlowMapper">
|
|
<!-- 分页查询积分流水(支持用户/单位维度过滤) -->
|
<select id="selectPage" resultType="com.webmanage.entity.PointsFlow">
|
SELECT *
|
FROM points_flow
|
WHERE deleted = 0
|
<if test="userId != null">
|
AND user_id = #{userId}
|
</if>
|
<if test="unitId != null">
|
AND unit_id = #{unitId}
|
</if>
|
<if test="dataCategory != null and dataCategory != ''">
|
AND data_category = #{dataCategory}
|
</if>
|
<if test="dataType != null and dataType != ''">
|
AND data_type = #{dataType}
|
</if>
|
<if test="startTime != null and startTime != ''">
|
AND flow_time >= #{startTime}::timestamp
|
</if>
|
<if test="endTime != null and endTime != ''">
|
AND flow_time <= #{endTime}::timestamp
|
</if>
|
<if test="year != null and year != ''">
|
AND EXTRACT(YEAR FROM flow_time) = #{year}::integer
|
</if>
|
<if test="month != null and month != ''">
|
AND EXTRACT(MONTH FROM flow_time) = #{month}::integer
|
</if>
|
<if test="day != null and day != ''">
|
AND EXTRACT(DAY FROM flow_time) = #{day}::integer
|
</if>
|
ORDER BY flow_time DESC
|
</select>
|
|
</mapper>
|