|
@@ -91,4 +91,97 @@
|
|
|
</if>
|
|
|
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="getXPage" resultType="com.dayou.vo.ItemVO">
|
|
|
+ SELECT
|
|
|
+ <include refid="Base_Column_List"/> , d.name as departmentName,
|
|
|
+ (select name from item_stage s where curDate() >= s.start_date and curDate() <= s.end_date and s.item_id = i.id) as stageName,
|
|
|
+ (select id from item_stage s where curDate() >= s.start_date and curDate() <= s.end_date and s.item_id and s.item_id = i.id) as stageId
|
|
|
+ FROM
|
|
|
+ item i left join department d on i.department_id = d.id
|
|
|
+ WHERE
|
|
|
+ i.deleted = 0
|
|
|
+ <if test="item!=null and item.name!=null and item.name!='' ">
|
|
|
+ and i.name like concat ('%',#{item.name},'%')
|
|
|
+ </if>
|
|
|
+ <if test="item!=null and item.businessNo!=null and item.businessNo!='' ">
|
|
|
+ and i.business_no like concat (#{item.businessNo},'%')
|
|
|
+ </if>
|
|
|
+ <if test="item!=null and item.clientManager!=null and item.clientManager!='' ">
|
|
|
+ and i.client_manager like concat ('%',#{item.clientManager},'%')
|
|
|
+ </if>
|
|
|
+ <if test="item!=null and item.userIds!=null and item.userIds.size!=0 and item!=null and item.departmentIds!=null and item.departmentIds.size==0">
|
|
|
+ <if test="item!=null and item.userIds!=null and item.userIds.size!=0">
|
|
|
+ and EXISTS ( SELECT item_id FROM item_user iu WHERE iu.item_id = i.id AND iu.user_id in
|
|
|
+ <foreach collection="item.userIds" open="(" close=")" separator="," item="userId">
|
|
|
+ #{userId}
|
|
|
+ </foreach>
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="item!=null and item.userIds!=null and item.userIds.size==0 and item!=null and item.departmentIds!=null and item.departmentIds.size!=0">
|
|
|
+ <if test="item!=null and item.departmentIds!=null and item.departmentIds.size!=0">
|
|
|
+ and i.department_id in
|
|
|
+ <foreach collection="item.departmentIds" open="(" close=")" separator="," item="departmentId">
|
|
|
+ #{departmentId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="item!=null and item.userIds!=null and item.userIds.size!=0 and item!=null and item.departmentIds!=null and item.departmentIds.size!=0">
|
|
|
+ and (
|
|
|
+ <if test="item!=null and item.userIds!=null and item.userIds.size!=0">
|
|
|
+ EXISTS ( SELECT item_id FROM item_user iu WHERE iu.item_id = i.id AND iu.user_id in
|
|
|
+ <foreach collection="item.userIds" open="(" close=")" separator="," item="userId">
|
|
|
+ #{userId}
|
|
|
+ </foreach>
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="item!=null and item.departmentIds!=null and item.departmentIds.size!=0">
|
|
|
+ or i.department_id in
|
|
|
+ <foreach collection="item.departmentIds" open="(" close=")" separator="," item="departmentId">
|
|
|
+ #{departmentId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="xSelectList" parameterType="com.dayou.vo.ItemStageVO" resultType="com.dayou.entity.Item">
|
|
|
+ select <include refid="Base_Column_List"/> from item i
|
|
|
+ where i.deleted = 0
|
|
|
+ <if test="item!=null and item.userIds!=null and item.userIds.size!=0 and item!=null and item.departmentIds!=null and item.departmentIds.size==0">
|
|
|
+ <if test="item!=null and item.userIds!=null and item.userIds.size!=0">
|
|
|
+ and EXISTS ( SELECT item_id FROM item_user iu WHERE iu.item_id = i.id AND iu.user_id in
|
|
|
+ <foreach collection="item.userIds" open="(" close=")" separator="," item="userId">
|
|
|
+ #{userId}
|
|
|
+ </foreach>
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="item!=null and item.userIds!=null and item.userIds.size==0 and item!=null and item.departmentIds!=null and item.departmentIds.size!=0">
|
|
|
+ <if test="item!=null and item.departmentIds!=null and item.departmentIds.size!=0">
|
|
|
+ and i.department_id in
|
|
|
+ <foreach collection="item.departmentIds" open="(" close=")" separator="," item="departmentId">
|
|
|
+ #{departmentId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="item!=null and item.userIds!=null and item.userIds.size!=0 and item!=null and item.departmentIds!=null and item.departmentIds.size!=0">
|
|
|
+ and (
|
|
|
+ <if test="item!=null and item.userIds!=null and item.userIds.size!=0">
|
|
|
+ EXISTS ( SELECT item_id FROM item_user iu WHERE iu.item_id = i.id AND iu.user_id in
|
|
|
+ <foreach collection="item.userIds" open="(" close=")" separator="," item="userId">
|
|
|
+ #{userId}
|
|
|
+ </foreach>
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="item!=null and item.departmentIds!=null and item.departmentIds.size!=0">
|
|
|
+ or i.department_id in
|
|
|
+ <foreach collection="item.departmentIds" open="(" close=")" separator="," item="departmentId">
|
|
|
+ #{departmentId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
</mapper>
|