135 lines
5.4 KiB
XML
135 lines
5.4 KiB
XML
<?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.celnet.datadump.mapper.SalesforceMapper">
|
|
|
|
<select id="list">
|
|
select ${param.select} from ${param.api}
|
|
<where>
|
|
<if test="param != null">
|
|
<if test="param.ids != null">
|
|
AND id IN <foreach item="id" collection="param.ids" open="(" separator="," close=")">#{id}</foreach>
|
|
</if>
|
|
<if test="param.beginModifyDate != null">
|
|
AND LastModifiedDate >= #{param.beginModifyDate}
|
|
</if>
|
|
<if test="param.endModifyDate != null">
|
|
AND LastModifiedDate < #{param.endModifyDate}
|
|
</if>
|
|
<if test="param.beginCreateDate != null">
|
|
AND CreatedDate >= #{param.beginCreateDate}
|
|
</if>
|
|
<if test="param.endCreateDate != null">
|
|
AND CreatedDate < #{param.endCreateDate}
|
|
</if>
|
|
<if test="param.isDeleted != null">
|
|
AND IsDeleted = #{param.isDeleted}
|
|
</if>
|
|
<if test="param.timestamp != null">
|
|
<choose>
|
|
<when test="param.maxId != null">
|
|
AND (CreatedDate > #{param.timestamp} OR (CreatedDate = #{param.timestamp} AND id > #{param.maxId}))
|
|
</when>
|
|
<otherwise>
|
|
AND CreatedDate >= #{param.timestamp}
|
|
</otherwise>
|
|
</choose>
|
|
</if>
|
|
</if>
|
|
</where>
|
|
order by CreatedDate asc, Id asc
|
|
<if test="param != null and param.limit != null">
|
|
limit #{param.limit}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="listByModifyTime">
|
|
select ${param.select} from ${param.api}
|
|
<where>
|
|
<if test="param != null">
|
|
<if test="param.ids != null">
|
|
AND id IN <foreach item="id" collection="param.ids" open="(" separator="," close=")">#{id}</foreach>
|
|
</if>
|
|
<if test="param.beginModifyDate != null">
|
|
AND ${param.updateField} >= #{param.beginModifyDate}
|
|
</if>
|
|
<if test="param.endModifyDate != null">
|
|
AND ${param.updateField} < #{param.endModifyDate}
|
|
</if>
|
|
<if test="param.beginCreateDate != null">
|
|
AND CreatedDate >= #{param.beginCreateDate}
|
|
</if>
|
|
<if test="param.endCreateDate != null">
|
|
AND CreatedDate < #{param.endCreateDate}
|
|
</if>
|
|
<if test="param.isDeleted != null">
|
|
AND IsDeleted = #{param.isDeleted}
|
|
</if>
|
|
<if test="param.timestamp != null">
|
|
<choose>
|
|
<when test="param.maxId != null">
|
|
AND (${param.updateField} > #{param.timestamp} OR (${param.updateField} = #{param.timestamp} AND id > #{param.maxId}))
|
|
</when>
|
|
<otherwise>
|
|
AND ${param.updateField} >= #{param.timestamp}
|
|
</otherwise>
|
|
</choose>
|
|
</if>
|
|
</if>
|
|
</where>
|
|
order by ${param.updateField} asc, Id asc
|
|
<if test="param != null and param.limit != null">
|
|
limit #{param.limit}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="count" resultType="int">
|
|
select COUNT(Id) num from ${param.api}
|
|
<where>
|
|
<if test="param != null">
|
|
<if test="param.ids != null">
|
|
AND id IN <foreach item="id" collection="param.ids" open="(" separator="," close=")">#{id}</foreach>
|
|
</if>
|
|
<if test="param.beginModifyDate != null">
|
|
AND LastModifiedDate >= #{param.beginModifyDate}
|
|
</if>
|
|
<if test="param.beginModifyDate != null">
|
|
AND LastModifiedDate >= #{param.beginModifyDate}
|
|
</if>
|
|
<if test="param.isDeleted != null">
|
|
AND IsDeleted = #{param.isDeleted}
|
|
</if>
|
|
<if test="param.beginCreateDate != null">
|
|
AND CreatedDate >= #{param.beginCreateDate}
|
|
</if>
|
|
<if test="param.endCreateDate != null">
|
|
AND CreatedDate < #{param.endCreateDate}
|
|
</if>
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
<select id="listOrderById">
|
|
select ${param.select} from ${param.api}
|
|
<where>
|
|
<if test="param != null">
|
|
<if test="param.maxId != null">
|
|
AND id > #{param.maxId}
|
|
</if>
|
|
<if test="param.isDeleted != null">
|
|
AND IsDeleted = #{param.isDeleted}
|
|
</if>
|
|
<if test="param.sql != null">
|
|
AND ${param.sql}
|
|
</if>
|
|
</if>
|
|
</where>
|
|
<if test="param != null">
|
|
<if test="param.idField != null">
|
|
order by ${param.idField} asc
|
|
</if>
|
|
</if>
|
|
</select>
|
|
|
|
</mapper>
|