|
|
@@ -33,36 +33,58 @@
|
|
|
<select id="findList" parameterType="com.sckw.manage.model.dto.req.CooperateManageQueryReqDto"
|
|
|
resultType="com.sckw.manage.model.dto.res.CooperateManageQueryResDto">
|
|
|
SELECT a.id,
|
|
|
- b.status,
|
|
|
- group_concat(b.type) types,
|
|
|
- min(a.ent_id) entId,
|
|
|
- min(a.invitee_ent_id) inviteeEntId,
|
|
|
- min(a.inviter_ent_id) inviterEntId,
|
|
|
- min(a.invitee_contacts) inviteeContacts,
|
|
|
- min(a.inviter_contacts) inviterContacts,
|
|
|
- min(a.invitee_contacts_id) inviteeContactsId,
|
|
|
- min(a.inviter_contacts_id) inviterContactsId,
|
|
|
- min(a.invitee_phone) inviteePhone,
|
|
|
- min(a.inviter_phone) inviterPhone,
|
|
|
- min(b.create_time) createTime,
|
|
|
- min(b.create_by) createBy,
|
|
|
- min(a.remark) remark,
|
|
|
- min(a.approval_remark) approvalRemark,
|
|
|
- case when min(a.ent_id) = #{reqDto.currentEntId} then min(a.invitee_ent_id) else min(a.inviter_ent_id) end targetEntId,
|
|
|
- case when min(a.ent_id) = #{reqDto.currentEntId} then min(a.inviter_ent_id) else min(a.invitee_ent_id) end ourEntId,
|
|
|
- case when min(a.ent_id) = #{reqDto.currentEntId} then 1 else 2 end applyTypeCode
|
|
|
- FROM kwm_cooperate a
|
|
|
- LEFT JOIN kwm_cooperate_type b ON a.id = b.cooperate_id
|
|
|
- WHERE a.del_flag = 0
|
|
|
- and (a.invitee_ent_id in
|
|
|
+ b.status,
|
|
|
+ group_concat(b.type) types,
|
|
|
+ min(a.ent_id) entId,
|
|
|
+ min(a.invitee_ent_id) inviteeEntId,
|
|
|
+ min(a.inviter_ent_id) inviterEntId,
|
|
|
+ min(a.invitee_contacts) inviteeContacts,
|
|
|
+ min(a.inviter_contacts) inviterContacts,
|
|
|
+ min(a.invitee_contacts_id) inviteeContactsId,
|
|
|
+ min(a.inviter_contacts_id) inviterContactsId,
|
|
|
+ min(a.invitee_phone) inviteePhone,
|
|
|
+ min(a.inviter_phone) inviterPhone,
|
|
|
+ min(b.create_time) createTime,
|
|
|
+ min(b.create_by) createBy,
|
|
|
+ min(a.remark) remark,
|
|
|
+ min(a.approval_remark) approvalRemark,
|
|
|
+ case when min(a.ent_id) = #{reqDto.currentEntId} then min(a.invitee_ent_id) else min(a.inviter_ent_id) end
|
|
|
+ targetEntId,
|
|
|
+ case when min(a.ent_id) = #{reqDto.currentEntId} then min(a.inviter_ent_id) else min(a.invitee_ent_id) end
|
|
|
+ ourEntId,
|
|
|
+ case when min(a.ent_id) = #{reqDto.currentEntId} then 1 else 2 end applyTypeCode
|
|
|
+ FROM kwm_cooperate a
|
|
|
+ LEFT JOIN kwm_cooperate_type b ON a.id = b.cooperate_id
|
|
|
+ WHERE a.del_flag = 0
|
|
|
+ and ((a.invitee_ent_id in
|
|
|
<foreach collection="reqDto.currentEntIdList" item="item" open="(" close=")" separator=",">
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
- OR a.inviter_ent_id in
|
|
|
+
|
|
|
+ <if test="reqDto.targetEntIdList != null and reqDto.targetEntIdList.size() > 0">
|
|
|
+ and (a.inviter_ent_id in
|
|
|
+ <foreach collection="reqDto.targetEntIdList" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ or a.inviter_contacts like concat('%', #{reqDto.keywords}, '%') or
|
|
|
+ a.inviter_phone like concat('%', #{reqDto.keywords}, '%')
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ ) OR
|
|
|
+ (a.inviter_ent_id in
|
|
|
<foreach collection="reqDto.currentEntIdList" item="item" open="(" close=")" separator=",">
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
- )
|
|
|
+ <if test="reqDto.targetEntIdList != null and reqDto.targetEntIdList.size() > 0">
|
|
|
+ and (a.invitee_ent_id in
|
|
|
+ <foreach collection="reqDto.targetEntIdList" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ or a.invitee_contacts like concat('%', #{reqDto.keywords}, '%') or
|
|
|
+ a.invitee_phone like concat('%', #{reqDto.keywords}, '%')
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ ))
|
|
|
<if test="reqDto.startTime != null">
|
|
|
and b.create_time >= #{reqDto.startTime}
|
|
|
</if>
|
|
|
@@ -93,6 +115,13 @@
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
+ <if test="reqDto.keywords != null and reqDto.keywords != ''">
|
|
|
+ and (a.invitee_contacts like concat('%', #{reqDto.keywords}, '%') or
|
|
|
+ a.inviter_contacts like concat('%', #{reqDto.keywords}, '%') or
|
|
|
+ a.invitee_phone like concat('%', #{reqDto.keywords}, '%') or
|
|
|
+ a.inviter_phone like concat('%', #{reqDto.keywords}, '%')
|
|
|
+ )
|
|
|
+ </if>
|
|
|
<if test="reqDto.ids != null and reqDto.ids.size() > 0">
|
|
|
and a.id in
|
|
|
<foreach collection="reqDto.ids" item="item" open="(" close=")" separator=",">
|
|
|
@@ -153,15 +182,34 @@
|
|
|
FROM kwm_cooperate a
|
|
|
LEFT JOIN kwm_cooperate_type b ON a.id = b.cooperate_id and b.status = 1 and b.del_flag = 0
|
|
|
WHERE a.del_flag = 0
|
|
|
- and (a.invitee_ent_id in
|
|
|
- <foreach collection="reqDto.currentEntIdList" item="item" open="(" close=")" separator=",">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- OR a.inviter_ent_id in
|
|
|
- <foreach collection="reqDto.currentEntIdList" item="item" open="(" close=")" separator=",">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
+ and ((a.invitee_ent_id in
|
|
|
+ <foreach collection="reqDto.currentEntIdList" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ <if test="reqDto.targetEntIdList != null and reqDto.targetEntIdList.size() > 0">
|
|
|
+ and (a.inviter_ent_id in
|
|
|
+ <foreach collection="reqDto.targetEntIdList" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ or a.inviter_contacts like concat('%', #{reqDto.keywords}, '%') or
|
|
|
+ a.inviter_phone like concat('%', #{reqDto.keywords}, '%')
|
|
|
+ )
|
|
|
+ </if>
|
|
|
)
|
|
|
+ OR (a.inviter_ent_id in
|
|
|
+ <foreach collection="reqDto.currentEntIdList" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ <if test="reqDto.targetEntIdList != null and reqDto.targetEntIdList.size() > 0">
|
|
|
+ and (a.invitee_ent_id in
|
|
|
+ <foreach collection="reqDto.targetEntIdList" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ or a.invitee_contacts like concat('%', #{reqDto.keywords}, '%') or
|
|
|
+ a.invitee_phone like concat('%', #{reqDto.keywords}, '%')
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ ))
|
|
|
<if test="reqDto.startTime != null">
|
|
|
and b.create_time >= #{reqDto.startTime}
|
|
|
</if>
|
|
|
@@ -192,6 +240,13 @@
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
+ <if test="reqDto.keywords != null">
|
|
|
+ and (a.invitee_contacts like concat('%', #{reqDto.keywords}, '%') or
|
|
|
+ a.inviter_contacts like concat('%', #{reqDto.keywords}, '%') or
|
|
|
+ a.invitee_phone like concat('%', #{reqDto.keywords}, '%') or
|
|
|
+ a.inviter_phone like concat('%', #{reqDto.keywords}, '%')
|
|
|
+ )
|
|
|
+ </if>
|
|
|
<if test="reqDto.ids != null and reqDto.ids.size() > 0">
|
|
|
and a.id in
|
|
|
<foreach collection="reqDto.ids" item="item" open="(" close=")" separator=",">
|