<select id="find" parameterType="OrderDetail" resultMap="BaseResultMap">
select * from crm_order_detail det
join crm_order de on det.o_id=de.o_id
join crm_user_info cu on cu.crm_id=de.c_id
join crm_gods gods on gods.g_id=det.g_id
where de.e_id=#{order.worker.uid}
<if test="state!=null and state>=0">
and det.state=#{state}
</if>
<if test="god!=null and god.name!=null and god.name!='' ">
and gods.g_name like '%'||#{god.name}||'%'
</if>
<!--<if test="odate!=null and udate!=null"> <![CDATA[ >= ]]>
and odate between to_date(#{odate},'yyyy-mm-dd') and to_date(#{udate},'yyyy-mm-dd')
</if> -->
<if test="order!=null and order.customer!=null and order.customer.cname!=null and order.customer.cname!=''">
and cu.cname like '%'||#{order.customer.cname}||'%'
</if>
</select>版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/cjvs9k/article/details/46843655