mapping select 多条件查询 遍历查询
程序员文章站
2022-04-22 19:40:16
...
<!-- 查询查询出来的订单列表表里边包含几个学生(学生身份证号)(家长身份)-->
<select id="queryOrderHasStudent" parameterType="com.zichen.xhkq.pojo.Order" resultType="com.zichen.xhkq.pojo.Order">
SELECT DISTINCT os.`xsxm`,os.`xssfz`,os.`schoolName`,os.`ddzt` FROM(SELECT * FROM `order`
WHERE `jtbs`=1
AND `xssfz`IN
<foreach item="xssfz" collection="stuIdCardList" open="(" separator="," close=")">
#{xssfz}
</foreach>
AND `schoolId`=#{schoolId}
AND `ddzt`=#{ddzt}
<if test="starttime != null and !''.equals(starttime) ">
AND `cjsj` BETWEEN #{starttime} AND NOW()
</if>
)os
</select>
<!-- 查询订单(家长身份)-->
<select id="queryOrder" parameterType="com.zichen.xhkq.pojo.Order" resultType="com.zichen.xhkq.pojo.Order">
SELECT * FROM `order`
WHERE `jtbs`=1
AND `xssfz`IN
<foreach item="xssfz" collection="stuIdCardList" open="(" separator="," close=")">
#{xssfz}
</foreach>
AND `schoolId`=#{schoolId}
AND `ddzt`=#{ddzt}
<if test="starttime != null and !''.equals(starttime)">
AND `cjsj` BETWEEN #{starttime} AND NOW()
</if>
</select>
<!-- 根据订单号查询对应几个学生-->
<select id="findWhichStudent" parameterType="java.util.List" resultType="com.zichen.xhkq.pojo.Order">
SELECT DISTINCT `xssfz` FROM `order` WHERE 1=1
<if test="ddbhmxlist.size != 0">
AND `ddbhmx` in
<foreach item="ddbhmx" collection="ddbhmxlist" open="(" separator="," close=")">
#{ddbhmx}
</foreach>
</if>
</select>
<!-- 根据订单号查询支付订单号是否在订单明细表中存在-->
<select id="findOrder" parameterType="java.util.List" resultType="com.zichen.xhkq.pojo.Order">
SELECT * FROM `order` WHERE 1=1
<if test="ddbhmxlist.size != 0">
AND `ddbhmx` in
<foreach item="ddbhmx" collection="ddbhmxlist" open="(" separator="," close=")">
#{ddbhmx}
</foreach>
</if>
</select>
<!-- 根据订单号查询订单状态是否为未缴-->
<select id="findIsPay" parameterType="java.util.List" resultType="com.zichen.xhkq.pojo.Order">
SELECT DISTINCT `ddzt` FROM `order` WHERE 1=1
<if test="ddbhmxlist.size != 0">
AND `ddbhmx` in
<foreach item="ddbhmx" collection="ddbhmxlist" open="(" separator="," close=")">
#{ddbhmx}
</foreach>
</if>
</select>
<!-- 根据订单号查询支付订单号在订单明细表中存在几个-->
<select id="findOrderSize" parameterType="java.util.List" resultType="com.zichen.xhkq.pojo.Order">
SELECT DISTINCT `ddbh` FROM `order` WHERE `ddbh` IS NOT NULL
<if test="ddbhmxlist.size != 0">
AND `ddbhmx` in
<foreach item="ddbhmx" collection="ddbhmxlist" open="(" separator="," close=")">
#{ddbhmx}
</foreach>
</if>
</select>
上一篇: RDF与SPARQL的一些知识整理
下一篇: 解决ElementUI中默认样式的修改
推荐阅读
-
MVC+Bootstrap+Drapper使用PagedList.Mvc支持多查询条件分页
-
SQL数据库Select语句的基本语法、条件查询
-
Hibernat 使用Criteria查询多对多关系(SET集合)设置条件
-
MyDAL - .Where() 之 .WhereSegment 根据条件 动态设置 Select查询条件 使用
-
select-mysql 嵌套查询,一个表的多个字段 作为另一个表的条件,若为空输出0,求高手
-
将查询条件的input、select清空_javascript技巧
-
SQL数据库Select语句的基本语法、条件查询
-
新手求教 php查询 遍历数据库 多条符合条件数据输出的记录只有一条
-
select-mysql 嵌套查询,一个表的多个字段 作为另一个表的条件,求高手
-
select-mysql 嵌套查询,一个表的多个字段 作为另一个表的条件,若为空输出0,求高手