com.cory.dao.RoleDao Maven / Gradle / Ivy
package com.cory.dao;
import com.cory.db.annotations.Dao;
import com.cory.db.annotations.Param;
import com.cory.db.annotations.Select;
import com.cory.model.Role;
import java.util.List;
/**
* generated by CodeGenerator on 2017/5/10.
*/
@Dao(model = Role.class)
public interface RoleDao extends BaseDao {
@Select(whereSql = "name = #{name}")
Role getByName(@Param("name") String name);
@Select(customSql = "SELECT r.* FROM BASE_ROLE r WHERE r.IS_DELETED = 0 AND EXISTS(SELECT 1 FROM BASE_USER_ROLE_REL rel WHERE rel.IS_DELETED = 0 AND r.ID = rel.ROLE_ID AND rel.USER_ID = #{userId})")
List getByUser(@Param("userId") Integer userId);
}