c端用户

This commit is contained in:
wangxiaopeng
2024-03-20 20:47:11 +08:00
parent b07be9cde8
commit cab0b90e38
8 changed files with 255 additions and 12 deletions

View File

@@ -0,0 +1,37 @@
package com.cool.store.dao;
import com.cool.store.entity.HyPartnerUserChannelDO;
import com.cool.store.mapper.HyPartnerUserChannelMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Author suzhuhong
* @Date 2023/8/21 11:38
* @Version 1.0
*/
@Repository
public class HyPartnerUserChannelDAO {
@Resource
HyPartnerUserChannelMapper hyPartnerUserChannelMapper;
public Map<Integer, String> getChannelMapByIds(List<Integer> userChannelIds){
if (CollectionUtils.isEmpty(userChannelIds)){
return new HashMap<>(1);
}
List<HyPartnerUserChannelDO> userChannelList = hyPartnerUserChannelMapper.getUserChannelByIds(userChannelIds);
Map<Integer, String> channelMap = userChannelList.stream().filter(date->date.getChannelId()!=null).collect(Collectors.toMap(x->x.getChannelId().intValue(), HyPartnerUserChannelDO::getChannelName));
return channelMap;
}
}

View File

@@ -0,0 +1,34 @@
package com.cool.store.mapper;
import com.cool.store.entity.HyPartnerUserChannelDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface HyPartnerUserChannelMapper {
int deleteByPrimaryKey(Long id);
int insert(HyPartnerUserChannelDO record);
int insertSelective(HyPartnerUserChannelDO record);
HyPartnerUserChannelDO selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(HyPartnerUserChannelDO record);
int updateByPrimaryKey(HyPartnerUserChannelDO record);
HyPartnerUserChannelDO selectByChannelId(@Param("channelId") Long id);
HyPartnerUserChannelDO selectByChannelName(@Param("channelName") String channelName);
List<HyPartnerUserChannelDO> getAllUserChannel();
List<HyPartnerUserChannelDO> getUserChannelByIds(List<Integer> userChannelIds);
HyPartnerUserChannelDO selectByChannel(@Param("channelId") Long channelId,@Param("channelName") String channelName);
}

View File

@@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cool.store.mapper.HyPartnerUserChannelMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.HyPartnerUserChannelDO">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="channel_id" jdbcType="BIGINT" property="channelId" />
<result column="channel_name" jdbcType="VARCHAR" property="channelName" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
id, channel_id, channel_name, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from xfsg_partner_user_channel
where id = #{id,jdbcType=BIGINT}
</select>
<select id="selectByChannelId" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from xfsg_partner_user_channel
where channel_id = #{channelId} limit 1
</select>
<select id="selectByChannelName" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from xfsg_partner_user_channel
where channel_name = #{channelName} limit 1
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from xfsg_partner_user_channel
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.cool.store.entity.HyPartnerUserChannelDO" useGeneratedKeys="true">
insert into xfsg_partner_user_channel (channel_id, channel_name, create_time,
update_time)
values (#{channelId,jdbcType=BIGINT}, #{channelName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.cool.store.entity.HyPartnerUserChannelDO" useGeneratedKeys="true">
insert into xfsg_partner_user_channel
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="channelId != null">
channel_id,
</if>
<if test="channelName != null">
channel_name,
</if>
<if test="createTime != null">
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="channelId != null">
#{channelId,jdbcType=BIGINT},
</if>
<if test="channelName != null">
#{channelName,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.cool.store.entity.HyPartnerUserChannelDO">
update xfsg_partner_user_channel
<set>
<if test="channelId != null">
channel_id = #{channelId,jdbcType=BIGINT},
</if>
<if test="channelName != null">
channel_name = #{channelName,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.cool.store.entity.HyPartnerUserChannelDO">
update xfsg_partner_user_channel
set channel_id = #{channelId,jdbcType=BIGINT},
channel_name = #{channelName,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
<select id="getAllUserChannel" resultMap="BaseResultMap">
select * from xfsg_partner_user_channel
</select>
<select id="getUserChannelByIds" resultMap="BaseResultMap">
select * from xfsg_partner_user_channel
<where>
<if test="userChannelIds!=null and userChannelIds.size>0">
<foreach collection="userChannelIds" item="userChannelId" open="channel_id in (" close=")" separator=",">
#{userChannelId}
</foreach>
</if>
</where>
</select>
<select id="selectByChannel" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from xfsg_partner_user_channel
where channel_id = #{channelId} and channel_name=#{channelName} limit 1
</select>
</mapper>

View File

@@ -31,28 +31,28 @@
<select id="selectByPartnerId" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List"></include>
from hy_partner_user_info
from xfsg_partner_user_info
where partner_id = #{partnerId}
</select>
<select id="selectByMobile" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List"></include>
from hy_partner_user_info
from xfsg_partner_user_info
where mobile = #{mobile}
</select>
<select id="selectByOpenid" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List"></include>
from hy_partner_user_info
from xfsg_partner_user_info
where openid = #{openid}
</select>
<select id="selectByPartnerIds" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List"></include>
from hy_partner_user_info
from xfsg_partner_user_info
<where>
<if test="partnerIdList!=null and partnerIdList.size>0">
<foreach collection="partnerIdList" open="and partner_id in (" close=")" separator="," item="partnerId">
@@ -67,7 +67,7 @@
count(*)
FROM
hy_partner_line_info a
LEFT JOIN hy_partner_user_info b ON a.partner_id = b.partner_id
LEFT JOIN xfsg_partner_user_info b ON a.partner_id = b.partner_id
AND a.deleted = 0
LEFT JOIN hy_partner_user_channel c ON b.user_channel_id = c.channel_id
LEFT JOIN enterprise_user d ON a.investment_manager = d.user_id
@@ -88,11 +88,11 @@
a.update_time BETWEEN #{selectTime} and #{now} ) and b.partner_id is not null
</select>
<select id="selectLastCrmCreateTime" resultType="java.lang.String">
SELECT crm_create_time as crmCreateTime FROM hy_partner_user_info ORDER BY crm_create_time desc limit 1
SELECT crm_create_time as crmCreateTime FROM xfsg_partner_user_info ORDER BY crm_create_time desc limit 1
</select>
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
insert into hy_partner_user_info
insert into xfsg_partner_user_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="record.partnerId != null">
partner_id,
@@ -219,7 +219,7 @@
</trim>
</insert>
<update id="updateByPrimaryKeySelective">
update hy_partner_user_info
update xfsg_partner_user_info
<set>
<if test="record.partnerId != null">
partner_id = #{record.partnerId},
@@ -280,13 +280,13 @@
</update>
<update id="updateJoinKnowById">
update hy_partner_user_info
update xfsg_partner_user_info
set `is_write_partner_know`=#{isWritePartnerKnow,jdbcType=INTEGER}
where id=#{id,jdbcType=BIGINT}
</update>
<update id="updateByPartnerId">
update hy_partner_user_info
update xfsg_partner_user_info
<set>
<if test="record.mobile != null">
mobile = #{record.mobile},