<select id="getSubDeptIds" resultType="java.lang.Integer">
select DISTINCT id from sys_dept
where 1 = 0 or
<foreach collection="deptIds" index="index" item="i" separator="OR">
pid like CONCAT('%[',#{i},']%')
</foreach>
or
<foreach collection="deptIds" index="index" item="i" separator="OR">
id = #{i}
</foreach>
</select>
<select id="queryExport" resultType="HashMap" parameterType="student">
select a.telephoneNumber,a.email,a.idNumber,a.userName,a.name,case when a.sex = 1 then '男' else '女' end sex,a.birthDay,b.provinceName,
c.cityName,d.areaName,a.studentNumber,e.acdemyName,f.specialtyName,a.grade,h.className from t_student a
left join t_province b on a.provinceId = b.provinceId
left join t_city c on a.cityId = c.cityId
left join t_area d on a.areaId = d.areaId
left join t_acdemy e on a.acdemyId = e.acdemyId
left join t_specialty f on a.specialtyId = f.specialtyId
left join t_trainingplan g on a.planId = g.planId
left join t_class h on a.classId = h.classId
where 1 = 1
<if test="schoolId != null">
and a.schoolId = #{schoolId}
</if>
<if test="idNumber != null" >
and a.idNumber like concat('%',#{idNumber},'%')
</if>
<if test="name != null" >
and a.name like concat('%',#{email},'%')
</if>
<if test="status != null" >
and a.status = #{status,jdbcType=INTEGER}
</if>
<if test="acdemyId != null" >
and a.acdemyId = #{acdemyId,jdbcType=BIGINT}
</if>
<if test="specialtyId != null" >
and a.specialtyId = #{specialtyId,jdbcType=BIGINT}
</if>
<if test="grade != null" >
and a.grade = #{grade,jdbcType=VARCHAR}
</if>
<if test="className != null" >
and b.className like concat('%',#{className},'%')
</if>
order by a.grade desc,a.studentNumber asc
</select>
select <include refid="Base_Column_List" />
FROM t_gslm order by CONVERT(name USING gbk);