|
|
@@ -2,6 +2,54 @@
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.jeesite.modules.mes.dao.MesDeviceTimeDao">
|
|
|
|
|
|
+ <select id="findList" resultType="MesDeviceTime">
|
|
|
+ SELECT
|
|
|
+ a.id AS "id",
|
|
|
+ a.oprno AS "oprno",
|
|
|
+ a.sn AS "sn",
|
|
|
+ a.start_date AS "startDate",
|
|
|
+ a.end_date AS "endDate",
|
|
|
+ a.interval AS "interval",
|
|
|
+ a.create_date AS "createDate",
|
|
|
+ a.update_date AS "updateDate",
|
|
|
+ a.scheduled_date AS "scheduledDate",
|
|
|
+ a.transfer AS "transfer",
|
|
|
+ a.product_cate AS "productCate",
|
|
|
+ COALESCE((
|
|
|
+ SELECT p.create_by
|
|
|
+ FROM mes_product_record p
|
|
|
+ WHERE p.sn = a.sn
|
|
|
+ AND p.line_sn = a.product_cate
|
|
|
+ AND (p.oprno = a.oprno OR p.oprno = LEFT(a.oprno, 5) OR LEFT(p.oprno, 5) = a.oprno)
|
|
|
+ AND p.create_by IS NOT NULL
|
|
|
+ AND p.create_by != ''
|
|
|
+ ORDER BY
|
|
|
+ CASE WHEN p.oprno = a.oprno THEN 0 ELSE 1 END,
|
|
|
+ p.update_date DESC,
|
|
|
+ p.id DESC
|
|
|
+ LIMIT 1
|
|
|
+ ), '') AS "createBy",
|
|
|
+ COALESCE((
|
|
|
+ SELECT p.update_by
|
|
|
+ FROM mes_product_record p
|
|
|
+ WHERE p.sn = a.sn
|
|
|
+ AND p.line_sn = a.product_cate
|
|
|
+ AND (p.oprno = a.oprno OR p.oprno = LEFT(a.oprno, 5) OR LEFT(p.oprno, 5) = a.oprno)
|
|
|
+ AND p.update_by IS NOT NULL
|
|
|
+ AND p.update_by != ''
|
|
|
+ ORDER BY
|
|
|
+ CASE WHEN p.oprno = a.oprno THEN 0 ELSE 1 END,
|
|
|
+ p.update_date DESC,
|
|
|
+ p.id DESC
|
|
|
+ LIMIT 1
|
|
|
+ ), '') AS "updateBy"
|
|
|
+ FROM mes_device_time a
|
|
|
+ <where>
|
|
|
+ ${sqlMap.where.toSql()}
|
|
|
+ </where>
|
|
|
+ ORDER BY ${sqlMap.order.toSql()}
|
|
|
+ </select>
|
|
|
+
|
|
|
<!-- 查询数据
|
|
|
<select id="findList" resultType="MesDeviceTime">
|
|
|
SELECT ${sqlMap.column.toSql()}
|
|
|
@@ -21,4 +69,4 @@
|
|
|
ORDER BY create_date DESC
|
|
|
LIMIT 1
|
|
|
</select>
|
|
|
-</mapper>
|
|
|
+</mapper>
|