New file |
| | |
| | | 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; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | @NotNull(message = "不能为空", groups = {Add.class, Update.class}) |
| | | @ApiModelProperty("客户id") |
| | | private Long customerId; |
| | | private String customerId; |
| | | |
| | | @NotBlank(message = "不能为空", groups = {Add.class, Update.class}) |
| | | @ApiModelProperty("标签id") |
New file |
| | |
| | | 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; |
| | | |
| | | } |
New file |
| | |
| | | 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 { |
| | | } |
| | | |
New file |
| | |
| | | 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; |
| | | } |
| | | } |
New file |
| | |
| | | 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; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | } |
New file |
| | |
| | | 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); |
| | | } |
New file |
| | |
| | | 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); |
| | | |
| | | } |
New file |
| | |
| | | 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); |
| | | |
| | | } |
New file |
| | |
| | | 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(); |
| | | |
| | | } |
New file |
| | |
| | | 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(); |
| | | } |
New file |
| | |
| | | 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(); |
| | | } |
New file |
| | |
| | | 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); |
| | | } |
New file |
| | |
| | | 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()); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | 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); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author paulG |
| | |
| | | @ApiModelProperty(value = "创建时间", hidden = true) |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty(value = "客户标签列表") |
| | | private List<CustomerTagVO> customerTagList; |
| | | |
| | | public MemberVO(Member member) { |
| | | BeanUtil.copyProperties(member, this); |
| | | } |
New file |
| | |
| | | <?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> |
New file |
| | |
| | | <?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> |
New file |
| | |
| | | <?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> |
New file |
| | |
| | | <?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> |
New file |
| | |
| | | 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); |
| | | } |
| | | |
| | | } |