|
@@ -335,5 +335,88 @@
|
|
|
AND it.act_id = #{actId}
|
|
|
AND it.audit_status = "N"
|
|
|
</update>
|
|
|
+ <select id="selectOrderAuditItems" parameterType="AuditItems" resultType="Map">
|
|
|
+ SELECT
|
|
|
+ item.id,
|
|
|
+ CASE
|
|
|
+ item.act_id
|
|
|
+ WHEN 410 THEN
|
|
|
+ '下单审批'
|
|
|
+ WHEN 420 THEN
|
|
|
+ '配船审批'
|
|
|
+ END actId,
|
|
|
+ item.bill_id AS billId,
|
|
|
+ corp.f_name AS refno1,
|
|
|
+ item.refno2,
|
|
|
+ item.refno3,
|
|
|
+ item.refno2 AS refno4,
|
|
|
+ item.bill_no AS billNo,
|
|
|
+ us.user_id AS userId,
|
|
|
+ item.audit_item,
|
|
|
+ item.audit_user_id AS auditUserId,
|
|
|
+ CASE
|
|
|
+ item.audit_status
|
|
|
+ WHEN 'O' THEN
|
|
|
+ '提交'
|
|
|
+ WHEN 'N' THEN
|
|
|
+ '未知状态'
|
|
|
+ WHEN 'S' THEN
|
|
|
+ '待审'
|
|
|
+ WHEN 'B' THEN
|
|
|
+ '审核退回'
|
|
|
+ WHEN 'A' THEN
|
|
|
+ '审核通过'
|
|
|
+ END audit,
|
|
|
+ item.send_user_id AS sendUserId,
|
|
|
+ item.send_name AS sendName,
|
|
|
+ usr.user_name AS auditUserName,
|
|
|
+ usr.nick_name AS nickName,
|
|
|
+ item.send_time AS sendTime,
|
|
|
+ item.audit_op_time AS auditOpTime,
|
|
|
+ item.bill_time AS billTime,
|
|
|
+ <if test="refno2 == 'SQ' or refno2 == 'CK' or refno2 == 'RK' or refno2 == 'XS' ">
|
|
|
+ tw.f_money As monry,
|
|
|
+ tw.f_bsdate fBsdate,
|
|
|
+ tp.f_name projectName,
|
|
|
+ </if>
|
|
|
+ item.audit_msg AS auditMsg
|
|
|
+ FROM
|
|
|
+ audit_items item
|
|
|
+ LEFT JOIN t_corps corp ON corp.f_id = item.refno1
|
|
|
+ LEFT JOIN audit_items_users us ON us.pid = item.id
|
|
|
+ LEFT JOIN sys_user usr ON usr.user_id = item.audit_user_id
|
|
|
+ <if test="refno2 == 'SQ' or refno2 == 'CK' or refno2 == 'RK' or refno2 == 'XS' ">
|
|
|
+ LEFT JOIN t_warehousebills tw ON item.bill_id = tw.f_id
|
|
|
+ LEFT JOIN t_project tp ON tp.f_id = tw.f_goodsid
|
|
|
+ </if>
|
|
|
+ where
|
|
|
+ 1=1
|
|
|
+ <if test="billNo != null and billNo != ''">and item.bill_no = #{billNo}</if>
|
|
|
+ <if test="actId != null and actId != ''">and item.act_id = #{actId}</if>
|
|
|
+ <if test="refno3 != null and refno3 != ''">and item.refno3 = #{refno3}</if>
|
|
|
+ <if test="auditStatus != null and auditStatus != ''">and item.audit_status = #{auditStatus} and us.audit_status = #{auditStatus} </if>
|
|
|
+ <if test="refno2 != null and refno2 != ''">and item.refno2 = #{refno2}</if>
|
|
|
+ <if test="billId != null and billId != ''">and item.bill_id like concat('%', #{billId}, '%')</if>
|
|
|
+ <if test="refno1 != null and refno1 != ''">and corp.f_name like concat('%', #{refno1}, '%')</if>
|
|
|
+ <if test="sendUserId != null">and item.send_user_id = #{sendUserId}
|
|
|
+ </if>
|
|
|
+ <if test="auditUserId != null">and item.audit_user_id = #{auditUserId}</if>
|
|
|
+ <if test="billTime != null">and item.bill_time = #{billTime}</if>
|
|
|
+ <if test="auditUserId != null">AND us.user_id = #{auditUserId}</if>
|
|
|
+ <if test="sendTimeList != null and (refno2 == 'SQ' or refno2 == 'CK' or refno2 == 'RK' or refno2 == 'XS') and sendTimeList[0] != null and sendTimeList[0]!= ''">
|
|
|
+ and tw.f_bsdate >= #{sendTimeList[0]}
|
|
|
+ </if>
|
|
|
+ <if test="sendTimeList != null and sendTimeList[1] != null and sendTimeList[1]!= '' and (refno2 == 'SQ' or refno2 == 'CK' or refno2 == 'RK' or refno2 == 'XS')">
|
|
|
+ and tw.f_bsdate <= #{sendTimeList[1]}
|
|
|
+ </if>
|
|
|
+ <if test='auditOpTimeList != null and auditOpTimeList[0] != null and auditOpTimeList[0]!= ""'>
|
|
|
+ and item.audit_op_time >= #{auditOpTimeList[0]}
|
|
|
+ </if>
|
|
|
+ <if test='auditOpTimeList != null and auditOpTimeList[1] != null and auditOpTimeList[1]!= ""'>
|
|
|
+ and item.audit_op_time <= #{auditOpTimeList[1]}
|
|
|
+ </if>
|
|
|
+ ORDER BY
|
|
|
+ CONVERT(item.audit_status USING GBK) DESC,item.send_time DESC
|
|
|
+ </select>
|
|
|
|
|
|
</mapper>
|