zxl
2025-05-15 05d286d33b25ea7e317eae2861bb765ac11a927d
新增客户管理,客户标签(暂留)功能
2个文件已修改
23个文件已添加
1182 ■■■■■ 已修改文件
framework/src/main/java/cn/lili/modules/lmk/domain/entity/CustomerTag.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/domain/entity/CustomerTagRef.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/domain/form/CustomerTagForm.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/domain/form/CustomerTagRefForm.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/domain/query/CustomerQuery.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/domain/query/CustomerTagQuery.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/domain/vo/CustomerTagRefVO.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/domain/vo/CustomerTagVO.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/domain/vo/StoreVO.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/mapper/CustomerMapper.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/mapper/CustomerTagMapper.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/mapper/CustomerTagRefMapper.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/mapper/LmkStoreMapper.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/service/CustomerService.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/service/CustomerTagRefService.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/service/CustomerTagService.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/service/impl/CustomerServiceImpl.java 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/service/impl/CustomerTagRefServiceImpl.java 118 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/service/impl/CustomerTagServiceImpl.java 144 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/member/entity/vo/MemberVO.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/resources/mapper/lmk/CustomerMapper.xml 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/resources/mapper/lmk/CustomerTagMapper.xml 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/resources/mapper/lmk/CustomerTagRefMapper.xml 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/resources/mapper/lmk/LmkStoreMapper.xml 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manager-api/src/main/java/cn/lili/controller/lmk/CustomerController.java 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/domain/entity/CustomerTag.java
New file
@@ -0,0 +1,26 @@
package cn.lili.modules.lmk.domain.entity;
import cn.lili.mybatis.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
import lombok.Data;
/**
 *
 *
 * @author zxl
 * @since 2025-05-14
 */
@Data
@TableName("lmk_customer_tag")
public class CustomerTag extends BaseEntity {
    private static final long serialVersionUID = 1L;
    @TableField("tag_name")
    /**  标签名称*/
    private String tagName;
}
framework/src/main/java/cn/lili/modules/lmk/domain/entity/CustomerTagRef.java
New file
@@ -0,0 +1,27 @@
package cn.lili.modules.lmk.domain.entity;
import cn.lili.mybatis.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName("lmk_customer_tag_ref")
public class CustomerTagRef extends BaseEntity {
    private static final long serialVersionUID = 1L;
    @TableField("customerId")
    /**
     * 客户id
     */
    private String customerId;
    @TableField("customer_tag_id")
    /**
     * 客户对应标签id
     */
    private String customerTagId;
}
framework/src/main/java/cn/lili/modules/lmk/domain/form/CustomerTagForm.java
New file
@@ -0,0 +1,50 @@
package cn.lili.modules.lmk.domain.form;
import cn.lili.base.AbsForm;
import cn.lili.group.Add;
import cn.lili.group.Update;
import cn.lili.modules.lmk.domain.entity.CustomerTag;
import cn.lili.mybatis.BaseEntity;
import org.springframework.beans.BeanUtils;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import org.springframework.lang.NonNull;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
 * 表单
 *
 * @author zxl
 * @since 2025-05-14
 */
@Data
@ApiModel(value = "CustomerTag表单", description = "表单")
public class CustomerTagForm extends AbsForm {
    @NotBlank(message = "不能为空", groups = {Add.class, Update.class})
    @ApiModelProperty("标签名")
    private String tagName;
    @NotBlank(message = "不能为空", groups = {Add.class, Update.class})
    @ApiModelProperty("")
    private String createType;
    /**
     * 客户id
     * */
    @ApiModelProperty("客户id")
    private String customerId;
    public static CustomerTag getEntityByForm(@NonNull CustomerTagForm form, CustomerTag entity) {
        if(entity == null) {
          entity = new CustomerTag();
        }
        BeanUtils.copyProperties(form, entity);
        return entity;
    }
}
framework/src/main/java/cn/lili/modules/lmk/domain/form/CustomerTagRefForm.java
@@ -25,7 +25,7 @@
    @NotNull(message = "不能为空", groups = {Add.class, Update.class})
    @ApiModelProperty("客户id")
    private Long customerId;
    private String customerId;
    @NotBlank(message = "不能为空", groups = {Add.class, Update.class})
    @ApiModelProperty("标签id")
framework/src/main/java/cn/lili/modules/lmk/domain/query/CustomerQuery.java
New file
@@ -0,0 +1,31 @@
package cn.lili.modules.lmk.domain.query;
import cn.lili.base.AbsQuery;
import cn.lili.common.enums.SwitchEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "客户查询参数", description = "查询参数")
public class CustomerQuery extends AbsQuery {
    @ApiModelProperty(value = "用户名")
    private String username;
    @ApiModelProperty(value = "昵称")
    private String nickName;
    @ApiModelProperty(value = "用户手机号码")
    private String mobile;
    @ApiModelProperty(value = "商户名")
    private String storeId;
    /**
     * @see SwitchEnum
     */
    @ApiModelProperty(value = "会员状态")
    private String disabled;
}
framework/src/main/java/cn/lili/modules/lmk/domain/query/CustomerTagQuery.java
New file
@@ -0,0 +1,17 @@
package cn.lili.modules.lmk.domain.query;
import cn.lili.base.AbsQuery;
import io.swagger.annotations.ApiModel;
import lombok.Data;
/**
 * 查询
 *
 * @author zxl
 * @since 2025-05-14
 */
@Data
@ApiModel(value = "CustomerTag查询参数", description = "查询参数")
public class CustomerTagQuery extends AbsQuery {
}
framework/src/main/java/cn/lili/modules/lmk/domain/vo/CustomerTagRefVO.java
New file
@@ -0,0 +1,29 @@
package cn.lili.modules.lmk.domain.vo;
import cn.lili.base.AbsVo;
import cn.lili.modules.lmk.domain.entity.CustomerTagRef;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import org.springframework.lang.NonNull;
@Data
@ApiModel(value = "客户标签中间表响应数据", description = "客户标签中间表响应数据")
public class CustomerTagRefVO  extends AbsVo {
    /**  */
    @ApiModelProperty("")
    private String customerId;
    /**  */
    @ApiModelProperty("")
    private String customerTagId;
    public static CustomerTagRefVO getVoByEntity(@NonNull CustomerTagRef entity, CustomerTagRefVO vo) {
        if(vo == null) {
            vo = new CustomerTagRefVO();
        }
        BeanUtils.copyProperties(entity, vo);
        return vo;
    }
}
framework/src/main/java/cn/lili/modules/lmk/domain/vo/CustomerTagVO.java
New file
@@ -0,0 +1,43 @@
package cn.lili.modules.lmk.domain.vo;
import cn.lili.base.AbsVo;
import java.util.List;
import cn.lili.modules.lmk.domain.entity.CustomerTag;
import org.springframework.lang.NonNull;
import org.springframework.beans.BeanUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
 * 展示
 *
 * @author zxl
 * @since 2025-05-14
 */
@Data
@ApiModel(value = "响应数据", description = "响应数据")
public class CustomerTagVO extends AbsVo {
    /**  */
    @ApiModelProperty("标签名称")
    private String tagName;
    /**  */
    @ApiModelProperty("创建方式")
    private String createType;
    public static CustomerTagVO getVoByEntity(@NonNull CustomerTag entity, CustomerTagVO vo) {
        if(vo == null) {
            vo = new CustomerTagVO();
        }
        BeanUtils.copyProperties(entity, vo);
        return vo;
    }
}
framework/src/main/java/cn/lili/modules/lmk/domain/vo/StoreVO.java
New file
@@ -0,0 +1,14 @@
package cn.lili.modules.lmk.domain.vo;
import cn.lili.base.AbsVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "商户下拉响应数据", description = "响应数据")
public class StoreVO extends AbsVo{
    @ApiModelProperty(value = "商户名称")
    private String storeName;
}
framework/src/main/java/cn/lili/modules/lmk/mapper/CustomerMapper.java
New file
@@ -0,0 +1,35 @@
package cn.lili.modules.lmk.mapper;
import cn.lili.modules.lmk.domain.query.CustomerQuery;
import cn.lili.modules.member.entity.dos.Member;
import cn.lili.modules.member.entity.vo.MemberVO;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
 * 客户数据处理层
 *
 * @author
 * @since
 */
@Mapper
public interface CustomerMapper extends BaseMapper<Member> {
    /**
     * 获取所有的会员手机号
     * @return 会员手机号
     */
    @Select("select m.mobile from li_member m")
    List<String> getAllMemberMobile();
    IPage<MemberVO> getPage(IPage page, @Param("query") CustomerQuery query);
}
framework/src/main/java/cn/lili/modules/lmk/mapper/CustomerTagMapper.java
New file
@@ -0,0 +1,34 @@
package cn.lili.modules.lmk.mapper;
import java.util.List;
import cn.lili.modules.lmk.domain.entity.CustomerTag;
import cn.lili.modules.lmk.domain.query.CustomerTagQuery;
import cn.lili.modules.lmk.domain.vo.CustomerTagVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
 *  Mapper 接口
 *
 * @author zxl
 * @since 2025-05-14
 */
@Mapper
public interface CustomerTagMapper extends BaseMapper<CustomerTag> {
    /**
     * id查找
     * @param id
     * @return
     */
    CustomerTagVO getById(Integer id);
    /**
    *  分页
    */
    IPage getPage(IPage page, @Param("query") CustomerTagQuery query);
}
framework/src/main/java/cn/lili/modules/lmk/mapper/CustomerTagRefMapper.java
New file
@@ -0,0 +1,32 @@
package cn.lili.modules.lmk.mapper;
import cn.lili.modules.lmk.domain.entity.CustomerTagRef;
import cn.lili.modules.lmk.domain.query.CustomerTagRefQuery;
import cn.lili.modules.lmk.domain.vo.CustomerTagRefVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
 *  Mapper 接口
 *
 * @author zxl
 * @since 2025-05-14
 */
@Mapper
public interface CustomerTagRefMapper extends BaseMapper<CustomerTagRef> {
    /**
     * id查找
     * @param id
     * @return
     */
    CustomerTagRefVO getById(Integer id);
    /**
    *  分页
    */
    IPage getPage(IPage page, @Param("query") CustomerTagRefQuery query);
}
framework/src/main/java/cn/lili/modules/lmk/mapper/LmkStoreMapper.java
New file
@@ -0,0 +1,15 @@
package cn.lili.modules.lmk.mapper;
import cn.lili.modules.lmk.domain.vo.StoreVO;
import cn.lili.modules.store.entity.dos.Store;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface LmkStoreMapper extends BaseMapper<Store> {
    List<StoreVO> getStoreSelectOptions();
}
framework/src/main/java/cn/lili/modules/lmk/service/CustomerService.java
New file
@@ -0,0 +1,50 @@
package cn.lili.modules.lmk.service;
import cn.lili.base.Result;
import cn.lili.common.vo.PageVO;
import cn.lili.modules.lmk.domain.query.CustomerQuery;
import cn.lili.modules.member.entity.dos.Member;
import cn.lili.modules.member.entity.vo.MemberSearchVO;
import cn.lili.modules.member.entity.vo.MemberVO;
import cn.lili.modules.order.order.entity.dto.OrderSearchParams;
import cn.lili.modules.order.order.entity.vo.OrderSimpleVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
public interface CustomerService extends IService<Member> {
    /**
     * 获取会员分页 复用于该框架开源api
     *
     * @param customerQuery 会员搜索
     * @return 会员分页
     */
    Result getMemberPage(CustomerQuery customerQuery);
    /**
     * 获取用户VO基本信息 复用于该框架开源api
     * @param id 会员id
     * @return 用户VO
     */
    MemberVO getMember(String id);
    /**
     * 订单查询
     *
     * @param orderSearchParams 查询参数
     * @return 简短订单分页
     */
    IPage<OrderSimpleVO> queryByParams(OrderSearchParams orderSearchParams);
    /**
     * TODO 获得会员视频的浏览记录
     */
    Object getMemberVideoViewHistory();
    Result getStoreSelectOptions();
}
framework/src/main/java/cn/lili/modules/lmk/service/CustomerTagRefService.java
New file
@@ -0,0 +1,61 @@
package cn.lili.modules.lmk.service;
import cn.lili.base.Result;
import cn.lili.modules.lmk.domain.entity.CustomerTagRef;
import cn.lili.modules.lmk.domain.form.CustomerTagRefForm;
import cn.lili.modules.lmk.domain.query.CustomerTagRefQuery;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
public interface CustomerTagRefService extends IService<CustomerTagRef> {
    /**
     * 添加
     * @param form
     * @return
     */
    Result add(CustomerTagRefForm form);
    /**
     * 修改
     * @param form
     * @return
     */
    Result update(CustomerTagRefForm form);
    /**
     * 批量删除
     * @param ids
     * @return
     */
    Result remove(List<String> ids);
    /**
     * id删除
     * @param id
     * @return
     */
    Result removeById(String id);
    /**
     * 分页查询
     * @param query
     * @return
     */
    Result page(CustomerTagRefQuery query);
    /**
     * 根据id查找
     * @param id
     * @return
     */
    Result detail(Integer id);
    /**
     * 列表
     * @return
     */
    Result all();
}
framework/src/main/java/cn/lili/modules/lmk/service/CustomerTagService.java
New file
@@ -0,0 +1,68 @@
package cn.lili.modules.lmk.service;
import cn.lili.base.Result;
import cn.lili.modules.lmk.domain.entity.CustomerTag;
import cn.lili.modules.lmk.domain.form.CustomerTagForm;
import cn.lili.modules.lmk.domain.query.CustomerTagQuery;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
 *  服务类
 *
 * @author zxl
 * @since 2025-05-14
 */
public interface CustomerTagService extends IService<CustomerTag> {
    /**
     * 添加
     * @param form
     * @return
     */
    Result add(CustomerTagForm form);
    /**
     * 修改
     * @param form
     * @return
     */
    Result update(CustomerTagForm form);
    /**
     * 批量删除
     * @param ids
     * @return
     */
    Result remove(List<String> ids);
    /**
     * id删除
     * @param id
     * @return
     */
    Result removeById(String id);
    /**
     * 分页查询
     * @param query
     * @return
     */
    Result page(CustomerTagQuery query);
    /**
     * 根据id查找
     * @param id
     * @return
     */
    Result detail(Integer id);
    /**
     * 列表
     * @return
     */
    Result all();
    Result addCustomerTag(CustomerTagForm form);
}
framework/src/main/java/cn/lili/modules/lmk/service/impl/CustomerServiceImpl.java
New file
@@ -0,0 +1,60 @@
package cn.lili.modules.lmk.service.impl;
import cn.lili.base.Result;
import cn.lili.modules.lmk.domain.query.CustomerQuery;
import cn.lili.modules.lmk.mapper.CustomerMapper;
import cn.lili.modules.lmk.mapper.LmkStoreMapper;
import cn.lili.modules.lmk.service.CustomerService;
import cn.lili.modules.member.entity.dos.Member;
import cn.lili.modules.member.entity.vo.MemberVO;
import cn.lili.modules.member.mapper.MemberMapper;
import cn.lili.modules.order.order.entity.dto.OrderSearchParams;
import cn.lili.modules.order.order.entity.vo.OrderSimpleVO;
import cn.lili.utils.PageUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class CustomerServiceImpl extends ServiceImpl<MemberMapper, Member> implements CustomerService {
    private final CustomerMapper customerMapper;
    private final LmkStoreMapper storeMapper;
    @Override
    public Result getMemberPage(CustomerQuery customerQuery) {
        IPage<MemberVO> page = PageUtil.getPage(customerQuery,MemberVO.class);
        customerMapper.getPage(page, customerQuery);
        //并获得会员对应的标签
        return Result.ok().data(page.getRecords()).total(page.getTotal());
    }
    @Override
    public MemberVO getMember(String id) {
        return null;
    }
    @Override
    public IPage<OrderSimpleVO> queryByParams(OrderSearchParams orderSearchParams) {
        return null;
    }
    @Override
    public Object getMemberVideoViewHistory() {
        return null;
    }
    @Override
    public Result getStoreSelectOptions() {
        return Result.ok().data(storeMapper.getStoreSelectOptions());
    }
}
framework/src/main/java/cn/lili/modules/lmk/service/impl/CustomerTagRefServiceImpl.java
New file
@@ -0,0 +1,118 @@
package cn.lili.modules.lmk.service.impl;
import cn.lili.base.Result;
import cn.lili.modules.lmk.domain.entity.CustomerTagRef;
import cn.lili.modules.lmk.domain.form.CustomerTagRefForm;
import cn.lili.modules.lmk.domain.query.CustomerTagRefQuery;
import cn.lili.modules.lmk.domain.vo.CustomerTagRefVO;
import cn.lili.modules.lmk.mapper.CustomerTagRefMapper;
import cn.lili.modules.lmk.service.CustomerTagRefService;
import cn.lili.utils.PageUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import java.util.List;
import java.util.stream.Collectors;
@Service
@RequiredArgsConstructor
public class CustomerTagRefServiceImpl extends ServiceImpl<CustomerTagRefMapper, CustomerTagRef> implements CustomerTagRefService {
    private final CustomerTagRefMapper CustomerTagRefMapper;
    /**
     * 添加
     * @param form
     * @return
     */
    @Override
    public Result add(CustomerTagRefForm form) {
        CustomerTagRef entity = CustomerTagRefForm.getEntityByForm(form, null);
        baseMapper.insert(entity);
        return Result.ok("添加成功");
    }
    /**
     * 修改
     * @param form
     * @return
     */
    @Override
    public Result update(CustomerTagRefForm form) {
        CustomerTagRef entity = baseMapper.selectById(form.getId());
        // 为空抛IllegalArgumentException,做全局异常处理
        Assert.notNull(entity, "记录不存在");
        BeanUtils.copyProperties(form, entity);
        baseMapper.updateById(entity);
        return Result.ok("修改成功");
    }
    /**
     * 批量删除
     * @param ids
     * @return
     */
    @Override
    public Result remove(List<String> ids) {
        baseMapper.deleteBatchIds(ids);
        return Result.ok("删除成功");
    }
    /**
     * id删除
     * @param id
     * @return
     */
    @Override
    public Result removeById(String id) {
        baseMapper.deleteById(id);
        return Result.ok("删除成功");
    }
    /**
     * 分页查询
     * @param query
     * @return
     */
    @Override
    public Result page(CustomerTagRefQuery query) {
        IPage<CustomerTagRefVO> page = PageUtil.getPage(query, CustomerTagRefVO.class);
        baseMapper.getPage(page, query);
        return Result.ok().data(page.getRecords()).total(page.getTotal());
    }
    /**
     * 根据id查找
     * @param id
     * @return
     */
    @Override
    public Result detail(Integer id) {
        CustomerTagRefVO vo = baseMapper.getById(id);
        Assert.notNull(vo, "记录不存在");
        return Result.ok().data(vo);
    }
    /**
     * 列表
     * @return
     */
    @Override
    public Result all() {
        List<CustomerTagRef> entities = baseMapper.selectList(null);
        List<CustomerTagRefVO> vos = entities.stream()
                .map(entity -> CustomerTagRefVO.getVoByEntity(entity, null))
                .collect(Collectors.toList());
        return Result.ok().data(vos);
    }
}
framework/src/main/java/cn/lili/modules/lmk/service/impl/CustomerTagServiceImpl.java
New file
@@ -0,0 +1,144 @@
package cn.lili.modules.lmk.service.impl;
import cn.lili.base.Result;
import cn.lili.modules.lmk.domain.entity.CustomerTag;
import cn.lili.modules.lmk.domain.entity.CustomerTagRef;
import cn.lili.modules.lmk.domain.form.CustomerTagForm;
import cn.lili.modules.lmk.domain.query.CustomerTagQuery;
import cn.lili.modules.lmk.domain.vo.CustomerTagVO;
import cn.lili.modules.lmk.mapper.CustomerTagMapper;
import cn.lili.modules.lmk.mapper.CustomerTagRefMapper;
import cn.lili.modules.lmk.service.CustomerTagService;
import cn.lili.utils.PageUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.util.Assert;
import java.util.List;
import java.util.stream.Collectors;
/**
 *  服务实现类
 *
 * @author zxl
 * @since 2025-05-14
 */
@Service
@RequiredArgsConstructor
public class CustomerTagServiceImpl extends ServiceImpl<CustomerTagMapper, CustomerTag> implements CustomerTagService {
    private final CustomerTagMapper customerTagMapper;
    private final CustomerTagRefMapper customerTagRefMapper;
    /**
     * 添加
     * @param form
     * @return
     */
    @Override
    public Result add(CustomerTagForm form) {
        CustomerTag entity = CustomerTagForm.getEntityByForm(form, null);
        baseMapper.insert(entity);
        return Result.ok("添加成功");
    }
    /**
     * 修改
     * @param form
     * @return
     */
    @Override
    public Result update(CustomerTagForm form) {
        CustomerTag entity = baseMapper.selectById(form.getId());
        // 为空抛IllegalArgumentException,做全局异常处理
        Assert.notNull(entity, "记录不存在");
        BeanUtils.copyProperties(form, entity);
        baseMapper.updateById(entity);
        return Result.ok("修改成功");
    }
    /**
     * 批量删除
     * @param ids
     * @return
     */
    @Override
    public Result remove(List<String> ids) {
        baseMapper.deleteBatchIds(ids);
        return Result.ok("删除成功");
    }
    /**
     * id删除
     * @param id
     * @return
     */
    @Override
    public Result removeById(String id) {
        baseMapper.deleteById(id);
        return Result.ok("删除成功");
    }
    /**
     * 分页查询
     * @param query
     * @return
     */
    @Override
    public Result page(CustomerTagQuery query) {
        IPage<CustomerTagVO> page = PageUtil.getPage(query, CustomerTagVO.class);
        baseMapper.getPage(page, query);
        return Result.ok().data(page.getRecords()).total(page.getTotal());
    }
    /**
     * 根据id查找
     * @param id
     * @return
     */
    @Override
    public Result detail(Integer id) {
        CustomerTagVO vo = baseMapper.getById(id);
        Assert.notNull(vo, "记录不存在");
        return Result.ok().data(vo);
    }
    /**
     * 列表
     * @return
     */
    @Override
    public Result all() {
        List<CustomerTag> entities = baseMapper.selectList(null);
        List<CustomerTagVO> vos = entities.stream()
                .map(entity -> CustomerTagVO.getVoByEntity(entity, null))
                .collect(Collectors.toList());
        return Result.ok().data(vos);
    }
    @Override
    public Result addCustomerTag(CustomerTagForm form) {
        //插入客户标签
        CustomerTag entity = CustomerTagForm.getEntityByForm(form, null);
        baseMapper.insert(entity);
        //插入客户标签中间表
        CustomerTagRef ref = new CustomerTagRef();
        ref.setCustomerTagId(entity.getId());
        ref.setCustomerId(form.getCustomerId());
        customerTagRefMapper.insert(ref);
        return Result.ok("添加成功");
    }
    public Result delCustomerTag(String id) {
        return null;
    }
}
framework/src/main/java/cn/lili/modules/member/entity/vo/MemberVO.java
@@ -4,6 +4,7 @@
import cn.lili.common.security.sensitive.Sensitive;
import cn.lili.common.security.sensitive.enums.SensitiveStrategy;
import cn.lili.common.utils.BeanUtil;
import cn.lili.modules.lmk.domain.vo.CustomerTagVO;
import cn.lili.modules.member.entity.dos.Member;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
@@ -13,6 +14,7 @@
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
 * @author paulG
@@ -95,6 +97,9 @@
    @ApiModelProperty(value = "创建时间", hidden = true)
    private Date createTime;
    @ApiModelProperty(value = "客户标签列表")
    private List<CustomerTagVO> customerTagList;
    public MemberVO(Member member) {
        BeanUtil.copyProperties(member, this);
    }
framework/src/main/resources/mapper/lmk/CustomerMapper.xml
New file
@@ -0,0 +1,107 @@
<?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="cn.lili.modules.lmk.mapper.CustomerMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="cn.lili.modules.member.entity.vo.MemberVO">
        <id property="id" column="id"/>
        <!-- 基础字段映射 -->
        <result property="username" column="username"/>
        <result property="nickName" column="nick_name"/>
        <result property="sex" column="sex"/>
        <result property="birthday" column="birthday"/>
        <result property="regionId" column="region_id"/>
        <result property="region" column="region"/>
        <result property="mobile" column="mobile"/>
        <result property="point" column="point"/>
        <result property="totalPoint" column="total_point"/>
        <result property="face" column="face"/>
        <result property="disabled" column="disabled"/>
        <result property="haveStore" column="have_store"/>
        <result property="storeId" column="store_id"/>
        <result property="openId" column="open_id"/>
        <result property="clientEnum" column="client_enum"/>
        <result property="lastLoginDate" column="last_login_date"/>
        <result property="gradeId" column="grade_id"/>
        <result property="experience" column="experience"/>
        <result property="createTime" column="create_time"/>
        <collection property="customerTagList"  ofType="cn.lili.modules.lmk.domain.vo.CustomerTagVO"
                    select="selectTagByMemberId"
                    column="id"
        />
    </resultMap>
    <select id="getPage" resultMap="BaseResultMap">
        SELECT
            *
        FROM
            li_member lm
        <where>
        <!-- 用户名模糊查询 -->
        <if test="query.username != null and query.username != ''">
            AND lm.username LIKE CONCAT('%', #{query.username}, '%')
        </if>
        <!-- 昵称模糊查询 -->
        <if test="query.nickName != null and query.nickName != ''">
            AND lm.nick_name LIKE CONCAT('%', #{query.nickName}, '%')
        </if>
        <!-- 手机号码精确查询 -->
        <if test="query.mobile != null and query.mobile != ''">
            AND lm.mobile = #{query.mobile}
        </if>
        <!-- 会员状态转 -->
        <if test="query.disabled != null and query.disabled != ''">
            AND lm.disabled = #{query.disabled}
        </if>
        <!-- 商铺id -->
        <if test="query.storeId != null and query.storeId != ''">
            AND lm.store_id = #{query.storeId}
        </if>
            AND EXISTS (
            SELECT 1
            FROM li_order lo
            WHERE lo.member_id = lm.id
            )
        </where>
        ORDER BY lm.create_time DESC
    </select>
    <select id="selectTagByMemberId" resultType="cn.lili.modules.lmk.domain.vo.CustomerTagVO">
        SELECT
            LCT.id,
            LCT.tag_name,
            LCT.create_type
        FROM lmk_customer_tag_ref LCTR
            LEFT JOIN lmk_customer_tag  LCT
                ON LCTR.customer_tag_id = LCT.id
        WHERE LCTR.customer_id =#{id}
    </select>
    <select id="getById" resultMap="BaseResultMap">
        SELECT
            LCT.tag_name,
            LCT.create_type,
            LCT.create_by,
            LCT.create_time,
            LCT.update_by,
            LCT.update_time,
            LCT.delete_flag,
            LCT.id
        FROM
            lmk_customer_tag LCT
        WHERE
            LCT.id = #{id} AND LCT.delete_flag = 0
    </select>
</mapper>
framework/src/main/resources/mapper/lmk/CustomerTagMapper.xml
New file
@@ -0,0 +1,52 @@
<?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="cn.lili.modules.lmk.mapper.CustomerTagMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.CustomerTagVO">
        <result column="tag_name" property="tagName" />
        <result column="create_type" property="createType" />
        <result column="create_by" property="createBy" />
        <result column="create_time" property="createTime" />
        <result column="update_by" property="updateBy" />
        <result column="update_time" property="updateTime" />
    </resultMap>
    <select id="getById" resultMap="BaseResultMap">
        SELECT
            LCT.tag_name,
            LCT.create_type,
            LCT.create_by,
            LCT.create_time,
            LCT.update_by,
            LCT.update_time,
            LCT.id
        FROM
            lmk_customer_tag LCT
        WHERE
            LCT.id = #{id} AND LCT.delete_flag = 0
    </select>
    <select id="getPage" resultMap="BaseResultMap">
        SELECT
            LCT.tag_name,
            LCT.create_type,
            LCT.create_by,
            LCT.create_time,
            LCT.update_by,
            LCT.update_time,
            LCT.delete_flag,
            LCT.id
        FROM
            lmk_customer_tag LCT
        WHERE
            LCT.delete_flag = 0
    </select>
</mapper>
framework/src/main/resources/mapper/lmk/CustomerTagRefMapper.xml
New file
@@ -0,0 +1,39 @@
<?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="cn.lili.modules.lmk.mapper.CustomerTagRefMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.CustomerTagRefVO">
        <result column="customer_id" property="customerId" />
        <result column="customer_tag_id" property="customerTagId" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
        <result column="delete_flag" property="deleteFlag" />
    </resultMap>
    <select id="getById" resultMap="BaseResultMap">
        SELECT
            LCTR.varchar,
            LCTR.customer_id,
            LCTR.customer_tag_id,
            LCTR.id
        FROM
            lmk_customer_tag_ref LCTR
        WHERE
            LCTR.id = #{id} AND LCTR.delete_flag = 0
    </select>
    <select id="getPage" resultMap="BaseResultMap">
        SELECT
            LCTR.varchar,
            LCTR.customer_id,
            LCTR.customer_tag_id,
            LCTR.id
        FROM
            lmk_customer_tag_ref LCTR
        WHERE
            LCTR.delete_flag = 0
    </select>
</mapper>
framework/src/main/resources/mapper/lmk/LmkStoreMapper.xml
New file
@@ -0,0 +1,20 @@
<?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="cn.lili.modules.lmk.mapper.LmkStoreMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.StoreVO">
        <id column="id" property="id"/>
        <result column="store_name" property="storeName"/>
    </resultMap>
    <select id="getStoreSelectOptions" resultMap="BaseResultMap">
        SELECT
            LS.id,
            LS.store_name
            FROM li_store LS
    </select>
</mapper>
manager-api/src/main/java/cn/lili/controller/lmk/CustomerController.java
New file
@@ -0,0 +1,103 @@
package cn.lili.controller.lmk;
import cn.lili.base.Result;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.group.Add;
import cn.lili.group.Update;
import cn.lili.modules.lmk.domain.form.CustomerTagForm;
import cn.lili.modules.lmk.domain.form.CustomerTagRefForm;
import cn.lili.modules.lmk.domain.query.CustomerQuery;
import cn.lili.modules.lmk.domain.query.CustomerTagQuery;
import cn.lili.modules.lmk.service.CustomerService;
import cn.lili.modules.lmk.service.CustomerTagRefService;
import cn.lili.modules.lmk.service.CustomerTagService;
import cn.lili.modules.member.entity.vo.MemberSearchVO;
import cn.lili.modules.member.entity.vo.MemberVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@Validated
@RequiredArgsConstructor
@Api(value = "客户管理", tags = "管理")
@RestController
@RequestMapping("/manager/customerManager")
public class CustomerController {
    private final CustomerService customerService;
    private final CustomerTagService customerTagService;
    private final CustomerTagRefService customerTagRefService;
    @ApiOperation(value = "商铺下拉列表")
    @GetMapping("/store/selectOption")
    public Result getStoreSelectOptions(){
        return customerService.getStoreSelectOptions();
    }
    @ApiOperation(value = "会员分页列表")
    @GetMapping
    public Result getByPage(CustomerQuery customerQuery) {
        return customerService.getMemberPage(customerQuery);
    }
    @PostMapping("/addTag")
    @ApiOperation(value = "添加标签", notes = "添加标签")
    public Result add(@RequestBody @Validated(Add.class) CustomerTagForm form) {
        return customerTagService.add(form);
    }
    @PutMapping("/editTag")
    @ApiOperation(value = "修改标签", notes = "修改标签")
    public Result update(@RequestBody @Validated(Update.class) CustomerTagForm form) {
        return customerTagService.update(form);
    }
    @DeleteMapping("/tag/{id}")
    @ApiOperation(value = "ID删除标签", notes = "ID删除")
    public Result removeById(@PathVariable("id") String id) {
        return customerTagService.removeById(id);
    }
    @GetMapping("/tagList")
    @ApiOperation(value = "标签列表", notes = "标签列表")
    public Result list() {
        return customerTagService.all();
    }
    @GetMapping("/pageTagList")
    @ApiOperation(value = "分页标签列表", notes = "标签列表")
    public Result pageList(CustomerTagQuery query) {
        return customerTagService.page(query);
    }
    @PostMapping("/customerAddTag")
    @ApiOperation(value = "添加客户标签标识", notes = "添加客户标签标识")
    public Result addCustomerTag(@RequestBody @Validated(Add.class) CustomerTagForm form) {
        return customerTagService.addCustomerTag(form);
    }
//    @PostMapping("/customerAddTag")
//    @ApiOperation(value = "添加客户标签标识", notes = "添加客户标签标识")
//    public Result add(@RequestBody @Validated(Add.class) CustomerTagRefForm form) {
//        return customerTagRefService.add(form);
//    }
    @PutMapping("/customerEditTag")
    @ApiOperation(value = "修改客户标签标识", notes = "修改客户标签标识")
    public Result update(@RequestBody @Validated(Update.class) CustomerTagRefForm form) {
        return customerTagRefService.update(form);
    }
    @DeleteMapping("/customerDelTag/{id}")
    @ApiOperation(value = "删除客户标签标识ID删除", notes = "删除客户标签标识ID删除")
    public Result removeCustomerTagById(@PathVariable("id") String id) {
        return customerTagRefService.removeById(id);
    }
}