Composite bulk sample query conditions

<select id="findListByParam" parameterType="java.util.List" resultType="PredictPackageDO">
select
<include refid="columns"/>
from tmsx_predict_package_quantity
<where>
<foreach collection="list" item="ppq" separator="or">
org_id = #{ppq.orgId} and
status != -1
<if test="ppq.fromCode != null">
and from_code = #{ppq.fromCode}
</if>
<if test="ppq.toCode != null">
and to_code = #{ppq.toCode}
</if>
<if test="ppq.agingType != null">
and aging_type = #{ppq.agingType}
</if>
<if test="ppq.waveCode != null">
and wave_code = #{ppq.waveCode}
</if>
<if test="ppq.targetDate != null">
and target_date = #{ppq.targetDate}
</if>
<if test="ppq.simulationVersion != null">
and simulation_version = #{ppq.simulationVersion}
</if>
<if test="ppq.type != null">
and type = #{ppq.type}
</if>
</foreach>
</where>
</select>

Guess you like

Origin www.cnblogs.com/qiyu/p/11239938.html