<select id="selectFundSettlementList" parameterType="FundSettlementEntity" resultMap="FundSettlementResult"> select * from t_fund_settlement <where> <if test="orderType != null and orderType != ''"> <if test="orderType=='other'"> and order_type not in ("issue_ticket","return_ticket","rebook_ticket") </if> <if test="orderType=='issue_ticket' or orderType=='return_ticket' or orderType=='rebook_ticket'"> and order_type = #{orderType} </if> </if> </where> order by bill_date_time desc </select>
时间: 2024-04-19 18:30:22 浏览: 16
这段代码是一个数据库查询语句的映射配置,用于根据条件从表t_fund_settlement中选择基金结算记录。它使用了MyBatis的动态SQL功能来根据不同的条件生成不同的查询语句。
在<where>标签中,它首先检查订单类型是否不为空且不为空字符串。如果满足这个条件,它会根据订单类型的取值生成不同的查询条件。
如果订单类型是"other",则添加一个条件:订单类型不是"issue_ticket"、"return_ticket"或"rebook_ticket"。
如果订单类型是"issue_ticket"、"return_ticket"或"rebook_ticket",则添加一个条件:订单类型等于订单类型的值。
最后,查询结果按照bill_date_time字段进行降序排序。
这段代码的作用是根据给定的条件从t_fund_settlement表中选择符合条件的基金结算记录,并按照指定字段进行排序。
相关问题
<select id="getQueryBook" parameterType="String" resultMap="bookResult"> select * from book where book_name = #{bookName} </select>改为模糊查询
可以将SQL语句修改为:
```
<select id="getQueryBook" parameterType="String" resultMap="bookResult">
select * from book where book_name like CONCAT('%',#{bookName},'%')
</select>
```
这样就可以进行模糊查询,匹配包含关键字的书籍名称。
<select id="selectPPersonListById" parameterType="string" resultMap="PPersonListResult">
这看起来像是 MyBatis 的一个 SQL 映射文件中的一个 select 语句。其中,id 属性指定了这个 select 语句的唯一标识符,parameterType 属性指定了这个 select 语句的输入参数类型,resultMap 属性指定了这个 select 语句返回结果集的映射关系。具体的实现细节需要结合上下文来确定。