改如何修正: <select id="getCurrentTask" resultType="com.sottop.sokonmobile.sokonmobile.qingdao.entity.AsEmWorkOrderEntity"> SELECT asewo.code_s as code,asewo.order_type_s as orderType,asewo.equipment_name_s as equipmentName,asewo.executor_s as executor, asewo.plan_start_time_T as planStartTime,asewo.plan_finish_time_T as planFinishTime,asewo.tpm_key_s as tpmKey,asewo.shop_s as shop, asewo.line_S as line,asewo.actual_start_time_t as startTime,asewo.actual_finish_time_t as finishTime,asewo.executor_account_s as executorAccounts, asewo.source_type_s as sourceType,asewo.SOURCE_ORDER_S as sourceOrder,asewo.CREATION_TIME as creationTime FROM AT_AS_EM_Work_Order asewo WHERE to_char(asewo.plan_start_time_T,'yyyy_mm-dd hh24:mi') <= to_char(plan_finish_time_T,'yyyy_mm_dd hh24:mi') AND asewo.ORDER_STATUS_S='创建' AND asewo.executor_s=#{executor} <if test="orderType!=null and orderType!=''"> AND asewo.order_type_s=#{orderType} </if> ORDER BY asewo.creation_time DESC Union All SELECT asewo.code_s as code,asewo.order_type_s as orderType,asewo.equipment_name_s as equipmentName,asewo.executor_s as executor, asewo.plan_start_time_T as planStartTime,asewo.plan_finish_time_T as planFinishTime,asewo.tpm_key_s as tpmKey,asewo.shop_s as shop, asewo.line_S as line,asewo.actual_start_time_t as startTime,asewo.actual_finish_time_t as finishTime,asewo.executor_account_s as executorAccounts, asewo.source_type_s as sourceType,asewo.SOURCE_ORDER_S as sourceOrder,asewo.CREATION_TIME as creationTime FROM AT_AS_EM_Work_Order asewo WHERE asewo.ORDER_STATUS_S='创建' AND asewo.executor_s=#{executor} <if test="orderType!=null and orderType!=''"> AND asewo.order_type_s=#{orderType} </if> ORDER BY asewo.creation_time DESC </select>
时间: 2024-03-27 22:39:12 浏览: 77
[JWFD开源工作流]反馈流程引擎设计和伪代码(在原V0.96.4基础上升级)
根据您提供的信息,似乎这个SQL语句存在一些问题,包括:
1. 在第一行的resultType中,应该使用全限定类名而非实体类名。
2. 在第6行的SQL语句中,应该使用小于等于(<=)而非HTML实体字符(<=)。
3. 在第18行和第30行的ORDER BY子句中,应该使用ORDER BY asewo.creation_time DESC,而非ORDER BY creation_time DESC。因为创建时间(creation_time)是AT_AS_EM_Work_Order表中的列,需要使用别名asewo来引用。
修正后的SQL语句如下所示:
```
<select id="getCurrentTask" resultType="com.sottop.sokonmobile.sokonmobile.qingdao.entity.AsEmWorkOrderEntity">
SELECT
asewo.code_s as code,
asewo.order_type_s as orderType,
asewo.equipment_name_s as equipmentName,
asewo.executor_s as executor,
asewo.plan_start_time_T as planStartTime,
asewo.plan_finish_time_T as planFinishTime,
asewo.tpm_key_s as tpmKey,
asewo.shop_s as shop,
asewo.line_S as line,
asewo.actual_start_time_t as startTime,
asewo.actual_finish_time_t as finishTime,
asewo.executor_account_s as executorAccounts,
asewo.source_type_s as sourceType,
asewo.SOURCE_ORDER_S as sourceOrder,
asewo.CREATION_TIME as creationTime
FROM AT_AS_EM_Work_Order asewo
WHERE to_char(asewo.plan_start_time_T,'yyyy_mm-dd hh24:mi') <= to_char(asewo.plan_finish_time_T,'yyyy_mm_dd hh24:mi')
AND asewo.ORDER_STATUS_S='创建'
AND asewo.executor_s=#{executor}
<if test="orderType!=null and orderType!=''">
AND asewo.order_type_s=#{orderType}
</if>
ORDER BY asewo.creation_time DESC
Union All
SELECT
asewo.code_s as code,
asewo.order_type_s as orderType,
asewo.equipment_name_s as equipmentName,
asewo.executor_s as executor,
asewo.plan_start_time_T as planStartTime,
asewo.plan_finish_time_T as planFinishTime,
asewo.tpm_key_s as tpmKey,
asewo.shop_s as shop,
asewo.line_S as line,
asewo.actual_start_time_t as startTime,
asewo.actual_finish_time_t as finishTime,
asewo.executor_account_s as executorAccounts,
asewo.source_type_s as sourceType,
asewo.SOURCE_ORDER_S as sourceOrder,
asewo.CREATION_TIME as creationTime
FROM AT_AS_EM_Work_Order asewo
WHERE asewo.ORDER_STATUS_S='创建'
AND asewo.executor_s=#{executor}
<if test="orderType!=null and orderType!=''">
AND asewo.order_type_s=#{orderType}
</if>
ORDER BY asewo.creation_time DESC
</select>
```
阅读全文