刘光辉
4 小时以前 06f314545ac3514d7ce28939920866ae8188d31c
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
55
56
57
package jnpf.elnMapper;
 
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import jnpf.elnEntity.runtime.ElnSharedFillOperationEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
 
@Mapper
public interface ElnSharedFillOperationMapper
        extends BaseMapper<ElnSharedFillOperationEntity> {
 
    @Insert("INSERT INTO eln_shared_fill_operation "
            + "(operation_code, request_digest, operation_status, operator_user_id, "
            + "f_id, f_tenant_id, f_version, f_creator_user_id, f_creator_time, "
            + "f_delete_mark) VALUES "
            + "(#{value.operationCode}, #{value.requestDigest}, 'OPEN', "
            + "#{value.operatorUserId}, #{value.id}, #{value.fTenantId}, 0, "
            + "#{value.operatorUserId}, CURRENT_TIMESTAMP, 0) "
            + "ON CONFLICT (f_tenant_id, operation_code) DO NOTHING")
    int insertIgnore(@Param("value") ElnSharedFillOperationEntity value);
 
    @Update("UPDATE eln_shared_fill_operation SET operation_status = 'COMPLETED', "
            + "result_json = #{resultJson}, f_version = f_version + 1, "
            + "f_last_modify_user_id = #{userId}, f_last_modify_time = CURRENT_TIMESTAMP "
            + "WHERE f_tenant_id = #{tenantId} AND operation_code = #{operationCode} "
            + "AND request_digest = #{requestDigest} AND operation_status = 'OPEN' "
            + "AND COALESCE(f_delete_mark, 0) = 0")
    int complete(@Param("tenantId") String tenantId,
                 @Param("operationCode") String operationCode,
                 @Param("requestDigest") String requestDigest,
                 @Param("resultJson") String resultJson,
                 @Param("userId") String userId);
 
    @Update("UPDATE eln_shared_fill_operation SET result_json = #{resultJson}, "
            + "f_version = f_version + 1, f_last_modify_user_id = #{userId}, "
            + "f_last_modify_time = CURRENT_TIMESTAMP "
            + "WHERE f_tenant_id = #{tenantId} AND operation_code = #{operationCode} "
            + "AND request_digest = #{requestDigest} AND operation_status = 'OPEN' "
            + "AND result_json IS NULL AND COALESCE(f_delete_mark, 0) = 0")
    int prepareResult(@Param("tenantId") String tenantId,
                      @Param("operationCode") String operationCode,
                      @Param("requestDigest") String requestDigest,
                      @Param("resultJson") String resultJson,
                      @Param("userId") String userId);
 
    @Update("UPDATE eln_shared_fill_operation SET operation_status = 'COMPLETED', "
            + "f_version = f_version + 1, f_last_modify_user_id = #{userId}, "
            + "f_last_modify_time = CURRENT_TIMESTAMP "
            + "WHERE f_tenant_id = #{tenantId} AND operation_code = #{operationCode} "
            + "AND operator_user_id = #{userId} AND operation_status = 'OPEN' "
            + "AND result_json IS NOT NULL AND COALESCE(f_delete_mark, 0) = 0")
    int confirmPrepared(@Param("tenantId") String tenantId,
                        @Param("operationCode") String operationCode,
                        @Param("userId") String userId);
}