<?xml version="1.0" encoding="UTF-8"?> 
 | 
<!DOCTYPE mapper 
 | 
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
 | 
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 
 | 
<mapper namespace="com.dy.pmsGlobal.daoSta.StaDeviceProductionLogPastMapper"> 
 | 
  
 | 
    <resultMap id="BaseResultMap" type="com.dy.pmsGlobal.pojoSta.StaDeviceProductionLogPast"> 
 | 
            <id property="id" column="id" jdbcType="BIGINT"/> 
 | 
            <result property="deviceNo" column="device_no" jdbcType="VARCHAR"/> 
 | 
            <result property="workId" column="work_id" jdbcType="BIGINT"/> 
 | 
            <result property="repairId" column="repair_id" jdbcType="BIGINT"/> 
 | 
            <result property="planId" column="plan_id" jdbcType="BIGINT"/> 
 | 
            <result property="stationId" column="station_id" jdbcType="BIGINT"/> 
 | 
            <result property="currNode" column="curr_node" jdbcType="BIGINT"/> 
 | 
            <result property="nodeContent" column="node_content" jdbcType="VARCHAR"/> 
 | 
            <result property="deviceCycleContent" column="device_cycle_content" jdbcType="VARCHAR"/> 
 | 
            <result property="status" column="status" jdbcType="TINYINT"/> 
 | 
            <result property="result" column="result" jdbcType="TINYINT"/> 
 | 
            <result property="errorMsg" column="error_msg" jdbcType="VARCHAR"/> 
 | 
            <result property="assistants" column="assistants" jdbcType="VARCHAR"/> 
 | 
            <result property="inTime" column="in_time" jdbcType="TIMESTAMP"/> 
 | 
            <result property="outTime" column="out_time" jdbcType="TIMESTAMP"/> 
 | 
            <result property="updatedBy" column="updated_by" jdbcType="BIGINT"/> 
 | 
            <result property="memo" column="memo" jdbcType="VARCHAR"/> 
 | 
            <result property="number" column="number" jdbcType="INTEGER"/> 
 | 
    </resultMap> 
 | 
  
 | 
    <sql id="Base_Column_List"> 
 | 
        id,device_no,work_id, 
 | 
        repair_id,plan_id,station_id, 
 | 
        curr_node,node_content,device_cycle_content, 
 | 
        status,result,error_msg, 
 | 
        assistants,in_time,out_time, 
 | 
        updated_by,memo,number 
 | 
    </sql> 
 | 
<!--    <update id="createNewTable">--> 
 | 
<!--        CREATE TABLE ${newTableName} LIKE sta_device_production_log--> 
 | 
<!--    </update>--> 
 | 
  
 | 
    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> 
 | 
        select 
 | 
        <include refid="Base_Column_List" /> 
 | 
        from sta_device_production_log_past 
 | 
        where  id = #{id,jdbcType=BIGINT}  
 | 
    </select> 
 | 
  
 | 
    <!-- 将过往日志移动到 sta_device_production_log_past --> 
 | 
  
 | 
    <insert id="insertIntoPastLogs"> 
 | 
        INSERT INTO sta_device_production_log_past SELECT * FROM sta_device_production_log WHERE DATE(out_time) != CURDATE(); 
 | 
    </insert> 
 | 
    <delete id="deleteFromLogTable"> 
 | 
        DELETE FROM sta_device_production_log WHERE DATE(out_time) != CURDATE(); 
 | 
    </delete> 
 | 
  
 | 
    <select id="countLastDayLogs" resultType="_long"> 
 | 
        SELECT COUNT(1) FROM sta_device_production_log WHERE DATE(out_time) != CURDATE(); 
 | 
    </select> 
 | 
</mapper> 
 |