Commit 6660f2bb by 徐高华

加好友sql加wx企业id条件

parent 39f458ed
......@@ -8,18 +8,11 @@ import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated;
public interface TabHaobanClerkMainStoreRelatedMapper {
int deleteByPrimaryKey(String clerkMainStoreRelatedId);
int insert(TabHaobanClerkMainStoreRelated record);
int insertSelective(TabHaobanClerkMainStoreRelated record);
TabHaobanClerkMainStoreRelated selectByPrimaryKey(String clerkMainStoreRelatedId);
int updateByPrimaryKeySelective(TabHaobanClerkMainStoreRelated record);
int updateByPrimaryKey(TabHaobanClerkMainStoreRelated record);
TabHaobanClerkMainStoreRelated selectByWxEnterpriseIdAndStoreId(@Param("staffId")String staffId, @Param("wxEnterpriseId")String wxEnterpriseId , @Param("storeIdList") List<String> storeIdList);
List<TabHaobanClerkMainStoreRelated> listByWxEnterpriseId(@Param("wxEnterpriseId")String wxEnterpriseId);
......
......@@ -146,7 +146,7 @@ public interface TabHaobanStaffClerkRelationMapper {
List<MemberStaffRelExtDO> listMemberStaffRelNew(
@Param("memberIdList") List<String> memberIdList,
@Param("clerkIdList") List<String> clerkIdList,
@Param("enterpriseId") String enterpriseId);
@Param("enterpriseId") String enterpriseId,@Param("wxEnterpriseId") String wxEnterpriseId);
/**
* 根据导购查询wxuserid
......@@ -252,4 +252,7 @@ public interface TabHaobanStaffClerkRelationMapper {
*/
List<StaffClerkRelationDTO> listClerkIdConcatFlagByClerkIds(@Param("clerkIds") List<String> clerkIds,
@Param("wxEnterpriseId") String wxEnterpriseId);
void deleteByEnterpriseId(@Param("enterpriseId") String enterpriseId) ;
}
\ No newline at end of file
package com.gic.haoban.manage.service.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.common.utils.DingUtils;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper;
import com.gic.haoban.manage.service.dao.mapper.WxApplicationMapper;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper;
......@@ -13,13 +26,6 @@ import com.gic.haoban.manage.service.entity.TabHaobanWxApplication;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
public class WxEnterpriseServiceImpl implements WxEnterpriseService {
......@@ -31,6 +37,8 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
private WxEnterpriseRelatedMapper wxEnterpriseRelatedMapper ;
@Autowired
private WxApplicationMapper wxApplicationMapper ;
@Autowired
private TabHaobanStaffClerkRelationMapper tabHaobanStaffClerkRelationMapper ;
@Override
public String add(WxEnterpriseDTO wxDTO) {
......@@ -150,6 +158,7 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
wxEnterpriseIdList.add(wxEnterpriseId) ;
}
this.wxEnterpriseRelatedMapper.deleteByEnterpriseId(enterpriseId) ;
this.tabHaobanStaffClerkRelationMapper.deleteByEnterpriseId(enterpriseId);
Map<String,Object> enMap = new HashMap<>();
enMap.put("enterpriseId", enterpriseId + list.get(0).getEnterpriseName()) ;
alert("删除商户企微关联告警", enMap);
......
......@@ -366,7 +366,7 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
if (qwDTO == null) {
return Collections.emptyMap();
}
List<MemberStaffRelExtDO> res = staffClerkRelationMapper.listMemberStaffRelNew(memberIdList, clerkIdList, enterpriseId);
List<MemberStaffRelExtDO> res = staffClerkRelationMapper.listMemberStaffRelNew(memberIdList, clerkIdList, enterpriseId,wxEnterpriseId);
if (CollectionUtils.isEmpty(res)) {
return Collections.emptyMap();
}
......
......@@ -16,16 +16,8 @@
clerk_main_store_related_id, staff_id, wx_enterprise_id, store_id, main_store_flag, fresh_friend_flag,
status_flag, create_time, update_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_clerk_main_store_related
where clerk_main_store_related_id = #{clerkMainStoreRelatedId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
delete from tab_haoban_clerk_main_store_related
where clerk_main_store_related_id = #{clerkMainStoreRelatedId,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated" >
insert into tab_haoban_clerk_main_store_related (clerk_main_store_related_id, staff_id,
wx_enterprise_id, store_id, main_store_flag, fresh_friend_flag,
......@@ -37,67 +29,7 @@
#{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated" >
insert into tab_haoban_clerk_main_store_related
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="clerkMainStoreRelatedId != null" >
clerk_main_store_related_id,
</if>
<if test="staffId != null" >
staff_id,
</if>
<if test="wxEnterpriseId != null" >
wx_enterprise_id,
</if>
<if test="storeId != null" >
store_id,
</if>
<if test="mainStoreFlag != null" >
main_store_flag,
</if>
<if test="freshFriendFlag != null">
fresh_friend_flag,
</if>
<if test="statusFlag != null" >
status_flag,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="updateTime != null" >
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="clerkMainStoreRelatedId != null" >
#{clerkMainStoreRelatedId,jdbcType=VARCHAR},
</if>
<if test="staffId != null" >
#{staffId,jdbcType=VARCHAR},
</if>
<if test="wxEnterpriseId != null" >
#{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="storeId != null" >
#{storeId,jdbcType=VARCHAR},
</if>
<if test="mainStoreFlag != null" >
#{mainStoreFlag,jdbcType=INTEGER},
</if>
<if test="freshFriendFlag != null">
#{freshFriendFlag},
</if>
<if test="statusFlag != null" >
#{statusFlag,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated" >
update tab_haoban_clerk_main_store_related
<set >
......@@ -128,18 +60,7 @@
</set>
where clerk_main_store_related_id = #{clerkMainStoreRelatedId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated" >
update tab_haoban_clerk_main_store_related
set staff_id = #{staffId,jdbcType=VARCHAR},
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
store_id = #{storeId,jdbcType=VARCHAR},
main_store_flag = #{mainStoreFlag,jdbcType=INTEGER},
fresh_friend_flag = #{freshFriendFlag,jdbcType=INTEGER},
status_flag = #{statusFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where clerk_main_store_related_id = #{clerkMainStoreRelatedId,jdbcType=VARCHAR}
</update>
<select id="selectByWxEnterpriseIdAndStoreId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
......
......@@ -388,6 +388,7 @@
group by a.staff_id, a.clerk_id) as scr on scr.staff_id = ecr.staff_id
where ecr.status_flag = 1
and ecr.enterprise_id = #{enterpriseId,jdbcType=VARCHAR}
and ecr.wx_enterprise_id=#{wxEnterpriseId}
and ecr.member_id in
<foreach collection="memberIdList" item="item" separator="," open="(" close=")">
#{item}
......@@ -534,4 +535,9 @@
#{id,jdbcType=VARCHAR}
</foreach>
</select>
<update id="deleteByEnterpriseId">
update tab_haoban_staff_clerk_relation set status_flag = 0 , update_time=now() where enterprise_id = #{enterpriseId}
</update>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment