SELECT
a.experience_name AS "experienceName"
,b.experience_type_name as "experienceTypeName"
,c.user_name as "userName"
,d.dept_name as "deptName"
FROM
experience a
left join experience_type b
on a.experience_type_id = b.experience_type_id
left join user c
on a.user_id = c.user_id
left join dept d
on c.dept_id = d.dept_id
<where>
1=1
<if test='experienceName != null and experienceName != ""'>
AND a.experience_name = #{experienceName,jdbcType=VARCHAR}
</if>
<if test='experienceTypeName != null and experienceTypeName != ""'>
AND b.experience_type_name = #{experienceTypeName,jdbcType=VARCHAR}
</if>
<if test='userName != null and userName != ""'>
AND c.user_name = #{userName,jdbcType=VARCHAR}
</if>
<if test='deptName != null and deptName != ""'>
AND d.dept_name = #{deptName,jdbcType=VARCHAR}
</if>
</where>
left join 多表连接查询
最新推荐文章于 2024-07-12 15:29:24 发布