mybatis 注解 if

时间:2024-11-15 16:57:51

package ;

import ;

import ;
import ;
import ;

import ;

import ;

@Mapper
public interface DemandCommentMapper extends BaseMapper{

@Select("<script>"
        + "SELECT "
        + " as 'id',a.create_date as 'createDate', as 'content',"
        + "a.parent_id as 'parentId',a.first_comment_id as 'firstCommentId',"
        + " as '', as '', as '',"
        + " as '', as '', as '' "
        + "FROM t_demand_comment a "
        + "LEFT JOIN t_user b ON  = a.from_uid "
        + "LEFT JOIN t_user c ON  = a.to_uid "
        + "WHERE a.demand_id = #{demandId} "
        + "ORDER BY a.create_date ASC "
        + "<if test='startNo!=null and pageSize != null '>"
        + "LIMIT #{startNo},#{pageSize}"
        + "</if>"
        + "</script>")
public List<DemandComment> listDemandComment(@Param("demandId") Long demandId, @Param("startNo") Integer pageNo, @Param("pageSize") Integer pageSize);

}

mybatis 注解 if