首先是:serviceImpl层:
if("本专业".equals(pageQueryParam.getParam().getCategorySelectedTags())) {
pageQueryParam.getParam().setType("1"); //将中文转换为数字给sql判断作用
}else{
pageQueryParam.getParam().setType("2"); //将中文转换为数字给sql判断作用
}
mapper.xml的sql:
<select id="list" parameterType="com.ly.education.choose.course.front.api.dto.HotCourseDto" resultMap="HotCourseVoMap">
select *
from (select *
from v_t_jw_pkgl_pkjg pkjg
--根据年级专业方向判断该学生是否在该修读对象下
WHERE 1=1
<if test='dto.type == "1"'> -- 这里需要使用的是双字符串将1引起来,不然从服务层传进来的值是“1”这种格式的。
and EXISTS (select 1 from jw_pkgl.t_jw_pkgl_jxbxddx dx
where dx.jxb_id = pkjg.jxb_id
and (dx.xq_id is null or dx.xq_id = #{stuDto.campusId,
jdbcType=VARCHAR})
and (dx.xyh is null or dx.xyh = #{stuDto.collegeNum, jdbcType=VARCHAR})
and (dx.nj is null or dx.nj = #{stuDto.grade, jdbcType=VARCHAR})
and (dx.pylbm is null or
<if
test="stuDto.cultureCateCodeList != null and stuDto.cultureCateCodeList.size !=0">
dx.pylbm in
<foreach collection="stuDto.cultureCateCodeList" open="("
item="code" separator="," close=")">#{code}</foreach>
</if>
</select>
                
            
        
浙公网安备 33010602011771号