刘小明
2024-07-09 f4a214473d2f39accb06f5cf98da5e051ce5e895
名称统一
3个文件已添加
343 ■■■■■ 已修改文件
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaDeviceLifeLastMapper.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoSta/StaDeviceLifeLast.java 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/resources/mapper/StaDeviceLifeLastMapper.xml 209 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaDeviceLifeLastMapper.java
New file
@@ -0,0 +1,31 @@
package com.dy.pmsGlobal.daoSta;
import com.dy.pmsGlobal.pojoSta.StaDeviceLifeLast;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author User
* @description 针对表【sta_device_life_last(最新设备生命周期表)】的数据库操作Mapper
* @createDate 2024-07-06 10:41:09
* @Entity com.dy.pmsGlobal.pojoSta.StaDeviceLifeLast
*/
@Mapper
public interface StaDeviceLifeLastMapper {
    int deleteByPrimaryKey(Long id);
    int insert(StaDeviceLifeLast record);
    int insertSelective(StaDeviceLifeLast record);
    StaDeviceLifeLast selectByPrimaryKey(Long id);
    List<StaDeviceLifeLast> selectByDeviceNo(String deviceNo);
    int updateByPrimaryKeySelective(StaDeviceLifeLast record);
    int updateByPrimaryKey(StaDeviceLifeLast record);
    int updateByDeviceNo(StaDeviceLifeLast lastLife);
}
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoSta/StaDeviceLifeLast.java
New file
@@ -0,0 +1,103 @@
package com.dy.pmsGlobal.pojoSta;
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dy.common.po.BaseEntity;
import jakarta.validation.constraints.NotBlank;
import lombok.*;
import java.util.Date;
/**
* 最新设备生命周期表
* @TableName sta_device_life_last
*/
@TableName(value="sta_device_life_last", autoResultMap = true)
@Data
@Builder
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class StaDeviceLifeLast implements BaseEntity {
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    public Long id;
    /**
    * 设备码
    */
    @NotBlank(message="设备码不能为空")
    public String deviceNo;
    /**
    * 生产登录id
    */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    public Long workId;
    /**
    * 维修id
    */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    public Long repairId;
    /**
    * 计划id
    */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    public Long planId;
    /**
    * 工站id
    */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    public Long stationId;
    /**
    * 当前节点
    */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    public Long currNode;
    /**
    * 节点作业内容
    */
    public String nodeContent;
    /**
    * 记录设备周期内容
    */
    public String deviceCycleContent;
    /**
    * 状态: 1:组装中,2:完成,3:维修,4:报废
    */
    public Integer status;
    /**
    * 维修节点返回的错误信息
    */
    public String errorMsg;
    /**
    * 辅助人员:辅助员工id,以逗号隔开
    */
    public String assistants;
    /**
    * 入站时间
    */
    public Date inTime;
    /**
    * 出站时间
    */
    public Date outTime;
    /**
    * 操作员id
    */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    public Long updatedBy;
    /**
    * 备注
    */
    public String memo;
    @TableField(exist = false)
    public String planName;
    @TableField(exist = false)
    public String stationName;
    @TableField(exist = false)
    public String updateUserName;
    @TableField(exist = false)
    public String assistantNames;
}
pms-parent/pms-global/src/main/resources/mapper/StaDeviceLifeLastMapper.xml
New file
@@ -0,0 +1,209 @@
<?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.StaDeviceLifeLastMapper">
    <resultMap id="BaseResultMap" type="com.dy.pmsGlobal.pojoSta.StaDeviceLifeLast">
            <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="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"/>
    </resultMap>
    <resultMap id="joinResultMap" type="com.dy.pmsGlobal.pojoSta.StaDeviceLife" extends="BaseResultMap">
        <result property="planName" column="plan_name" jdbcType="VARCHAR"/>
        <result property="stationName" column="station_name" jdbcType="VARCHAR"/>
        <result property="updateUserName" column="update_user_name" jdbcType="VARCHAR"/>
        <association property="assistantNames" jdbcType="VARCHAR" column="assistants"
                     select="com.dy.pmsGlobal.daoBa.BaUserMapper.selectNamesByAssistants" fetchType="eager" />
    </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,error_msg,assistants,
        in_time,out_time,updated_by,
        memo
    </sql>
    <select id="selectByDeviceNo" parameterType="java.lang.String" resultMap="joinResultMap">
        select
            t.* ,p.`name` plan_name,s.`name` station_name,u.`name` update_user_name
        FROM
            sta_device_life 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
        where  t.device_no = #{deviceNo,jdbcType=VARCHAR}
        ORDER BY t.id DESC
    </select>
    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from sta_device_life_last
        where  id = #{id,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
        delete from sta_device_life_last
        where  id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoSta.StaDeviceLifeLast" useGeneratedKeys="true">
        insert into sta_device_life_last
        ( id,device_no,work_id
        ,repair_id,plan_id,station_id
        ,curr_node,node_content,device_cycle_content
        ,status,error_msg,assistants
        ,in_time,out_time,updated_by
        ,memo)
        values (#{id,jdbcType=BIGINT},#{deviceNo,jdbcType=VARCHAR},#{workId,jdbcType=BIGINT}
        ,#{repairId,jdbcType=BIGINT},#{planId,jdbcType=BIGINT},#{stationId,jdbcType=BIGINT}
        ,#{currNode,jdbcType=BIGINT},#{nodeContent,jdbcType=VARCHAR},#{deviceCycleContent,jdbcType=VARCHAR}
        ,#{status,jdbcType=TINYINT},#{errorMsg,jdbcType=VARCHAR},#{assistants,jdbcType=VARCHAR}
        ,#{inTime,jdbcType=TIMESTAMP},#{outTime,jdbcType=TIMESTAMP},#{updatedBy,jdbcType=BIGINT}
        ,#{memo,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pmsGlobal.pojoSta.StaDeviceLifeLast" useGeneratedKeys="true">
        insert into sta_device_life_last
        <trim prefix="(" suffix=")" suffixOverrides=",">
                <if test="id != null">id,</if>
                <if test="deviceNo != null">device_no,</if>
                <if test="workId != null">work_id,</if>
                <if test="repairId != null">repair_id,</if>
                <if test="planId != null">plan_id,</if>
                <if test="stationId != null">station_id,</if>
                <if test="currNode != null">curr_node,</if>
                <if test="nodeContent != null">node_content,</if>
                <if test="deviceCycleContent != null">device_cycle_content,</if>
                <if test="status != null">status,</if>
                <if test="errorMsg != null">error_msg,</if>
                <if test="assistants != null">assistants,</if>
                <if test="inTime != null">in_time,</if>
                <if test="outTime != null">out_time,</if>
                <if test="updatedBy != null">updated_by,</if>
                <if test="memo != null">memo,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                <if test="id != null">#{id,jdbcType=BIGINT},</if>
                <if test="deviceNo != null">#{deviceNo,jdbcType=VARCHAR},</if>
                <if test="workId != null">#{workId,jdbcType=BIGINT},</if>
                <if test="repairId != null">#{repairId,jdbcType=BIGINT},</if>
                <if test="planId != null">#{planId,jdbcType=BIGINT},</if>
                <if test="stationId != null">#{stationId,jdbcType=BIGINT},</if>
                <if test="currNode != null">#{currNode,jdbcType=BIGINT},</if>
                <if test="nodeContent != null">#{nodeContent,jdbcType=VARCHAR},</if>
                <if test="deviceCycleContent != null">#{deviceCycleContent,jdbcType=VARCHAR},</if>
                <if test="status != null">#{status,jdbcType=TINYINT},</if>
                <if test="errorMsg != null">#{errorMsg,jdbcType=VARCHAR},</if>
                <if test="assistants != null">#{assistants,jdbcType=VARCHAR},</if>
                <if test="inTime != null">#{inTime,jdbcType=TIMESTAMP},</if>
                <if test="outTime != null">#{outTime,jdbcType=TIMESTAMP},</if>
                <if test="updatedBy != null">#{updatedBy,jdbcType=BIGINT},</if>
                <if test="memo != null">#{memo,jdbcType=VARCHAR},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.dy.pmsGlobal.pojoSta.StaDeviceLifeLast">
        update sta_device_life_last
        <set>
                <if test="deviceNo != null">
                    device_no = #{deviceNo,jdbcType=VARCHAR},
                </if>
                <if test="workId != null">
                    work_id = #{workId,jdbcType=BIGINT},
                </if>
                <if test="repairId != null">
                    repair_id = #{repairId,jdbcType=BIGINT},
                </if>
                <if test="planId != null">
                    plan_id = #{planId,jdbcType=BIGINT},
                </if>
                <if test="stationId != null">
                    station_id = #{stationId,jdbcType=BIGINT},
                </if>
                <if test="currNode != null">
                    curr_node = #{currNode,jdbcType=BIGINT},
                </if>
                <if test="nodeContent != null">
                    node_content = #{nodeContent,jdbcType=VARCHAR},
                </if>
                <if test="deviceCycleContent != null">
                    device_cycle_content = #{deviceCycleContent,jdbcType=VARCHAR},
                </if>
                <if test="status != null">
                    status = #{status,jdbcType=TINYINT},
                </if>
                <if test="errorMsg != null">
                    error_msg = #{errorMsg,jdbcType=VARCHAR},
                </if>
                <if test="assistants != null">
                    assistants = #{assistants,jdbcType=VARCHAR},
                </if>
                <if test="inTime != null">
                    in_time = #{inTime,jdbcType=TIMESTAMP},
                </if>
                <if test="outTime != null">
                    out_time = #{outTime,jdbcType=TIMESTAMP},
                </if>
                <if test="updatedBy != null">
                    updated_by = #{updatedBy,jdbcType=BIGINT},
                </if>
                <if test="memo != null">
                    memo = #{memo,jdbcType=VARCHAR},
                </if>
        </set>
        where   id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKey" parameterType="com.dy.pmsGlobal.pojoSta.StaDeviceLifeLast">
        update sta_device_life_last
        set
            device_no =  #{deviceNo,jdbcType=VARCHAR},
            work_id =  #{workId,jdbcType=BIGINT},
            repair_id =  #{repairId,jdbcType=BIGINT},
            plan_id =  #{planId,jdbcType=BIGINT},
            station_id =  #{stationId,jdbcType=BIGINT},
            curr_node =  #{currNode,jdbcType=BIGINT},
            node_content =  #{nodeContent,jdbcType=VARCHAR},
            device_cycle_content =  #{deviceCycleContent,jdbcType=VARCHAR},
            status =  #{status,jdbcType=TINYINT},
            error_msg =  #{errorMsg,jdbcType=VARCHAR},
            assistants =  #{assistants,jdbcType=VARCHAR},
            in_time =  #{inTime,jdbcType=TIMESTAMP},
            out_time =  #{outTime,jdbcType=TIMESTAMP},
            updated_by =  #{updatedBy,jdbcType=BIGINT},
            memo =  #{memo,jdbcType=VARCHAR}
        where   id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByDeviceNo">
        update sta_device_life_last
        set
            work_id =  #{workId,jdbcType=BIGINT},
            repair_id =  #{repairId,jdbcType=BIGINT},
            plan_id =  #{planId,jdbcType=BIGINT},
            station_id =  #{stationId,jdbcType=BIGINT},
            curr_node =  #{currNode,jdbcType=BIGINT},
            node_content =  #{nodeContent,jdbcType=VARCHAR},
            device_cycle_content =  #{deviceCycleContent,jdbcType=VARCHAR},
            status =  #{status,jdbcType=TINYINT},
            error_msg =  #{errorMsg,jdbcType=VARCHAR},
            assistants =  #{assistants,jdbcType=VARCHAR},
            in_time =  #{inTime,jdbcType=TIMESTAMP},
            out_time =  #{outTime,jdbcType=TIMESTAMP},
            updated_by =  #{updatedBy,jdbcType=BIGINT},
            memo =  #{memo,jdbcType=VARCHAR}
        where   device_no = #{deviceNo,jdbcType=VARCHAR}
    </update>
</mapper>