if (dto != null) { return this.error("不可添加重复数据!!"); }
时间: 2024-06-01 07:09:53 浏览: 4
This code block checks if the value of 'dto' is not equal to null. If it is not null, it means that there is already existing data and the function returns an error message "不可添加重复数据!!" which means "Cannot add duplicate data!".
相关问题
<if test="dto.payType == 5"> AND paym.settlement_type = 1 </if> <if test="dto.payType != 1 and dto.payType != 5"> AND 1=2 </if> WHERE pay.id is not null or paym.id is not null
这段代码看起来是一个 SQL 查询语句的一部分,其中包括了两个 IF 判断语句。第一个 IF 判断语句的条件是 "dto.payType == 5",表示如果 dto 对象中的 payType 属性值等于 5,那么查询结果中的 paym.settlement_type 属性值必须等于 1。第二个 IF 判断语句的条件是 "dto.payType != 1 and dto.payType != 5",表示如果 dto 对象中的 payType 属性值既不等于 1 也不等于 5,那么查询结果中的所有条件都不成立,返回空结果。最后,WHERE 子句中的条件是 pay.id is not null or paym.id is not null,表示查询结果中 pay.id 或 paym.id 不为空的数据。
select IFNULL(sum(give.giveAmount),0) from( select IF(sum(IF(pay.receipt_type!=3,pay.pay_amount,0))-x.total_amount>0,sum(IF(pay.receipt_type!=3,pay.pay_amount,0))-x.total_amount,0) as 'giveAmount' from po_order x LEFT JOIN po_order_pay pay on x.id=pay.po_order_id where x.is_valid = 1 and x.pay_status = 3 AND x.STATUS = 2 AND x.net_retail_amount>0 <if test="dto.shopClassRecordId != null and dto.shopClassRecordId != ''"> and x.shop_class_record_id = #{dto.shopClassRecordId} </if> GROUP BY x.id ) give
这也是一段 SQL 语句,用于查询 po_order 表中满足一定条件的记录的 giveAmount 总和。其中,giveAmount 的计算方式是:如果该订单对应的支付记录的 receipt_type 不等于 3,则将该支付记录的 pay_amount 累加起来,否则忽略该支付记录;然后将得到的总和减去该订单的 total_amount,如果结果大于 0,则将该结果作为 giveAmount,否则将 giveAmount 设为 0。最后,对每个订单的 giveAmount 求和,如果没有符合条件的记录,则返回 0。其中,条件包括:is_valid 等于 1,pay_status 等于 3,STATUS 等于 2,net_retail_amount 大于 0。如果传入了参数 dto.shopClassRecordId,则还要加上一个条件 x.shop_class_record_id 等于该参数的值。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)