/*
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
*
*/
package net.northking.cctp.flowable.db.jpa;

import net.northking.cctp.common.jpa.BasicJpaRepository;
import net.northking.cctp.flowable.db.entity.IpProcess;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * 实施流程定义
 *
 * <p>文件内容由代码生成器产生，请不要手动修改！ <br>
 * createdate:  2022-01-06 11:54:15  <br>
 * @author:  maven-cctp-plugin  <br>
 * @since:  1.0 <br>
 */
public interface IpProcessRepository extends BasicJpaRepository<IpProcess, String>
{

    @Query(value = "select * from ip_process " +
            "where tenant_id = :tenantId " +
            "and is_deleted = :deleted " +
            "and LOCATE(:name, name)>0 " +
            "order by created_time desc " +
            "limit :pageNo, :pageSize ;", nativeQuery = true)
    List<IpProcess> queryProcess(@Param("name") String name, @Param("tenantId") String tenantId,
                                         @Param("deleted") Boolean deleted,
                                         @Param("pageNo") Integer pageNo, @Param("pageSize") Integer pageSize);

    @Query(value = "select count(*) from ip_process " +
            "where LOCATE(:name, name)>0 " +
            "and tenant_id = :tenantId " +
            "and is_deleted = :deleted ;", nativeQuery = true)
    Integer countProcess(@Param("name") String name, @Param("tenantId") String tenantId,
                              @Param("deleted") Boolean deleted);

}
