OA项目
mybatis参考
<select id="queryList" parameterType="map"
resultType="com.zhensheng.entity.BusAfficheEntityQuery">
<!-- 查询该用户的接收公告id -->
select
<include refid="afficheField" />
,person.is_readed AS isRead,dict.label AS modelName
from bus_affiche AS
affiche LEFT JOIN bus_affiche_person AS person
on affiche.id =
person.affiche_id AND person.person_id = #{userId}
JOIN
sys_dict AS dict
on dict.id = affiche.affiche_type
where
affiche.id in
(
select distinct
receive.missive_id
from
bus_affiche_receive AS receive
<where>
<!-- 用户id -->
receive.condition_value =
<if test="userId != null and userId != ''">
#{userId}
</if>
<!-- 部门id -->
or receive.condition_value in
<if test="orgId != null and orgId != ''">
<foreach collection="orgId" item="oId" open="(" separator=","
close=")">
#{oId}
</foreach>