| | |
| | | |
| | | @Query(value = "SELECT * from new_user_insurance WHERE user_id = ?1 AND `year_month` = ?2 ORDER BY create_time DESC LIMIT 1",nativeQuery = true) |
| | | UserInsurance findbyUserIdAndDate(Long userId, String yearMonth); |
| | | |
| | | @Query(value = "SELECT * FROM `new_user_insurance` WHERE user_id in (SELECT user_id FROM sys_user WHERE company_id = ?1 AND enabled is true)",nativeQuery = true) |
| | | List<UserInsurance> findbyCompanyId(Long companyId); |
| | | |
| | | // /** |
| | | // * 查询第二条 |
| | | // * @param companyId |
| | | // * @return |
| | | // */ |
| | | // @Query(value = "SELECT * FROM (\n" + |
| | | // " SELECT *,\n" + |
| | | // " ROW_NUMBER() OVER(PARTITION BY user_id ORDER BY id) as row_num\n" + |
| | | // " FROM new_user_insurance\n" + |
| | | // " WHERE user_id IN (\n" + |
| | | // " SELECT user_id \n" + |
| | | // " FROM sys_user \n" + |
| | | // " WHERE company_id = ?1 AND enabled is true\n" + |
| | | // " )\n" + |
| | | // ") t\n" + |
| | | // "WHERE t.row_num = 2",nativeQuery = true) |
| | | // List<UserInsurance> findbyCompanyId(Long companyId); |
| | | |
| | | // @Query(value = "SELECT * from new_user_insurance WHERE user_id = ?1 ORDER BY 'year_month' DESC LIMIT 1",nativeQuery = true) |
| | | // UserInsurance findByUserId(Long userId); |
| | | } |