Fancy
2024-07-29 abdfbf6dabca15594ed57a1560bcfffecb0ac854
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?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>
</mapper>