feat(appointments): track forecast impacts and handling history
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
||||
package com.baiyue.lastleg.appointmentplanning;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface AppointmentImpactMapper extends BaseMapper<AppointmentImpact> {
|
||||
@Select("<script>SELECT * FROM ll_appointment_impact WHERE container_booking_id IN <foreach collection='ids' item='id' open='(' separator=',' close=')'>#{id}</foreach></script>")
|
||||
List<AppointmentImpact> byContainers(@Param("ids") List<String> ids);
|
||||
@Select("SELECT COUNT(*) FROM ll_appointment_impact_history WHERE container_booking_id=#{id}")
|
||||
long historyCount(String id);
|
||||
@Select("SELECT * FROM ll_appointment_impact WHERE container_booking_id=#{id} FOR UPDATE")
|
||||
AppointmentImpact lock(String id);
|
||||
@Update("""
|
||||
UPDATE ll_appointment_impact SET baseline_json=#{baselineJson},latest_json=#{latestJson},forecast_token=#{forecastToken},
|
||||
status=#{status},reason=#{reason},owner_id=#{ownerId},owner_name=#{ownerName},version=#{version},updated_at=#{updatedAt}
|
||||
WHERE container_booking_id=#{containerBookingId}
|
||||
""")
|
||||
int save(AppointmentImpact row);
|
||||
@Select("SELECT * FROM ll_appointment_impact_history WHERE container_booking_id=#{id} AND operator_id=#{operator} AND command_key=#{key}")
|
||||
AppointmentImpactHistory command(@Param("id") String id,@Param("operator") String operator,@Param("key") String key);
|
||||
@Insert("""
|
||||
INSERT INTO ll_appointment_impact_history
|
||||
(id,container_booking_id,version,action,operator_id,operator_name,result,next_action,followup_date,command_key,request_hash,response_json,created_at)
|
||||
VALUES(#{id},#{containerBookingId},#{version},#{action},#{operatorId},#{operatorName},#{result},#{nextAction},#{followupDate},#{commandKey},#{requestHash},#{responseJson},#{createdAt})
|
||||
""")
|
||||
int history(AppointmentImpactHistory row);
|
||||
@Select("SELECT * FROM ll_appointment_impact_history WHERE container_booking_id=#{id} ORDER BY version DESC LIMIT #{size} OFFSET #{offset}")
|
||||
List<AppointmentImpactHistory> historyPage(@Param("id") String id,@Param("size") int size,@Param("offset") long offset);
|
||||
}
|
||||
Reference in New Issue
Block a user