文档章节

mybatis 常用查询语句

o
 osc_cyiu3qx7
发布于 2018/06/28 17:40
字数 918
阅读 0
收藏 0

「深度学习福利」大神带你进阶工程师,立即查看>>>

<select id="getKzOrderList" resultMap="kzOrderDTO" parameterClass="java.util.Map">
SELECT
ko.id,
ko.order_code,
ko.sum_amout,
ko.funds_amout,
ko.product_amout,
ko.funds_pay,
ko.online_pay,
ko.order_pay,
ko.shipping,
ko.buyer_aid,
ko.buyer_bid,
ko.buyer_uid,
ko.buyer_mid,
ko.buyer_name,
ko.buyer_compName,
ko.buyer_tel,
ko.buyer_phone,
ko.buyer_email,
ko.buyer_address,
ko.buyer_postcode,
ko.seller_aid,
ko.seller_bid,
ko.seller_uid,
ko.seller_name,
ko.seller_compName,
ko.post_ip,
ko.post_time,
ko.order_time,
ko.ostock_status,
ko.ostock_status_title,
ko.deliver_status,
ko.deliver_status_status,
ko.pay_status,
ko.pay_status_title,
ko.order_status,
ko.order_status_title,
ko.order_source,
ko.order_type,
ko.buyer_remarks,
ko.seller_remarks,
ko.is_partial_payment,
ko.is_have_invoice,
ko.IS_DEL,
ko.CREATE_BY,
ko.CREATE_TIME,
ko.UPDATE_BY,
ko.UPDATE_TIME,
ko.BID,
ko.IS_DISCUSS,
ko.PAY_WAY,
ko.PARAM1,
ko.PARAM2,
ko.PARAM3,
ko.PARAM4,
ko.PARAM5,
ko.DISPATCH_TIME,
ko.DISCOUNT_VALUE,
ko.GIFT_PRODUCT_NUM,
ko.IS_PROMOTION
FROM
kz_order ko
LEFT JOIN (SELECT *, MAX(p.id) FROM kz_order_proceeds p GROUP BY p.order_id) kop ON ko.order_code = kop.order_code
WHERE 1=1
<isNotEmpty prepend="and" property="id">
ko.id=#id#
</isNotEmpty>
<isNotEmpty prepend="and" property="orderCode">
ko.order_code like '%$orderCode$%'
</isNotEmpty>
<isNotEmpty prepend="and" property="_quickSearch">
(ko.buyer_name like '%$_quickSearch$%' or ko.order_code like '%$_quickSearch$%')
</isNotEmpty>
<isNotEmpty prepend="and" property="tids">
ko.order_code IN ($tids$)
</isNotEmpty>
<isNotEmpty prepend="and" property="sumAmout">
ko.sum_amout=#sumAmout#
</isNotEmpty>
<isNotEmpty prepend="and" property="sumAmoutBegin">
ko.sum_amout<![CDATA[ >= ]]>#sumAmoutBegin#
</isNotEmpty>
<isNotEmpty prepend="and" property="sumAmoutEnd">
ko.sum_amout<![CDATA[ <= ]]>#sumAmoutEnd#
</isNotEmpty>
<isNotEmpty prepend="and" property="fundsAmout">
ko.funds_amout=#fundsAmout#
</isNotEmpty>
<isNotEmpty prepend="and" property="productAmout">
ko.product_amout=#productAmout#
</isNotEmpty>
<isNotEmpty prepend="and" property="fundsPay">
ko.funds_pay=#fundsPay#
</isNotEmpty>
<isNotEmpty prepend="and" property="onlinePay">
ko.online_pay=#onlinePay#
</isNotEmpty>
<isNotEmpty prepend="and" property="orderPay">
ko.order_pay=#orderPay#
</isNotEmpty>
<isNotEmpty prepend="and" property="shipping">
ko.shipping=#shipping#
</isNotEmpty>
<isNotEmpty prepend="and" property="buyerAid">
ko.buyer_aid=#buyerAid#
</isNotEmpty>
<isNotEmpty prepend="and" property="buyerBid">
ko.buyer_bid=#buyerBid#
</isNotEmpty>

<isNotEmpty prepend="and" property="bidList">
ko.buyer_bid IN
<iterate property="bidList" conjunction="," open="(" close=")">
#bidList[]#
</iterate>
</isNotEmpty>

<isNotEmpty prepend="and" property="buyerUid">
ko.buyer_uid=#buyerUid#
</isNotEmpty>
<isNotEmpty prepend="and" property="buyerMid">
ko.buyer_mid=#buyerMid#
</isNotEmpty>
<isNull property="buyerMid">
<isNotEmpty property="buyerMids">  类似SQL 的 in()
<![CDATA[ and ko.buyer_mid in ]]>
<iterate property="buyerMids" conjunction="," open="(" close=")">
#buyerMids[]#
</iterate>
</isNotEmpty>
</isNull>
<isNotEmpty prepend="and" property="buyerName">
ko.buyer_name=#buyerName#
</isNotEmpty>
<isNotEmpty prepend="and" property="buyerCompname">
ko.buyer_compName like '%$buyerCompname$%'   模糊查询
</isNotEmpty>
<isNotEmpty prepend="and" property="buyerTel">
ko.buyer_tel=#buyerTel#
</isNotEmpty>
<isNotEmpty prepend="and" property="buyerPhone">
ko.buyer_phone=#buyerPhone#
</isNotEmpty>
<isNotEmpty prepend="and" property="buyerEmail">
ko.buyer_email=#buyerEmail#
</isNotEmpty>
<isNotEmpty prepend="and" property="buyerAddress">
ko.buyer_address=#buyerAddress#
</isNotEmpty>
<isNotEmpty prepend="and" property="buyerPostcode">
ko.buyer_postcode=#buyerPostcode#
</isNotEmpty>
<isNotEmpty prepend="and" property="sellerAid">
ko.seller_aid=#sellerAid#
</isNotEmpty>
<isNotEmpty prepend="and" property="sellerBid">
ko.seller_bid=#sellerBid#
</isNotEmpty>
<isNotEmpty prepend="and" property="sellerUid">
ko.seller_uid=#sellerUid#
</isNotEmpty>
<isNotEmpty prepend="and" property="sellerName">
ko.seller_name=#sellerName#
</isNotEmpty>
<isNotEmpty prepend="and" property="sellerCompname">
ko.seller_compName=#sellerCompname#
</isNotEmpty>
<isNotEmpty prepend="and" property="postIp">
ko.post_ip=#postIp#
</isNotEmpty>
<isNotEmpty prepend="and" property="postTime">
ko.post_time=#postTime#
</isNotEmpty>

<isNotEmpty prepend="and" property="invalidationTime">
<![CDATA[ ko.post_time <= #invalidationTime# ]]>
</isNotEmpty>
<isNotEmpty prepend="and" property="beginTime">
ko.order_time <![CDATA[ >= ]]>
#beginTime#
</isNotEmpty>
<isNotEmpty prepend="and" property="endTime">
ko.order_time <![CDATA[ <= ]]>
#endTime#
</isNotEmpty>

<isNotEmpty prepend="and" property="orderTime">
ko.order_time=#orderTime#
</isNotEmpty>
<isNotEmpty prepend="and" property="ostockStatus">
ko.ostock_status=#ostockStatus#
</isNotEmpty>
<isNull property="ostockStatus">
<isNotEmpty property="ostockStatusIds">
<![CDATA[ and ko.ostock_status in ]]>
<iterate property="ostockStatusIds" conjunction="," open="(" close=")">
#ostockStatusIds[]#
</iterate>
</isNotEmpty>
</isNull>
<isNotEmpty prepend="and" property="ostockStatusTitle">
ko.ostock_status_title=#ostockStatusTitle#
</isNotEmpty>
<isNotEmpty prepend="and" property="deliverStatus">
ko.deliver_status=#deliverStatus#
</isNotEmpty>
<isNotEmpty prepend="and" property="deliverStatusStatus">
ko.deliver_status_status=#deliverStatusStatus#
</isNotEmpty>
<isNotEmpty prepend="and" property="payStatus">
<isEqual property="payStatus" compareValue="0">
ko.pay_status=0 and (kop.is_del=1 or kop.is_audit is null)
</isEqual>
<isEqual property="payStatus" compareValue="1">
ko.pay_status=#payStatus#
</isEqual>
<isEqual property="payStatus" compareValue="2">
ko.pay_status=0 and kop.is_audit=0 and kop.is_del=0
</isEqual>
</isNotEmpty>
<isNotEmpty prepend="and" property="payStatusTitle">
ko.pay_status_title=#payStatusTitle#
</isNotEmpty>
<isNotEmpty prepend="and" property="orderStatus">
ko.order_status=#orderStatus#
</isNotEmpty>
<isNotEmpty prepend="and" property="filterIsAudit">
(kop.is_audit = 1 or kop.is_audit is null)
</isNotEmpty>
<isNotEmpty prepend="and" property="orderStatus4App">
<!-- ko.order_status <![CDATA[ < 6 ]]> -->
ko.pay_status = 0 and ko.order_status != 9
</isNotEmpty>
<isNotEmpty prepend="and" property="orderStatus4AppIsManager">
<!-- ( ko.order_status <![CDATA[ < 2 ]]> OR ko.order_status = '7' ) -->
(ko.order_status <![CDATA[ < 2 ]]>)
</isNotEmpty>
<isNull property="orderStatus">
<isNotEmpty property="orderStatuses">
<![CDATA[ and order_status in ]]>
<iterate property="orderStatuses" conjunction="," open="(" close=")">
#orderStatuses[]#
</iterate>
</isNotEmpty>
</isNull>
<isNotEmpty prepend="and" property="orderStatusTitle">
ko.order_status_title=#orderStatusTitle#
</isNotEmpty>
<isNotEmpty prepend="and" property="orderSource">
ko.order_source=#orderSource#
</isNotEmpty>
<isNotEmpty prepend="and" property="orderType">
ko.order_type=#orderType#
</isNotEmpty>
<isNotEmpty prepend="and" property="buyerRemarks">
ko.buyer_remarks=#buyerRemarks#
</isNotEmpty>
<isNotEmpty prepend="and" property="sellerRemarks">
ko.seller_remarks=#sellerRemarks#
</isNotEmpty>
<isNotEmpty prepend="and" property="isPartialPayment">
ko.is_partial_payment=#isPartialPayment#
</isNotEmpty>
<isNotEmpty prepend="and" property="isHaveInvoice">
ko.is_have_invoice=#isHaveInvoice#
</isNotEmpty>
<isNotEmpty prepend="and" property="isDel">
ko.IS_DEL=#isDel#
</isNotEmpty>
<isNotEmpty prepend="and" property="createBy">
ko.CREATE_BY=#createBy#
</isNotEmpty>
<isNotEmpty prepend="and" property="createTime">
ko.CREATE_TIME=#createTime#
</isNotEmpty>
<isNotEmpty prepend="and" property="updateBy">
ko.UPDATE_BY=#updateBy#
</isNotEmpty>
<isNotEmpty prepend="and" property="updateTime">
ko.UPDATE_TIME=#updateTime#
</isNotEmpty>
<isNotEmpty prepend="and" property="bid">
ko.BID=#bid#
</isNotEmpty>
<isNotEmpty prepend="and" property="isDiscuss">
ko.IS_DISCUSS=#isDiscuss#
</isNotEmpty>
<isNotEmpty prepend="and" property="payWay">
ko.PAY_WAY=#payWay#
</isNotEmpty>
<isNotEmpty prepend="and" property="param1">
ko.PARAM1=#param1#
</isNotEmpty>
<isNotEmpty prepend="and" property="param2">
ko.PARAM2=#param2#
</isNotEmpty>
<isNotEmpty prepend="and" property="param3">
ko.PARAM3=#param3#
</isNotEmpty>
<isNotEmpty prepend="and" property="param4">
ko.PARAM4=#param4#
</isNotEmpty>
<isNotEmpty prepend="and" property="param5">
ko.PARAM5=#param5#
</isNotEmpty>
<isNotEmpty prepend="and" property="orderStatusList">
ko.order_status IN ($orderStatusList$)
</isNotEmpty>
<isNotEmpty prepend="and" property="dispatchTime">
ko.DISPATCH_TIME=#dispatchTime#
</isNotEmpty>
<isNotEmpty prepend="and" property="noCancel">
ko.order_status <![CDATA[ <> ]]>
-1
</isNotEmpty>

<isNull property="id">
<isNotEmpty property="oids">
<![CDATA[ and ko.id in ]]>
<iterate property="oids" conjunction="," open="(" close=")">
#oids[]#
</iterate>
</isNotEmpty>
</isNull>
<isNotEmpty prepend="and" property="buyerBids">
ko.buyer_bid IN ($buyerBids$)
</isNotEmpty>

<isNotEmpty property="groupBuyerBid">
group by buyer_bid
</isNotEmpty>

<isNull property="orderBy">
order by id desc
</isNull>

<isNotEmpty prepend=" " property="orderBy">
<isEqual property="orderBy" compareValue="0">
order by id desc
</isEqual>
<isEqual property="orderBy" compareValue="1">  类似只有orderby = 1 时动态拼接下面的语句。
order by post_time desc
</isEqual>
<isEqual property="orderBy" compareValue="2">
order by post_time asc
</isEqual>
<isEqual property="orderBy" compareValue="3">
order by sum_amout desc
</isEqual>
<isEqual property="orderBy" compareValue="4">
order by sum_amout asc
</isEqual>
</isNotEmpty>

<isNotEmpty property="pageNo">
<isNotEmpty property="pageSize">
LIMIT #pageNo#,#pageSize#
</isNotEmpty>
</isNotEmpty>
</select>

o
粉丝 0
博文 500
码字总数 0
作品 0
私信 提问
加载中
请先登录后再评论。
SQLServer实现split分割字符串到列

网上已有人实现sqlserver的split函数可将字符串分割成行,但是我们习惯了split返回数组或者列表,因此这里对其做一些改动,最终实现也许不尽如意,但是也能解决一些问题。 先贴上某大牛写的s...

cwalet
2014/05/21
9.7K
0
Swift百万线程攻破单例(Singleton)模式

一、不安全的单例实现 在上一篇文章我们给出了单例的设计模式,直接给出了线程安全的实现方法。单例的实现有多种方法,如下面: class SwiftSingleton { } 这段代码的实现,在shared中进行条...

一叶博客
2014/06/20
3.6K
16
开源数据访问组件--Smark.Data

Smark.Data是基于Ado.net实现的数据访问组件,提供基于强类型的查询表达式进行灵活的数据查询,统计,修改和删除等操作;采用基于条件驱动的操作模式,使数据操作更简单轻松;内部通过标准SQL...

泥水佬
2013/03/12
2.6K
0
Java™ 编译器--Janino

Janino是一个超级小但又超级快的Java™ 编译器. 它不仅能像javac工具那样讲一组源文件编译成字节码文件,还可以对一些Java表达式,代码块,类中的文本(class body)或者内存中源文件进行编译,...

匿名
2013/04/02
4.2K
0
超快的css selector引擎--kquery 2.0

kquery是一款基于javascript完整实现css3选择器引擎. 兼容所有主流浏览器ie6+/chrome/firefox/opera/safari, 压缩和gzip之后仅8kb大小。智能编译引擎优化去除不必要的逻辑, 查询速度远胜于...

aaron.xiao
2012/10/23
735
0

没有更多内容

加载失败,请刷新页面

加载更多

汇总你在 Linux 上的命令使用情况

使用合适的命令,你可以快速了解 Linux 系统上使用的命令以及执行的频率。 汇总 Linux 系统上使用的命令只需一串相对简单的命令以及几条管道将它们绑定在一起。当你的历史记录缓冲区保留了最...

osc_bvincwvq
13分钟前
7
0
Hacker News 简讯 2020-08-15

最后更新时间: 2020-08-15 07:01 Welders set off Beirut blast while securing explosives - (maritime-executive.com) 焊工在固定炸药的同时引爆了贝鲁特爆炸 得分:383 | 评论:322 Factor......

FalconChen
今天
24
0
OSChina 周六乱弹 —— 老椅小猫秋乡梦 梦里石台堆小鱼

Osc乱弹歌单(2020)请戳(这里) 【今日歌曲】 @小小编辑 :《MOM》- 蜡笔小心 《MOM》- 蜡笔小心 手机党少年们想听歌,请使劲儿戳(这里) @狄工 :腾讯又在裁员了,35岁以上清退,抖音看到...

小小编辑
今天
111
3
构建高性能队列,你不得不知道的底层知识!

前言 本文收录于专辑:http://dwz.win/HjK,点击解锁更多数据结构与算法的知识。 你好,我是彤哥。 上一节,我们一起学习了如何将递归改写为非递归,其中,用到的数据结构主要是栈。 栈和队列...

彤哥读源码
今天
17
0
Anaconda下安装keras和tensorflow

Anaconda下安装keras和tensorflow 一、下载并安装Anaconda: Anaconda下载 安装步骤: 如果是多用户操作系统选择All Users,单用户选择Just Me 选择合适的安装路径 然后勾选这个,自动配置环境...

Atlantis-Brook
今天
15
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部