Fancy
2024-08-15 e39d9bfeee0b62a60dc08e2dc93e0a05f3d6b503
pms-parent/pms-global/src/main/resources/mapper/StaDeviceProductionLogMapper.xml
@@ -62,6 +62,43 @@
        ORDER BY t.id DESC
    </select>
    <select id="selectProductLog"  resultMap="joinResultMap">
        select
        t.* ,p.`name` plan_name,s.`name` station_name,u.`name` update_user_name
        FROM
        (
        select <include refid="Base_Column_List" /> from sta_device_production_log_past
        <where>
            <if test="deviceNo != null and deviceNo !=''">
                and device_no = #{deviceNo,jdbcType=VARCHAR}
            </if>
            <if test="startTime != null">
                and out_time <![CDATA[ > ]]> #{startTime,jdbcType=TIMESTAMP}
            </if>
            <if test="endTime != null">
                and out_time <![CDATA[ < ]]> #{endTime,jdbcType=TIMESTAMP}
            </if>
        </where>
        union
        select <include refid="Base_Column_List" /> from sta_device_production_log
        <where>
            <if test="deviceNo != null and deviceNo !=''">
                and device_no = #{deviceNo,jdbcType=VARCHAR}
            </if>
            <if test="startTime != null">
                and out_time <![CDATA[ > ]]> #{startTime,jdbcType=TIMESTAMP}
            </if>
            <if test="endTime != null">
                and out_time <![CDATA[ < ]]> #{endTime,jdbcType=TIMESTAMP}
            </if>
        </where>
        ) t
        left join pr_assembly_plan p on t.plan_id=p.id
        left join plt_station s on s.id = t.station_id
        left JOIN ba_user u on u.id=t.updated_by
        ORDER BY t.id DESC
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
        delete from sta_device_production_log
        where  id = #{id,jdbcType=BIGINT}