From 59aed09c5faffa1ef7a8ade34f5a75fcb3877dcf Mon Sep 17 00:00:00 2001 From: zhanghua <314079846@qq.com> Date: 星期三, 02 七月 2025 23:23:01 +0800 Subject: [PATCH] 会员标签 --- framework/src/main/java/cn/lili/modules/lmk/service/impl/GoodsTagServiceImpl.java | 92 ++++++ framework/src/main/java/cn/lili/modules/lmk/domain/vo/MemberTagVO.java | 28 + framework/src/main/java/cn/lili/modules/lmk/domain/form/MemberTagForm.java | 52 +++ framework/src/main/java/cn/lili/modules/lmk/service/GoodsTagService.java | 51 +++ framework/src/main/resources/mapper/lmk/CustomerMapper.xml | 4 framework/src/main/java/cn/lili/modules/member/entity/vo/MemberVO.java | 4 framework/src/main/resources/mapper/lmk/MemberMapper.xml | 41 ++ framework/src/main/java/cn/lili/modules/lmk/domain/entity/GoodsTag.java | 13 framework/src/main/resources/mapper/lmk/MemberTagMapper.xml | 43 +++ framework/src/main/resources/mapper/lmk/GoodsTagMapper.xml | 15 + framework/src/main/java/cn/lili/modules/member/entity/dto/ManagerMemberEditDTO.java | 3 framework/src/main/java/cn/lili/modules/lmk/domain/entity/MemberTag.java | 13 framework/src/main/java/cn/lili/modules/lmk/service/MemberTagService.java | 29 + framework/src/main/java/cn/lili/modules/lmk/service/impl/MemberTagServiceImpl.java | 158 +++++++++++ framework/src/main/java/cn/lili/modules/member/mapper/MemberMapper.java | 2 framework/src/main/java/cn/lili/modules/lmk/mapper/GoodsTagMapper.java | 16 + /dev/null | 51 --- framework/src/main/java/cn/lili/modules/lmk/mapper/MemberTagMapper.java | 16 + framework/src/main/java/cn/lili/modules/lmk/domain/query/TagQuery.java | 2 framework/src/main/resources/mapper/lmk/TagMapper.xml | 5 buyer-api/src/main/java/cn/lili/controller/lmk/CustomerController.java | 24 manager-api/src/main/java/cn/lili/controller/lmk/CustomerController.java | 38 - framework/src/main/java/cn/lili/modules/lmk/domain/form/GoodsTagForm.java | 51 +++ framework/src/main/java/cn/lili/modules/lmk/domain/vo/GoodsTagVO.java | 33 +- framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberServiceImpl.java | 15 + 25 files changed, 657 insertions(+), 142 deletions(-) diff --git a/buyer-api/src/main/java/cn/lili/controller/lmk/CustomerController.java b/buyer-api/src/main/java/cn/lili/controller/lmk/CustomerController.java index 1478a62..4a7a4d2 100644 --- a/buyer-api/src/main/java/cn/lili/controller/lmk/CustomerController.java +++ b/buyer-api/src/main/java/cn/lili/controller/lmk/CustomerController.java @@ -3,13 +3,13 @@ import cn.lili.base.Result; 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.MemberTagForm; 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.lmk.service.MemberTagService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -27,7 +27,7 @@ public class CustomerController { private final CustomerService customerService; - private final CustomerTagService customerTagService; + private final MemberTagService memberTagService; private final CustomerTagRefService customerTagRefService; @ApiOperation(value = "鍟嗛摵涓嬫媺鍒楄〃") @@ -45,39 +45,39 @@ @PostMapping("/addTag") @ApiOperation(value = "娣诲姞鏍囩", notes = "娣诲姞鏍囩") - public Result add(@RequestBody @Validated(Add.class) CustomerTagForm form) { - return customerTagService.add(form); + public Result add(@RequestBody @Validated(Add.class) MemberTagForm form) { + return memberTagService.add(form); } @PutMapping("/editTag") @ApiOperation(value = "淇敼鏍囩", notes = "淇敼鏍囩") - public Result update(@RequestBody @Validated(Update.class) CustomerTagForm form) { - return customerTagService.update(form); + public Result update(@RequestBody @Validated(Update.class) MemberTagForm form) { + return memberTagService.update(form); } @DeleteMapping("/tag/{id}") @ApiOperation(value = "ID鍒犻櫎鏍囩", notes = "ID鍒犻櫎") public Result removeById(@PathVariable("id") String id) { - return customerTagService.removeById(id); + return memberTagService.removeById(id); } @GetMapping("/tagList") @ApiOperation(value = "鏍囩鍒楄〃", notes = "鏍囩鍒楄〃") public Result list() { - return customerTagService.all(); + return memberTagService.all(); } @GetMapping("/pageTagList") @ApiOperation(value = "鍒嗛〉鏍囩鍒楄〃", notes = "鏍囩鍒楄〃") public Result pageList(CustomerTagQuery query) { - return customerTagService.page(query); + return memberTagService.page(query); } @PostMapping("/customerAddTag") @ApiOperation(value = "娣诲姞瀹㈡埛鏍囩鏍囪瘑", notes = "娣诲姞瀹㈡埛鏍囩鏍囪瘑") - public Result addCustomerTag(@RequestBody @Validated(Add.class) CustomerTagForm form) { - return customerTagService.addCustomerTag(form); + public Result addCustomerTag(@RequestBody @Validated(Add.class) MemberTagForm form) { + return memberTagService.addMemberTag(form); } // @PostMapping("/customerAddTag") diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/entity/CustomerTag.java b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/GoodsTag.java similarity index 72% rename from framework/src/main/java/cn/lili/modules/lmk/domain/entity/CustomerTag.java rename to framework/src/main/java/cn/lili/modules/lmk/domain/entity/GoodsTag.java index 3a5ae77..7ead7dc 100644 --- a/framework/src/main/java/cn/lili/modules/lmk/domain/entity/CustomerTag.java +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/GoodsTag.java @@ -3,21 +3,24 @@ 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 { +@TableName("lmk_goods_tag") +public class GoodsTag extends BaseEntity { private static final long serialVersionUID = 1L; + @TableField("tag_id") + private String tagId; + + @TableField("goods_id") + private String goodsId; + @TableField("tag_name") /** 鏍囩鍚嶇О*/ private String tagName; diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/entity/CustomerTag.java b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/MemberTag.java similarity index 72% copy from framework/src/main/java/cn/lili/modules/lmk/domain/entity/CustomerTag.java copy to framework/src/main/java/cn/lili/modules/lmk/domain/entity/MemberTag.java index 3a5ae77..45c334a 100644 --- a/framework/src/main/java/cn/lili/modules/lmk/domain/entity/CustomerTag.java +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/MemberTag.java @@ -3,21 +3,24 @@ 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 { +@TableName("lmk_member_tag") +public class MemberTag extends BaseEntity { private static final long serialVersionUID = 1L; + @TableField("tag_id") + private String tagId; + + @TableField("member_id") + private String memberId; + @TableField("tag_name") /** 鏍囩鍚嶇О*/ private String tagName; diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/form/CustomerTagForm.java b/framework/src/main/java/cn/lili/modules/lmk/domain/form/CustomerTagForm.java deleted file mode 100644 index 9117724..0000000 --- a/framework/src/main/java/cn/lili/modules/lmk/domain/form/CustomerTagForm.java +++ /dev/null @@ -1,50 +0,0 @@ -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; - } - -} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/form/GoodsTagForm.java b/framework/src/main/java/cn/lili/modules/lmk/domain/form/GoodsTagForm.java new file mode 100644 index 0000000..2dda2bd --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/form/GoodsTagForm.java @@ -0,0 +1,51 @@ +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.GoodsTag; +import cn.lili.modules.lmk.domain.entity.MemberTag; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.beans.BeanUtils; +import org.springframework.lang.NonNull; + +import javax.validation.constraints.NotBlank; +import java.util.List; + +/** + * 琛ㄥ崟 + * + * @author zxl + * @since 2025-05-14 + */ +@Data +@ApiModel(value = "GoodsTag琛ㄥ崟", description = "琛ㄥ崟") +public class GoodsTagForm extends AbsForm { + + @NotBlank(message = "涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("鏍囩Id") + private List<String> tagIds; + + + @NotBlank(message = "涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("") + private String createType; + + + /** + * 瀹㈡埛id + */ + @ApiModelProperty("鍟嗗搧id") + private String goodsId; + + public static GoodsTag getEntityByForm(@NonNull GoodsTagForm form, GoodsTag entity) { + if (entity == null) { + entity = new GoodsTag(); + } + BeanUtils.copyProperties(form, entity); + return entity; + } + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/form/MemberTagForm.java b/framework/src/main/java/cn/lili/modules/lmk/domain/form/MemberTagForm.java new file mode 100644 index 0000000..da6ff44 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/form/MemberTagForm.java @@ -0,0 +1,52 @@ +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.MemberTag; +import org.springframework.beans.BeanUtils; + +import javax.validation.constraints.NotBlank; + +import org.springframework.lang.NonNull; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * 琛ㄥ崟 + * + * @author zxl + * @since 2025-05-14 + */ +@Data +@ApiModel(value = "MemberTag琛ㄥ崟", description = "琛ㄥ崟") +public class MemberTagForm extends AbsForm { + + @NotBlank(message = "涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("鏍囩Id") + private List<String> tagIds; + + + @NotBlank(message = "涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("") + private String createType; + + + /** + * 瀹㈡埛id + */ + @ApiModelProperty("瀹㈡埛id") + private String memberId; + + public static MemberTag getEntityByForm(@NonNull MemberTagForm form, MemberTag entity) { + if (entity == null) { + entity = new MemberTag(); + } + BeanUtils.copyProperties(form, entity); + return entity; + } + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/query/TagQuery.java b/framework/src/main/java/cn/lili/modules/lmk/domain/query/TagQuery.java index 605e894..f2e7006 100644 --- a/framework/src/main/java/cn/lili/modules/lmk/domain/query/TagQuery.java +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/query/TagQuery.java @@ -26,6 +26,8 @@ @ApiModelProperty("鏍囩鍒嗙被") private String tagTypeId; + @ApiModelProperty("鏍囩绫诲埆key") + private String tagTypeKey; } diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/CustomerTagVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/GoodsTagVO.java similarity index 60% copy from framework/src/main/java/cn/lili/modules/lmk/domain/vo/CustomerTagVO.java copy to framework/src/main/java/cn/lili/modules/lmk/domain/vo/GoodsTagVO.java index e0a9236..336360e 100644 --- a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/CustomerTagVO.java +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/GoodsTagVO.java @@ -1,16 +1,12 @@ 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 cn.lili.modules.lmk.domain.entity.MemberTag; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.Date; +import org.springframework.beans.BeanUtils; +import org.springframework.lang.NonNull; /** * 灞曠ず @@ -20,21 +16,30 @@ */ @Data @ApiModel(value = "鍝嶅簲鏁版嵁", description = "鍝嶅簲鏁版嵁") -public class CustomerTagVO extends AbsVo { +public class GoodsTagVO extends AbsVo { - /** */ + @ApiModelProperty("鏍囩Id") + private String tagId; + + @ApiModelProperty("瀹㈡埛id") + private String goodsId; + + /** + * + */ @ApiModelProperty("鏍囩鍚嶇О") private String tagName; - /** */ + /** + * + */ @ApiModelProperty("鍒涘缓鏂瑰紡") private String createType; - - public static CustomerTagVO getVoByEntity(@NonNull CustomerTag entity, CustomerTagVO vo) { - if(vo == null) { - vo = new CustomerTagVO(); + public static GoodsTagVO getVoByEntity(@NonNull MemberTag entity, GoodsTagVO vo) { + if (vo == null) { + vo = new GoodsTagVO(); } BeanUtils.copyProperties(entity, vo); return vo; diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/CustomerTagVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/MemberTagVO.java similarity index 60% rename from framework/src/main/java/cn/lili/modules/lmk/domain/vo/CustomerTagVO.java rename to framework/src/main/java/cn/lili/modules/lmk/domain/vo/MemberTagVO.java index e0a9236..3595151 100644 --- a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/CustomerTagVO.java +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/MemberTagVO.java @@ -2,15 +2,12 @@ import cn.lili.base.AbsVo; -import java.util.List; - -import cn.lili.modules.lmk.domain.entity.CustomerTag; +import cn.lili.modules.lmk.domain.entity.MemberTag; 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; /** * 灞曠ず @@ -20,21 +17,30 @@ */ @Data @ApiModel(value = "鍝嶅簲鏁版嵁", description = "鍝嶅簲鏁版嵁") -public class CustomerTagVO extends AbsVo { +public class MemberTagVO extends AbsVo { - /** */ + @ApiModelProperty("鏍囩Id") + private String tagId; + + @ApiModelProperty("瀹㈡埛id") + private String memberId; + + /** + * + */ @ApiModelProperty("鏍囩鍚嶇О") private String tagName; - /** */ + /** + * + */ @ApiModelProperty("鍒涘缓鏂瑰紡") private String createType; - - public static CustomerTagVO getVoByEntity(@NonNull CustomerTag entity, CustomerTagVO vo) { - if(vo == null) { - vo = new CustomerTagVO(); + public static MemberTagVO getVoByEntity(@NonNull MemberTag entity, MemberTagVO vo) { + if (vo == null) { + vo = new MemberTagVO(); } BeanUtils.copyProperties(entity, vo); return vo; diff --git a/framework/src/main/java/cn/lili/modules/lmk/mapper/CustomerTagMapper.java b/framework/src/main/java/cn/lili/modules/lmk/mapper/CustomerTagMapper.java deleted file mode 100644 index 908b2f6..0000000 --- a/framework/src/main/java/cn/lili/modules/lmk/mapper/CustomerTagMapper.java +++ /dev/null @@ -1,34 +0,0 @@ -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); - -} diff --git a/framework/src/main/java/cn/lili/modules/lmk/mapper/GoodsTagMapper.java b/framework/src/main/java/cn/lili/modules/lmk/mapper/GoodsTagMapper.java new file mode 100644 index 0000000..1525508 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/mapper/GoodsTagMapper.java @@ -0,0 +1,16 @@ +package cn.lili.modules.lmk.mapper; + +import cn.lili.modules.lmk.domain.entity.GoodsTag; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * Mapper 鎺ュ彛 + * + * @author zxl + * @since 2025-05-14 + */ +@Mapper +public interface GoodsTagMapper extends BaseMapper<GoodsTag> { + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/mapper/MemberTagMapper.java b/framework/src/main/java/cn/lili/modules/lmk/mapper/MemberTagMapper.java new file mode 100644 index 0000000..bc602b5 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/mapper/MemberTagMapper.java @@ -0,0 +1,16 @@ +package cn.lili.modules.lmk.mapper; + +import cn.lili.modules.lmk.domain.entity.MemberTag; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * Mapper 鎺ュ彛 + * + * @author zxl + * @since 2025-05-14 + */ +@Mapper +public interface MemberTagMapper extends BaseMapper<MemberTag> { + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/GoodsTagService.java b/framework/src/main/java/cn/lili/modules/lmk/service/GoodsTagService.java new file mode 100644 index 0000000..e3afa30 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/service/GoodsTagService.java @@ -0,0 +1,51 @@ +package cn.lili.modules.lmk.service; + +import cn.lili.base.Result; +import cn.lili.modules.lmk.domain.entity.GoodsTag; +import cn.lili.modules.lmk.domain.form.GoodsTagForm; +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 GoodsTagService extends IService<GoodsTag> { + + /** + * 娣诲姞 + * + * @param form + * @return + */ + Result addGoodsTag(GoodsTagForm form); + + + /** + * 鎵归噺鍒犻櫎 + * + * @param ids + * @return + */ + Result remove(List<String> ids); + + /** + * id鍒犻櫎 + * + * @param id + * @return + */ + Result removeById(String id); + + + /** + * 鍒楄〃 + * + * @return + */ + Result getByGoodsId(String goodsId); +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/CustomerTagService.java b/framework/src/main/java/cn/lili/modules/lmk/service/MemberTagService.java similarity index 64% rename from framework/src/main/java/cn/lili/modules/lmk/service/CustomerTagService.java rename to framework/src/main/java/cn/lili/modules/lmk/service/MemberTagService.java index e17f760..19c2da5 100644 --- a/framework/src/main/java/cn/lili/modules/lmk/service/CustomerTagService.java +++ b/framework/src/main/java/cn/lili/modules/lmk/service/MemberTagService.java @@ -1,37 +1,40 @@ 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.entity.MemberTag; +import cn.lili.modules.lmk.domain.form.MemberTagForm; 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> { +public interface MemberTagService extends IService<MemberTag> { /** * 娣诲姞 + * * @param form * @return */ - Result add(CustomerTagForm form); + Result add(MemberTagForm form); /** * 淇敼 + * * @param form * @return */ - Result update(CustomerTagForm form); + Result update(MemberTagForm form); /** * 鎵归噺鍒犻櫎 + * * @param ids * @return */ @@ -39,6 +42,7 @@ /** * id鍒犻櫎 + * * @param id * @return */ @@ -46,23 +50,22 @@ /** * 鍒嗛〉鏌ヨ + * * @param query * @return */ Result page(CustomerTagQuery query); - /** - * 鏍规嵁id鏌ユ壘 - * @param id - * @return - */ - Result detail(Integer id); /** * 鍒楄〃 + * * @return */ Result all(); - Result addCustomerTag(CustomerTagForm form); + Result addMemberTag(MemberTagForm form); + + Result getByMemberId(String memberId); + } diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/CustomerTagServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/CustomerTagServiceImpl.java deleted file mode 100644 index 59d7a94..0000000 --- a/framework/src/main/java/cn/lili/modules/lmk/service/impl/CustomerTagServiceImpl.java +++ /dev/null @@ -1,144 +0,0 @@ -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()); - - // 涓虹┖鎶汭llegalArgumentException锛屽仛鍏ㄥ眬寮傚父澶勭悊 - 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; - } -} diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/GoodsTagServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/GoodsTagServiceImpl.java new file mode 100644 index 0000000..e70fb07 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/GoodsTagServiceImpl.java @@ -0,0 +1,92 @@ +package cn.lili.modules.lmk.service.impl; + +import cn.lili.base.Result; +import cn.lili.modules.lmk.domain.entity.GoodsTag; +import cn.lili.modules.lmk.domain.entity.Tag; +import cn.lili.modules.lmk.domain.form.GoodsTagForm; +import cn.lili.modules.lmk.domain.query.CustomerTagQuery; +import cn.lili.modules.lmk.domain.vo.MemberTagVO; +import cn.lili.modules.lmk.mapper.GoodsTagMapper; +import cn.lili.modules.lmk.service.GoodsTagService; +import cn.lili.modules.lmk.service.TagService; +import cn.lili.utils.PageUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +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; + +/** + * 鏈嶅姟瀹炵幇绫� + * + * @author zxl + * @since 2025-05-14 + */ +@Service +@RequiredArgsConstructor +public class GoodsTagServiceImpl extends ServiceImpl<GoodsTagMapper, GoodsTag> implements GoodsTagService { + + private final TagService tagService; + + + /** + * 鎵归噺鍒犻櫎 + * + * @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("鍒犻櫎鎴愬姛"); + } + + @Override + public Result getByGoodsId(String goodsId) { + LambdaQueryWrapper<GoodsTag> queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(GoodsTag::getGoodsId, goodsId); + return Result.ok().data(baseMapper.selectList(queryWrapper)); + } + + + @Override + public Result addGoodsTag(GoodsTagForm form) { + LambdaQueryWrapper<Tag> query = new LambdaQueryWrapper<>(); + query.in(Tag::getId, form.getTagIds()); + List<Tag> tags = tagService.list(query); + List<GoodsTag> GoodsTags = tags.stream().map(tag -> { + GoodsTag GoodsTag = new GoodsTag(); + GoodsTag.setTagId(tag.getId()); + GoodsTag.setGoodsId(form.getGoodsId()); + GoodsTag.setTagName(tag.getTagName()); + GoodsTag.setCreateType(form.getCreateType()); + return GoodsTag; + }).collect(Collectors.toList()); + + this.saveBatch(GoodsTags); + return Result.ok("娣诲姞鎴愬姛"); + } + + + public Result delCustomerTag(String id) { + + return null; + } +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/MemberTagServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/MemberTagServiceImpl.java new file mode 100644 index 0000000..73a7d1a --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/MemberTagServiceImpl.java @@ -0,0 +1,158 @@ +package cn.lili.modules.lmk.service.impl; + +import cn.lili.base.Result; +import cn.lili.modules.lmk.domain.entity.MemberTag; +import cn.lili.modules.lmk.domain.entity.Tag; +import cn.lili.modules.lmk.domain.form.MemberTagForm; +import cn.lili.modules.lmk.domain.query.CustomerTagQuery; +import cn.lili.modules.lmk.domain.vo.MemberTagVO; +import cn.lili.modules.lmk.mapper.MemberTagMapper; +import cn.lili.modules.lmk.service.MemberTagService; +import cn.lili.modules.lmk.service.TagService; +import cn.lili.utils.PageUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +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 MemberTagServiceImpl extends ServiceImpl<MemberTagMapper, MemberTag> implements MemberTagService { + + private final TagService tagService; + + /** + * 娣诲姞 + * + * @param form + * @return + */ + @Override + public Result add(MemberTagForm form) { + MemberTag entity = MemberTagForm.getEntityByForm(form, null); + baseMapper.insert(entity); + return Result.ok("娣诲姞鎴愬姛"); + } + + /** + * 淇敼 + * + * @param form + * @return + */ + @Override + public Result update(MemberTagForm form) { + MemberTag entity = baseMapper.selectById(form.getId()); + + // 涓虹┖鎶汭llegalArgumentException锛屽仛鍏ㄥ眬寮傚父澶勭悊 + 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<MemberTag> page = PageUtil.getPage(query, MemberTag.class); + + LambdaQueryWrapper<MemberTag> lambdaQueryWrapper = new LambdaQueryWrapper<>(); + + baseMapper.selectPage(page, lambdaQueryWrapper); + return Result.ok().data(page.getRecords()).total(page.getTotal()); + } + + + /** + * 鍒楄〃 + * + * @return + */ + @Override + public Result all() { + List<MemberTag> entities = baseMapper.selectList(null); + List<MemberTagVO> vos = entities.stream() + .map(entity -> MemberTagVO.getVoByEntity(entity, null)) + .collect(Collectors.toList()); + return Result.ok().data(vos); + } + + @Override + public Result addMemberTag(MemberTagForm form) { + + LambdaQueryWrapper<MemberTag> deleteQuery = new LambdaQueryWrapper<>(); + deleteQuery.eq(MemberTag::getMemberId, form.getMemberId()); + baseMapper.delete(deleteQuery); + + LambdaQueryWrapper<Tag> query = new LambdaQueryWrapper<>(); + query.in(Tag::getId, form.getTagIds()); + List<Tag> tags = tagService.list(query); + List<MemberTag> memberTags = tags.stream().map(tag -> { + MemberTag memberTag = new MemberTag(); + memberTag.setTagId(tag.getId()); + memberTag.setMemberId(form.getMemberId()); + memberTag.setTagName(tag.getTagName()); + memberTag.setCreateType(form.getCreateType()); + return memberTag; + }).collect(Collectors.toList()); + + this.saveBatch(memberTags); + return Result.ok("娣诲姞鎴愬姛"); + } + + @Override + public Result getByMemberId(String memberId) { + LambdaQueryWrapper<MemberTag> query = new LambdaQueryWrapper<>(); + query.eq(MemberTag::getMemberId, memberId); + List<MemberTag> memberTags = baseMapper.selectList(query); + return Result.ok().data(memberTags); + } + + + public Result delCustomerTag(String id) { + + return null; + } +} diff --git a/framework/src/main/java/cn/lili/modules/member/entity/dto/ManagerMemberEditDTO.java b/framework/src/main/java/cn/lili/modules/member/entity/dto/ManagerMemberEditDTO.java index 13f9c16..efbcc21 100644 --- a/framework/src/main/java/cn/lili/modules/member/entity/dto/ManagerMemberEditDTO.java +++ b/framework/src/main/java/cn/lili/modules/member/entity/dto/ManagerMemberEditDTO.java @@ -10,6 +10,7 @@ import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; import java.util.Date; +import java.util.List; /** * 浼氬憳淇敼 @@ -54,4 +55,6 @@ @ApiModelProperty(value = "浼氬憳澶村儚") private String face; + + private List<String> tags; } diff --git a/framework/src/main/java/cn/lili/modules/member/entity/vo/MemberVO.java b/framework/src/main/java/cn/lili/modules/member/entity/vo/MemberVO.java index 5aba29d..6fa585e 100644 --- a/framework/src/main/java/cn/lili/modules/member/entity/vo/MemberVO.java +++ b/framework/src/main/java/cn/lili/modules/member/entity/vo/MemberVO.java @@ -4,7 +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.lmk.domain.vo.MemberTagVO; import cn.lili.modules.member.entity.dos.Member; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; @@ -98,7 +98,7 @@ private Date createTime; @ApiModelProperty(value = "瀹㈡埛鏍囩鍒楄〃") - private List<CustomerTagVO> customerTagList; + private List<MemberTagVO> tags; /** * 涓簄ull鍒欎笉鍦ㄩ粦鍚嶅崟鍐� diff --git a/framework/src/main/java/cn/lili/modules/member/mapper/MemberMapper.java b/framework/src/main/java/cn/lili/modules/member/mapper/MemberMapper.java index 32f09fa..771aa09 100644 --- a/framework/src/main/java/cn/lili/modules/member/mapper/MemberMapper.java +++ b/framework/src/main/java/cn/lili/modules/member/mapper/MemberMapper.java @@ -29,4 +29,6 @@ @Select("select * from li_member ${ew.customSqlSegment}") IPage<MemberVO> pageByMemberVO(IPage<MemberVO> page, @Param(Constants.WRAPPER) Wrapper<Member> queryWrapper); + + MemberVO getVoById(@Param("id") String id); } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberServiceImpl.java b/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberServiceImpl.java index 489d7ea..66493cb 100644 --- a/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberServiceImpl.java @@ -24,6 +24,8 @@ import cn.lili.modules.connect.entity.dto.ConnectAuthUser; import cn.lili.modules.connect.service.ConnectService; import cn.lili.modules.lmk.domain.entity.VideoAccount; +import cn.lili.modules.lmk.domain.form.MemberTagForm; +import cn.lili.modules.lmk.service.MemberTagService; import cn.lili.modules.lmk.service.VideoAccountService; import cn.lili.modules.member.aop.annotation.PointLogPoint; import cn.lili.modules.member.entity.dos.Member; @@ -111,6 +113,9 @@ @Autowired private VideoAccountService videoAccountService; + + @Autowired + private MemberTagService memberTagService; @Override public Member findByUsername(String userName) { @@ -487,6 +492,7 @@ } @Override + @Transactional public Member updateMember(ManagerMemberEditDTO managerMemberEditDTO) { //杩囨护浼氬憳鏄电О鏁忔劅璇� if (CharSequenceUtil.isNotBlank(managerMemberEditDTO.getNickName())) { @@ -501,6 +507,13 @@ //浼犻�掍慨鏀逛細鍛樹俊鎭� BeanUtil.copyProperties(managerMemberEditDTO, member); this.updateById(member); + if (managerMemberEditDTO.getTags() != null) { + MemberTagForm memberTagForm = new MemberTagForm(); + memberTagForm.setMemberId(member.getId()); + memberTagForm.setTagIds(managerMemberEditDTO.getTags()); + memberTagForm.setCreateType("MANAGER"); + memberTagService.addMemberTag(memberTagForm); + } return member; } @@ -786,7 +799,7 @@ @Override public MemberVO getMember(String id) { - return new MemberVO(this.getById(id)); + return baseMapper.getVoById(id); } @Override diff --git a/framework/src/main/resources/mapper/lmk/CustomerMapper.xml b/framework/src/main/resources/mapper/lmk/CustomerMapper.xml index d98bcd8..5ca9607 100644 --- a/framework/src/main/resources/mapper/lmk/CustomerMapper.xml +++ b/framework/src/main/resources/mapper/lmk/CustomerMapper.xml @@ -27,7 +27,7 @@ <result property="experience" column="experience"/> <result property="createTime" column="create_time"/> <result property="blackId" column="blackId"/> - <collection property="customerTagList" ofType="cn.lili.modules.lmk.domain.vo.CustomerTagVO" + <collection property="customerTagList" ofType="cn.lili.modules.lmk.domain.vo.MemberTagVO" select="selectTagByMemberId" column="id" /> @@ -69,7 +69,7 @@ ORDER BY lm.create_time DESC </select> - <select id="selectTagByMemberId" resultType="cn.lili.modules.lmk.domain.vo.CustomerTagVO"> + <select id="selectTagByMemberId" resultType="cn.lili.modules.lmk.domain.vo.MemberTagVO"> SELECT LCT.id, LCT.tag_name, diff --git a/framework/src/main/resources/mapper/lmk/CustomerTagMapper.xml b/framework/src/main/resources/mapper/lmk/CustomerTagMapper.xml deleted file mode 100644 index fe509b3..0000000 --- a/framework/src/main/resources/mapper/lmk/CustomerTagMapper.xml +++ /dev/null @@ -1,51 +0,0 @@ -<?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.id - FROM - lmk_customer_tag LCT - WHERE - LCT.delete_flag = 0 - </select> - -</mapper> diff --git a/framework/src/main/resources/mapper/lmk/GoodsTagMapper.xml b/framework/src/main/resources/mapper/lmk/GoodsTagMapper.xml new file mode 100644 index 0000000..6db5194 --- /dev/null +++ b/framework/src/main/resources/mapper/lmk/GoodsTagMapper.xml @@ -0,0 +1,15 @@ +<?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.GoodsTagMapper"> + + <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> + <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.GoodsTagVO"> + <result column="tag_id" property="tagId"/> + <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> +</mapper> diff --git a/framework/src/main/resources/mapper/lmk/MemberMapper.xml b/framework/src/main/resources/mapper/lmk/MemberMapper.xml new file mode 100644 index 0000000..559581b --- /dev/null +++ b/framework/src/main/resources/mapper/lmk/MemberMapper.xml @@ -0,0 +1,41 @@ +<?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.member.mapper.MemberMapper"> + + <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> + <resultMap id="BaseResultMap" type="cn.lili.modules.member.entity.vo.MemberVO"> + <id column="id" property="id"/> + <result column="username" property="username"/> + <result column="nick_name" property="nickName"/> + <result column="sex" property="sex"/> + <result column="birthday" property="birthday"/> + <result column="region_id" property="regionId"/> + <result column="region" property="region"/> + <result column="mobile" property="mobile"/> + <result column="point" property="point"/> + <result column="total_point" property="totalPoint"/> + <result column="face" property="face"/> + <result column="disabled" property="disabled"/> + <result column="have_store" property="haveStore"/> + <result column="store_id" property="storeId"/> + <result column="open_id" property="openId"/> + <result column="client_enum" property="clientEnum"/> + <result column="last_login_date" property="lastLoginDate"/> + <result column="grade_id" property="gradeId"/> + <result column="experience" property="experience"/> + <collection property="tags" ofType="cn.lili.modules.lmk.domain.vo.MemberTagVO"> + <id column="member_tag_id" property="id"/> + <result column="tag_name" property="tagName"/> + <result column="tag_id" property="tagId"/> + </collection> + + </resultMap> + <select id="getVoById" resultMap="BaseResultMap"> + select m.*, mt.id member_tag_id, mt.tag_name, mt.tag_id + from li_member m + left join lmk_member_tag mt on m.id = mt.member_id and mt.delete_flag = 0 + where m.id = #{id} and m.delete_flag = 0 + </select> + + +</mapper> diff --git a/framework/src/main/resources/mapper/lmk/MemberTagMapper.xml b/framework/src/main/resources/mapper/lmk/MemberTagMapper.xml new file mode 100644 index 0000000..55b6d9a --- /dev/null +++ b/framework/src/main/resources/mapper/lmk/MemberTagMapper.xml @@ -0,0 +1,43 @@ +<?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.MemberTagMapper"> + + <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> + <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.MemberTagVO"> + <result column="tag_id" property="tagId"/> + <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.id + FROM lmk_customer_tag LCT + WHERE LCT.delete_flag = 0 + </select> + +</mapper> diff --git a/framework/src/main/resources/mapper/lmk/TagMapper.xml b/framework/src/main/resources/mapper/lmk/TagMapper.xml index c8ceb7f..64261aa 100644 --- a/framework/src/main/resources/mapper/lmk/TagMapper.xml +++ b/framework/src/main/resources/mapper/lmk/TagMapper.xml @@ -20,7 +20,10 @@ and t.tag_name like concat('%',#{query.tagName},'%') </if> <if test="query.tagTypeId != null and query.tagTypeId != ''"> - and t.tag_type_id like concat('%',#{query.tagTypeId},'%') + and t.tag_type_id = #{query.tagTypeId} + </if> + <if test="query.tagTypeKey != null and query.tagTypeKey != ''"> + and tt.type_key = #{query.tagTypeKey} </if> order by t.sort_num </select> diff --git a/manager-api/src/main/java/cn/lili/controller/lmk/CustomerController.java b/manager-api/src/main/java/cn/lili/controller/lmk/CustomerController.java index 62a9d02..24baa47 100644 --- a/manager-api/src/main/java/cn/lili/controller/lmk/CustomerController.java +++ b/manager-api/src/main/java/cn/lili/controller/lmk/CustomerController.java @@ -1,21 +1,15 @@ 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.MemberTagForm; 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 cn.lili.modules.lmk.service.MemberTagService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -29,8 +23,7 @@ @RequestMapping("/manager/customerManager") public class CustomerController { private final CustomerService customerService; - private final CustomerTagService customerTagService; - private final CustomerTagRefService customerTagRefService; + private final MemberTagService memberTagService; @ApiOperation(value = "鍟嗛摵涓嬫媺鍒楄〃") @GetMapping("/store/selectOption") @@ -52,39 +45,39 @@ @PostMapping("/addTag") @ApiOperation(value = "娣诲姞鏍囩", notes = "娣诲姞鏍囩") - public Result add(@RequestBody @Validated(Add.class) CustomerTagForm form) { - return customerTagService.add(form); + public Result add(@RequestBody @Validated(Add.class) MemberTagForm form) { + return memberTagService.add(form); } @PutMapping("/editTag") @ApiOperation(value = "淇敼鏍囩", notes = "淇敼鏍囩") - public Result update(@RequestBody @Validated(Update.class) CustomerTagForm form) { - return customerTagService.update(form); + public Result update(@RequestBody @Validated(Update.class) MemberTagForm form) { + return memberTagService.update(form); } @DeleteMapping("/tag/{id}") @ApiOperation(value = "ID鍒犻櫎鏍囩", notes = "ID鍒犻櫎") public Result removeById(@PathVariable("id") String id) { - return customerTagService.removeById(id); + return memberTagService.removeById(id); } @GetMapping("/tagList") @ApiOperation(value = "鏍囩鍒楄〃", notes = "鏍囩鍒楄〃") public Result list() { - return customerTagService.all(); + return memberTagService.all(); } @GetMapping("/pageTagList") @ApiOperation(value = "鍒嗛〉鏍囩鍒楄〃", notes = "鏍囩鍒楄〃") public Result pageList(CustomerTagQuery query) { - return customerTagService.page(query); + return memberTagService.page(query); } @PostMapping("/customerAddTag") @ApiOperation(value = "娣诲姞瀹㈡埛鏍囩鏍囪瘑", notes = "娣诲姞瀹㈡埛鏍囩鏍囪瘑") - public Result addCustomerTag(@RequestBody @Validated(Add.class) CustomerTagForm form) { - return customerTagService.addCustomerTag(form); + public Result addCustomerTag(@RequestBody @Validated(Add.class) MemberTagForm form) { + return memberTagService.addMemberTag(form); } // @PostMapping("/customerAddTag") @@ -93,16 +86,11 @@ // 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); + return memberTagService.removeById(id); } } -- Gitblit v1.8.0