| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- <?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.ktg.iscs.mapper.IsJobTicketPointsMapper">
- <resultMap type="IsJobTicketPoints" id="IsJobTicketPointsResult">
- <result property="recordId" column="record_id" />
- <result property="ticketId" column="ticket_id" />
- <result property="workshopId" column="workshop_id" />
- <result property="workareaId" column="workarea_id" />
- <result property="pointId" column="point_id" />
- <result property="pointStatus" column="point_status" />
- <result property="delFlag" column="del_flag" />
- <result property="createBy" column="create_by" />
- <result property="createTime" column="create_time" />
- <result property="updateTime" column="update_time" />
- <result property="updateBy" column="update_by" />
- <result property="lockId" column="lock_id" />
- <result property="lockedByKeyId" column="locked_by_key_id" />
- <result property="unlockedByKeyId" column="unlocked_by_key_id" />
- <result property="lockTime" column="lock_time" />
- <result property="unlockTime" column="unlock_time" />
- <result property="prePointId" column="pre_point_id" />
- </resultMap>
- <sql id="selectIsJobTicketPointsVo">
- select * from is_job_ticket_points
- </sql>
- <select id="selectIsJobTicketPointsList" parameterType="IsJobTicketPoints" resultMap="IsJobTicketPointsResult">
- <include refid="selectIsJobTicketPointsVo"/>
- <where>
- <if test="ticketId != null "> and ticket_id = #{ticketId}</if>
- <if test="workshopId != null "> and workshop_id = #{workshopId}</if>
- <if test="workareaId != null "> and workarea_id = #{workareaId}</if>
- <if test="pointId != null "> and point_id = #{pointId}</if>
- <if test="pointStatus != null and pointStatus != ''"> and point_status = #{pointStatus}</if>
- </where>
- </select>
- <select id="selectIsJobTicketPointsByRecordId" parameterType="Long" resultMap="IsJobTicketPointsResult">
- <include refid="selectIsJobTicketPointsVo"/>
- where record_id = #{recordId}
- </select>
- <insert id="insertIsJobTicketPoints" parameterType="IsJobTicketPoints" useGeneratedKeys="true" keyProperty="recordId">
- insert into is_job_ticket_points
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="ticketId != null">ticket_id,</if>
- <if test="workshopId != null">workshop_id,</if>
- <if test="workareaId != null">workarea_id,</if>
- <if test="pointId != null">point_id,</if>
- <if test="pointStatus != null">point_status,</if>
- <if test="delFlag != null">del_flag,</if>
- <if test="createBy != null">create_by,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="updateBy != null">update_by,</if>
- <if test="lockId != null">lock_id,</if>
- <if test="lockedByKeyId != null">locked_by_key_id,</if>
- <if test="unlockedByKeyId != null">unlocked_by_key_id,</if>
- <if test="lockTime != null">lock_time,</if>
- <if test="unlockTime != null">unlock_time,</if>
- <if test="prePointId != null">pre_point_id,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="ticketId != null">#{ticketId},</if>
- <if test="workshopId != null">#{workshopId},</if>
- <if test="workareaId != null">#{workareaId},</if>
- <if test="pointId != null">#{pointId},</if>
- <if test="pointStatus != null">#{pointStatus},</if>
- <if test="delFlag != null">#{delFlag},</if>
- <if test="createBy != null">#{createBy},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="updateBy != null">#{updateBy},</if>
- <if test="lockId != null">#{lockId},</if>
- <if test="lockedByKeyId != null">#{lockedByKeyId},</if>
- <if test="unlockedByKeyId != null">#{unlockedByKeyId},</if>
- <if test="lockTime != null">#{lockTime},</if>
- <if test="unlockTime != null">#{unlockTime},</if>
- <if test="prePointId != null">#{prePointId},</if>
- </trim>
- </insert>
- <update id="updateIsJobTicketPoints" parameterType="IsJobTicketPoints">
- update is_job_ticket_points
- <trim prefix="SET" suffixOverrides=",">
- <if test="ticketId != null">ticket_id = #{ticketId},</if>
- <if test="workshopId != null">workshop_id = #{workshopId},</if>
- <if test="workareaId != null">workarea_id = #{workareaId},</if>
- <if test="pointId != null">point_id = #{pointId},</if>
- <if test="pointStatus != null">point_status = #{pointStatus},</if>
- <if test="delFlag != null">del_flag = #{delFlag},</if>
- <if test="createBy != null">create_by = #{createBy},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- <if test="lockId != null">lock_id = #{lockId},</if>
- <if test="lockedByKeyId != null">locked_by_key_id = #{lockedByKeyId},</if>
- <if test="unlockedByKeyId != null">unlocked_by_key_id = #{unlockedByKeyId},</if>
- <if test="lockTime != null">lock_time = #{lockTime},</if>
- <if test="unlockTime != null">unlock_time = #{unlockTime},</if>
- <if test="prePointId != null">pre_point_id = #{prePointId},</if>
- </trim>
- where record_id = #{recordId}
- </update>
- <delete id="deleteIsJobTicketPointsByRecordId" parameterType="Long">
- delete from is_job_ticket_points where record_id = #{recordId}
- </delete>
- <delete id="deleteIsJobTicketPointsByRecordIds" parameterType="String">
- delete from is_job_ticket_points where record_id in
- <foreach item="recordId" collection="array" open="(" separator="," close=")">
- #{recordId}
- </foreach>
- </delete>
- <select id="getListByTicketId" resultType="com.ktg.iscs.domain.vo.ticketPoints.IsJobTicketPointsVO">
- SELECT
- j.*,
- i.point_name,
- r.rfid as point_nfc,
- i.point_serial_number,
- l.lock_name,
- l.lock_nfc,
- i.remark as effect,
- s.loto_id,
- s.loto_serial_number
- FROM
- is_job_ticket_points j
- LEFT JOIN is_isolation_point i ON j.point_id = i.point_id
- left join is_rfid_token r on r.rfid_id = i.rfid_id
- LEFT JOIN is_lock l ON j.lock_id = l.lock_id
- LEFT JOIN is_loto_station s ON s.loto_id = i.loto_id
- WHERE
- j.ticket_id = #{ticketId}
- ORDER BY
- j.record_id ASC
- </select>
- <select id="getFinishConflictJob" resultType="com.ktg.iscs.domain.IsJobTicketPoints">
- SELECT
- p.*
- FROM
- is_job_ticket_points p
- LEFT JOIN is_job_ticket t ON t.ticket_id = p.ticket_id
- WHERE
- t.ticket_status = '5'
- AND p.point_status = '1'
- AND p.unlocked_by_key_id IS NULL
- AND p.point_id = #{pointId}
- AND p.lock_id = #{lockId}
- </select>
- <select id="getNotFinishConflictJob" resultType="com.ktg.iscs.domain.IsJobTicketPoints">
- SELECT
- p.*
- FROM
- is_job_ticket_points p
- LEFT JOIN is_job_ticket t ON t.ticket_id = p.ticket_id
- LEFT JOIN is_job_ticket_key k ON k.ticket_id = p.ticket_id and k.ticket_type = '1'
- WHERE
- t.ticket_status < 5
- AND p.point_status = '1'
- AND p.unlocked_by_key_id IS NULL
- AND p.point_id = #{pointId}
- AND p.lock_id = #{lockId}
- AND k.collect_time IS NOT NULL
- </select>
- <select id="getLockingData" resultType="com.ktg.iscs.domain.IsJobTicketPoints">
- SELECT
- p.*
- FROM
- is_job_ticket_points p
- LEFT JOIN is_job_ticket t ON t.ticket_id = p.ticket_id
- LEFT JOIN is_job_ticket_key k ON k.ticket_id = p.ticket_id and k.ticket_type = '1'
- WHERE
- t.ticket_status < 5
- AND p.point_status = '1'
- AND p.unlocked_by_key_id IS NULL
- AND p.point_id = #{pointId}
- AND k.collect_time IS NULL
- order by p.ticket_id asc
- offset 0 rows fetch next 1 rows only
- </select>
- <select id="getVirtualLockConflictPoint" resultType="com.ktg.iscs.domain.IsJobTicketPoints">
- SELECT
- p.*
- FROM
- is_job_ticket_points p
- LEFT JOIN is_job_ticket t ON t.ticket_id = p.ticket_id
- LEFT JOIN is_job_ticket_key k ON k.ticket_id = p.ticket_id and k.ticket_type = '1'
- WHERE
- t.ticket_status < 5
- AND p.point_status = '1'
- AND p.unlocked_by_key_id IS NULL
- AND p.point_id = #{pointId}
- AND p.lock_id = #{lockId}
- AND p.ticket_id != #{ticketId}
- AND k.collect_time IS NULL
- </select>
- </mapper>
|