刘光辉
3 小时以前 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
package jnpf.dmsMapper;
 
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import jnpf.dmsEntity.watermark.DmsWatermarkConfigEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.UUID;
 
@Mapper
public interface DmsWatermarkConfigMapper extends BaseMapper<DmsWatermarkConfigEntity> {
    @Select("SELECT uuidv7()")
    UUID nextId();
 
    @Select("SELECT business_type_code FROM dms_watermark_business_types WHERE tenant_id = #{tenantId} AND config_id = #{configId} ORDER BY business_type_code")
    List<String> selectBusinessTypes(@Param("tenantId") String tenantId, @Param("configId") UUID configId);
 
    @Insert("INSERT INTO dms_watermark_business_types (tenant_id, config_id, business_type_code) VALUES (#{tenantId}, #{configId}, #{code})")
    int insertBusinessType(@Param("tenantId") String tenantId, @Param("configId") UUID configId, @Param("code") String code);
 
    @Delete("DELETE FROM dms_watermark_business_types WHERE tenant_id = #{tenantId} AND config_id = #{configId}")
    int deleteBusinessTypes(@Param("tenantId") String tenantId, @Param("configId") UUID configId);
 
    @Select({"<script>",
            "SELECT DISTINCT config_id FROM dms_watermark_business_types",
            "WHERE tenant_id = #{tenantId}",
            "AND config_id IN <foreach collection='configIds' item='id' open='(' separator=',' close=')'>#{id}</foreach>",
            "AND business_type_code IN <foreach collection='codes' item='code' open='(' separator=',' close=')'>#{code}</foreach>",
            "</script>"})
    List<UUID> selectMatchingConfigIds(@Param("tenantId") String tenantId,
            @Param("configIds") List<UUID> configIds, @Param("codes") List<String> codes);
}