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

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

import java.util.List;

/**
 * 状态流程定义
 *
 * <p>文件内容由代码生成器产生，请不要手动修改！ <br>
 * createdate:  2021-11-23 20:58:03  <br>
 * @author:  maven-cctp-plugin  <br>
 * @since:  1.0 <br>
 */
public interface SpDefProcessRepository extends BasicJpaRepository<SpDefProcess, String>
{
    @Query(value = "select * from sp_def_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<SpDefProcess> querySpDefProcess(@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 sp_def_process " +
            "where LOCATE(:name, name)>0 " +
            "and tenant_id = :tenantId " +
            "and is_deleted = :deleted ;", nativeQuery = true)
    Integer countSpDefProcess(@Param("name") String name, @Param("tenantId") String tenantId,
                              @Param("deleted") Boolean deleted);




}
