Compare commits
No commits in common. "715174403bdaeb83e2c7abce2642bb0a525c4dbd" and "3b4ff9f774c51332d920769b2bc90a48a5ef53a3" have entirely different histories.
715174403b
...
3b4ff9f774
|
@ -5,7 +5,6 @@ import com.mcwl.common.core.controller.BaseController;
|
||||||
import com.mcwl.common.core.domain.AjaxResult;
|
import com.mcwl.common.core.domain.AjaxResult;
|
||||||
import com.mcwl.common.core.page.TableDataInfo;
|
import com.mcwl.common.core.page.TableDataInfo;
|
||||||
import com.mcwl.common.domain.IdsParam;
|
import com.mcwl.common.domain.IdsParam;
|
||||||
import com.mcwl.common.utils.SecurityUtils;
|
|
||||||
import com.mcwl.resource.domain.MallProduct;
|
import com.mcwl.resource.domain.MallProduct;
|
||||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||||
import com.mcwl.resource.service.MallProductService;
|
import com.mcwl.resource.service.MallProductService;
|
||||||
|
@ -112,7 +111,6 @@ public class MallProductController extends BaseController {
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
public AjaxResult add(@RequestBody MallProduct mallProduct)
|
public AjaxResult add(@RequestBody MallProduct mallProduct)
|
||||||
{
|
{
|
||||||
mallProduct.setUserId(SecurityUtils.getUserId());
|
|
||||||
mallProduct.setCreateBy(getUsername());
|
mallProduct.setCreateBy(getUsername());
|
||||||
return toAjax(mallProductRuleInfoService.insertMallProduct(mallProduct));
|
return toAjax(mallProductRuleInfoService.insertMallProduct(mallProduct));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.mcwl.web.controller.resource;
|
package com.mcwl.web.controller.resource;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.mcwl.common.annotation.RepeatSubmit;
|
|
||||||
import com.mcwl.common.core.domain.AjaxResult;
|
import com.mcwl.common.core.domain.AjaxResult;
|
||||||
import com.mcwl.resource.domain.MallProduct;
|
import com.mcwl.resource.domain.MallProduct;
|
||||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||||
|
@ -23,41 +22,10 @@ public class MallProductLikeController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private MallProductLikeService mallProductLikeService;
|
private MallProductLikeService mallProductLikeService;
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询用户点赞作品列表
|
|
||||||
* @param mallProductVo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/selectByUserLike")
|
@PostMapping("/selectByUserLike")
|
||||||
public AjaxResult selectByUserLike(@RequestBody MallProductVo mallProductVo){
|
public AjaxResult selectByUserLike(@RequestBody MallProductVo mallProductVo){
|
||||||
|
|
||||||
Page<MallProduct> mallProductPage = mallProductLikeService.selectByUserLike(mallProductVo);
|
Page<MallProduct> mallProductPage = mallProductLikeService.selectByUserLike(mallProductVo);
|
||||||
return AjaxResult.success(mallProductPage);
|
return AjaxResult.success(mallProductPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加/删除点赞商品
|
|
||||||
* @param productId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@RepeatSubmit
|
|
||||||
@GetMapping("/addLike")
|
|
||||||
public AjaxResult addLike(@RequestParam Long productId){
|
|
||||||
|
|
||||||
return mallProductLikeService.addLike(productId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查看作品是否点赞
|
|
||||||
* @param productId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/selectLike")
|
|
||||||
public AjaxResult selectLike(@RequestParam Long productId){
|
|
||||||
Boolean aBoolean = mallProductLikeService.selectLike(productId);
|
|
||||||
return AjaxResult.success(aBoolean);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,65 +0,0 @@
|
||||||
package com.mcwl.web.controller.resource;
|
|
||||||
|
|
||||||
import com.mcwl.common.annotation.RepeatSubmit;
|
|
||||||
import com.mcwl.common.core.domain.AjaxResult;
|
|
||||||
import com.mcwl.resource.domain.SysUserInfo;
|
|
||||||
import com.mcwl.resource.service.impl.SysUserAttentionServiceImpl;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关注
|
|
||||||
* @author DaiZibo
|
|
||||||
* @date 2025/1/3
|
|
||||||
* @apiNote
|
|
||||||
*/
|
|
||||||
|
|
||||||
@RequestMapping("/attention")
|
|
||||||
@RestController
|
|
||||||
public class SysUserAttentionController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SysUserAttentionServiceImpl sysUserAttentionService;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加/取消关注
|
|
||||||
* @param userId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@RepeatSubmit
|
|
||||||
@GetMapping("/addAttention")
|
|
||||||
public AjaxResult addAttention(@RequestParam Long userId) {
|
|
||||||
|
|
||||||
return sysUserAttentionService.addAttention(userId);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*查询是否关注用户
|
|
||||||
* @param userId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/selectAttention")
|
|
||||||
public AjaxResult selectAttention(@RequestParam Long userId) {
|
|
||||||
|
|
||||||
Boolean aBoolean = sysUserAttentionService.selectAttention(userId);
|
|
||||||
|
|
||||||
return AjaxResult.success(aBoolean);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询个人粉丝,关注,下载量,喜欢
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/selectUserInfo")
|
|
||||||
public AjaxResult selectUserInfo(){
|
|
||||||
|
|
||||||
SysUserInfo sysUserInfo = sysUserAttentionService.selectUserInfo();
|
|
||||||
|
|
||||||
return AjaxResult.success(sysUserInfo);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -247,26 +247,4 @@ public class SysUserController extends BaseController
|
||||||
{
|
{
|
||||||
return success(deptService.selectDeptTreeList(dept));
|
return success(deptService.selectDeptTreeList(dept));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询个人信息
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/selectUserById")
|
|
||||||
public AjaxResult selectUserById(){
|
|
||||||
SysUser sysUser = userService.selectUserInfoById(SecurityUtils.getUserId());
|
|
||||||
return success(sysUser);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改用户信息
|
|
||||||
* @param sysUser
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/updateUserInfo")
|
|
||||||
public AjaxResult updateUserInfo(@RequestBody SysUser sysUser){
|
|
||||||
|
|
||||||
userService.updateUserInfo(sysUser);
|
|
||||||
return AjaxResult.success("修改成功");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,58 +1,76 @@
|
||||||
//package com.mcwl.memberCenter;
|
package com.mcwl.memberCenter;
|
||||||
//
|
|
||||||
//import com.mcwl.McWlApplication;
|
import com.mcwl.McWlApplication;
|
||||||
//import com.mcwl.common.utils.ShareCodeUtils;
|
import com.mcwl.common.core.domain.AjaxResult;
|
||||||
//import com.mcwl.memberCenter.consumer.EmptyPointsRemindConsumer;
|
import com.mcwl.memberCenter.consumer.EmptyPointsRemindConsumer;
|
||||||
//import com.mcwl.memberCenter.domain.UserMember;
|
import com.mcwl.memberCenter.service.MemberLevelService;
|
||||||
//import com.mcwl.memberCenter.service.MemberService;
|
import com.mcwl.memberCenter.service.MemberService;
|
||||||
//import com.mcwl.memberCenter.service.UserMemberService;
|
import com.mcwl.memberCenter.task.UserMemberTask;
|
||||||
//import com.mcwl.memberCenter.task.UserMemberTask;
|
import com.mcwl.web.controller.memberCenter.MemberController;
|
||||||
//import org.junit.Test;
|
import com.mcwl.web.controller.memberCenter.MemberLevelController;
|
||||||
//import org.junit.runner.RunWith;
|
import org.junit.Test;
|
||||||
//import org.springframework.beans.factory.annotation.Autowired;
|
import org.junit.runner.RunWith;
|
||||||
//import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
//import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
//
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
//@RunWith(SpringRunner.class)
|
|
||||||
//@SpringBootTest(classes = McWlApplication.class)
|
@RunWith(SpringRunner.class)
|
||||||
//public class MemberTest {
|
@SpringBootTest(classes = McWlApplication.class)
|
||||||
//
|
public class MemberCenterTest {
|
||||||
//
|
|
||||||
// @Autowired
|
|
||||||
// private MemberService memberService;
|
@Autowired
|
||||||
//
|
private MemberLevelService memberLevelService;
|
||||||
// @Autowired
|
|
||||||
// private UserMemberService userMemberService;
|
@Autowired
|
||||||
//
|
private MemberController memberController;
|
||||||
// @Autowired
|
|
||||||
// private UserMemberTask userMemberTask;
|
@Autowired
|
||||||
//
|
private MemberService memberService;
|
||||||
// @Autowired
|
|
||||||
// private EmptyPointsRemindConsumer emptyPointsRemindConsumer;
|
@Autowired
|
||||||
// @Test
|
private UserMemberTask userMemberTask;
|
||||||
// public void createUserMember() {
|
|
||||||
// System.out.println(userMemberService.createUserMember(1L, 1013L, "wechat"));
|
@Autowired
|
||||||
// }
|
private MemberLevelController memberLevelController;
|
||||||
//
|
|
||||||
// @Test
|
@Autowired
|
||||||
// public void emptyPointsTaskTest() {
|
private EmptyPointsRemindConsumer emptyPointsRemindConsumer;
|
||||||
// userMemberTask.emptyPointsTsk();
|
@Test
|
||||||
// }
|
public void createUserMember() {
|
||||||
//
|
System.out.println(memberService.createUserMember(1L, 1013L, "wechat"));
|
||||||
// @Test
|
}
|
||||||
// public void updateSubscriptionStatusTaskTest() {
|
|
||||||
// userMemberTask.updateSubscriptionStatusTask();
|
@Test
|
||||||
// }
|
public void emptyPointsTaskTest() {
|
||||||
//
|
userMemberTask.emptyPointsTsk();
|
||||||
// @Test
|
}
|
||||||
// public void emptyPointsRemindTaskTst() {
|
|
||||||
//
|
@Test
|
||||||
// userMemberTask.emptyPointsRemindTask();
|
public void updateSubscriptionStatusTaskTest() {
|
||||||
// }
|
userMemberTask.updateSubscriptionStatusTask();
|
||||||
//
|
}
|
||||||
// @Test
|
|
||||||
// public void memberServiceTest() {
|
@Test
|
||||||
// System.out.println(memberService.list());
|
public void emptyPointsRemindTaskTst() {
|
||||||
// }
|
|
||||||
//
|
userMemberTask.emptyPointsRemindTask();
|
||||||
//}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void memberServiceTest() {
|
||||||
|
System.out.println(memberLevelService.list());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getPointsTest() {
|
||||||
|
AjaxResult points = memberController.getPoints(1L);
|
||||||
|
System.out.println("points = " + points);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getMemberLevelListTest() {
|
||||||
|
System.out.println("memberLevelController.getMemberBenefitList() = " + memberLevelController.getMemberBenefitList());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
package com.mcwl.common.core.domain.entity;
|
package com.mcwl.common.core.domain.entity;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.mcwl.common.annotation.Excel;
|
import com.mcwl.common.annotation.Excel;
|
||||||
import com.mcwl.common.annotation.Excel.ColumnType;
|
import com.mcwl.common.annotation.Excel.ColumnType;
|
||||||
import com.mcwl.common.annotation.Excel.Type;
|
import com.mcwl.common.annotation.Excel.Type;
|
||||||
|
@ -7,19 +12,11 @@ import com.mcwl.common.annotation.Excels;
|
||||||
import com.mcwl.common.core.domain.BaseEntity;
|
import com.mcwl.common.core.domain.BaseEntity;
|
||||||
import com.mcwl.common.xss.Xss;
|
import com.mcwl.common.xss.Xss;
|
||||||
|
|
||||||
import javax.validation.constraints.Email;
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import javax.validation.constraints.Size;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户对象 sys_user
|
* 用户对象 sys_user
|
||||||
*
|
*
|
||||||
* @author mcwl
|
* @author mcwl
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class SysUser extends BaseEntity
|
public class SysUser extends BaseEntity
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -92,9 +89,6 @@ public class SysUser extends BaseEntity
|
||||||
/** 角色ID */
|
/** 角色ID */
|
||||||
private Long roleId;
|
private Long roleId;
|
||||||
|
|
||||||
/** 简介 */
|
|
||||||
private String brief;
|
|
||||||
|
|
||||||
public SysUser()
|
public SysUser()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -303,36 +297,28 @@ public class SysUser extends BaseEntity
|
||||||
this.roleId = roleId;
|
this.roleId = roleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBrief() {
|
|
||||||
return brief;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBrief(String brief) {
|
|
||||||
this.brief = brief;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "SysUser{" +
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
"userId=" + userId +
|
.append("userId", getUserId())
|
||||||
", deptId=" + deptId +
|
.append("deptId", getDeptId())
|
||||||
", userName='" + userName + '\'' +
|
.append("userName", getUserName())
|
||||||
", nickName='" + nickName + '\'' +
|
.append("nickName", getNickName())
|
||||||
", email='" + email + '\'' +
|
.append("email", getEmail())
|
||||||
", phonenumber='" + phonenumber + '\'' +
|
.append("phonenumber", getPhonenumber())
|
||||||
", sex='" + sex + '\'' +
|
.append("sex", getSex())
|
||||||
", avatar='" + avatar + '\'' +
|
.append("avatar", getAvatar())
|
||||||
", password='" + password + '\'' +
|
.append("password", getPassword())
|
||||||
", status='" + status + '\'' +
|
.append("status", getStatus())
|
||||||
", delFlag='" + delFlag + '\'' +
|
.append("delFlag", getDelFlag())
|
||||||
", loginIp='" + loginIp + '\'' +
|
.append("loginIp", getLoginIp())
|
||||||
", loginDate=" + loginDate +
|
.append("loginDate", getLoginDate())
|
||||||
", dept=" + dept +
|
.append("createBy", getCreateBy())
|
||||||
", roles=" + roles +
|
.append("createTime", getCreateTime())
|
||||||
", roleIds=" + Arrays.toString(roleIds) +
|
.append("updateBy", getUpdateBy())
|
||||||
", postIds=" + Arrays.toString(postIds) +
|
.append("updateTime", getUpdateTime())
|
||||||
", roleId=" + roleId +
|
.append("remark", getRemark())
|
||||||
", brief='" + brief + '\'' +
|
.append("dept", getDept())
|
||||||
'}';
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class MallProduct extends BaseEntity {
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态(0全部 1未审核 2公开 3隐私 4未通过)
|
* 状态(0未审核 1公开 2隐私 3未通过)
|
||||||
*/
|
*/
|
||||||
private String status;
|
private String status;
|
||||||
/**
|
/**
|
||||||
|
@ -71,9 +71,6 @@ public class MallProduct extends BaseEntity {
|
||||||
*/
|
*/
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
|
|
||||||
/**
|
|
||||||
* 下载次数
|
|
||||||
*/
|
|
||||||
private Long number;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
package com.mcwl.resource.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关注表
|
|
||||||
*
|
|
||||||
* @author DaiZibo
|
|
||||||
* @date 2025/1/3
|
|
||||||
* @apiNote
|
|
||||||
*/
|
|
||||||
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Builder
|
|
||||||
@Data
|
|
||||||
public class SysUserAttention {
|
|
||||||
|
|
||||||
@TableId
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
private Long toUserId;
|
|
||||||
|
|
||||||
private String createName;
|
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private Date createTime;
|
|
||||||
}
|
|
|
@ -1,40 +0,0 @@
|
||||||
package com.mcwl.resource.domain;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 个人主页展示(关注,粉丝,下载量...)
|
|
||||||
* @author DaiZibo
|
|
||||||
* @date 2025/1/3
|
|
||||||
* @apiNote
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Data
|
|
||||||
public class SysUserInfo {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关注
|
|
||||||
*/
|
|
||||||
private Long attention = 0L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 粉丝
|
|
||||||
*/
|
|
||||||
private Long bean = 0L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下载次数
|
|
||||||
*/
|
|
||||||
private Long download = 0L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 点赞次数
|
|
||||||
*/
|
|
||||||
private Long likeCount = 0L;
|
|
||||||
}
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.mcwl.resource.mapper;
|
package com.mcwl.resource.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.mcwl.resource.domain.MallProductLike;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
@ -14,14 +12,7 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface MallProductLikeMapper extends BaseMapper<MallProductLike> {
|
public interface MallProductLikeMapper {
|
||||||
List<Long> selectByUserId(@Param("userId") Long userId);
|
List<Long> selectByUserId(@Param("userId") Long userId);
|
||||||
|
|
||||||
MallProductLike selectByUserIdAndProductId(@Param("userId") Long userId, @Param("productId") Long productId);
|
|
||||||
|
|
||||||
void deleteByUserIdAndProductId(@Param("productId") Long productId, @Param("userId") Long userId);
|
|
||||||
|
|
||||||
Long countLike(@Param("userId") Long userId);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,4 @@ import org.apache.ibatis.annotations.Param;
|
||||||
public interface MallProductMapper extends BaseMapper<MallProduct> {
|
public interface MallProductMapper extends BaseMapper<MallProduct> {
|
||||||
String selectMallProductById(@Param("mallProductId") Long mallProductId);
|
String selectMallProductById(@Param("mallProductId") Long mallProductId);
|
||||||
|
|
||||||
Long sumNumber(@Param("userId") Long userId);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
package com.mcwl.resource.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.mcwl.resource.domain.SysUserAttention;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DaiZibo
|
|
||||||
* @date 2025/1/3
|
|
||||||
* @apiNote
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface SysUserAttentionMapper extends BaseMapper<SysUserAttention> {
|
|
||||||
SysUserAttention selectAttention(@Param("userId") Long userId, @Param("toUserId") Long toUserId);
|
|
||||||
|
|
||||||
void deleteByUserId(@Param("userId") Long userId, @Param("toUserId") Long toUserId);
|
|
||||||
|
|
||||||
Long selectBean(@Param("userId") Long userId);
|
|
||||||
|
|
||||||
Long selectAttentionCount(@Param("userId") Long userId);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.mcwl.resource.service;
|
package com.mcwl.resource.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.mcwl.common.core.domain.AjaxResult;
|
|
||||||
import com.mcwl.resource.domain.MallProduct;
|
import com.mcwl.resource.domain.MallProduct;
|
||||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||||
|
|
||||||
|
@ -13,10 +12,4 @@ import com.mcwl.resource.domain.vo.MallProductVo;
|
||||||
|
|
||||||
public interface MallProductLikeService {
|
public interface MallProductLikeService {
|
||||||
Page<MallProduct> selectByUserLike(MallProductVo mallProductVo);
|
Page<MallProduct> selectByUserLike(MallProductVo mallProductVo);
|
||||||
|
|
||||||
AjaxResult addLike(Long productId);
|
|
||||||
|
|
||||||
AjaxResult deleteLike(Long productId);
|
|
||||||
|
|
||||||
Boolean selectLike(Long productId);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
package com.mcwl.resource.service;
|
|
||||||
|
|
||||||
import com.mcwl.common.core.domain.AjaxResult;
|
|
||||||
import com.mcwl.resource.domain.SysUserInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关注表 业务层
|
|
||||||
* @author DaiZibo
|
|
||||||
* @date 2025/1/3
|
|
||||||
* @apiNote
|
|
||||||
*/
|
|
||||||
|
|
||||||
public interface SysUserAttentionService {
|
|
||||||
AjaxResult addAttention(Long userId);
|
|
||||||
|
|
||||||
Boolean selectAttention(Long userId);
|
|
||||||
|
|
||||||
SysUserInfo selectUserInfo();
|
|
||||||
}
|
|
|
@ -1,10 +1,8 @@
|
||||||
package com.mcwl.resource.service.impl;
|
package com.mcwl.resource.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.mcwl.common.core.domain.AjaxResult;
|
|
||||||
import com.mcwl.common.utils.SecurityUtils;
|
import com.mcwl.common.utils.SecurityUtils;
|
||||||
import com.mcwl.resource.domain.MallProduct;
|
import com.mcwl.resource.domain.MallProduct;
|
||||||
import com.mcwl.resource.domain.MallProductLike;
|
|
||||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||||
import com.mcwl.resource.mapper.MallProductLikeMapper;
|
import com.mcwl.resource.mapper.MallProductLikeMapper;
|
||||||
import com.mcwl.resource.service.MallProductLikeService;
|
import com.mcwl.resource.service.MallProductLikeService;
|
||||||
|
@ -12,7 +10,6 @@ import com.mcwl.resource.service.MallProductService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,49 +35,6 @@ public class MallProductLikeServiceImpl implements MallProductLikeService {
|
||||||
List<Long> list = mallProductLikeMapper.selectByUserId(userId);
|
List<Long> list = mallProductLikeMapper.selectByUserId(userId);
|
||||||
|
|
||||||
//分页查询作品数据
|
//分页查询作品数据
|
||||||
return mallProductService.pageLike(mallProductVo, list);
|
return mallProductService.pageLike(mallProductVo,list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public AjaxResult addLike(Long productId) {
|
|
||||||
|
|
||||||
Boolean aBoolean = selectLike(productId);
|
|
||||||
if (aBoolean == true){
|
|
||||||
//删除点赞记录
|
|
||||||
mallProductLikeMapper.deleteByUserIdAndProductId(productId,SecurityUtils.getUserId());
|
|
||||||
return AjaxResult.success(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
MallProductLike mallProductLike = MallProductLike.builder().productId(productId)
|
|
||||||
.userId(SecurityUtils.getUserId())
|
|
||||||
.createName(SecurityUtils.getUsername())
|
|
||||||
.createTime(new Date()).build();
|
|
||||||
|
|
||||||
int insert = mallProductLikeMapper.insert(mallProductLike);
|
|
||||||
|
|
||||||
if (insert<0){
|
|
||||||
|
|
||||||
return AjaxResult.error("点赞失败",false);
|
|
||||||
}
|
|
||||||
return AjaxResult.success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AjaxResult deleteLike(Long productId) {
|
|
||||||
|
|
||||||
return AjaxResult.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean selectLike(Long productId) {
|
|
||||||
|
|
||||||
MallProductLike mallProductLike1 = mallProductLikeMapper.selectByUserIdAndProductId(SecurityUtils.getUserId(),productId);
|
|
||||||
|
|
||||||
if (mallProductLike1 == null){
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class MallProductServiceImpl extends ServiceImpl<MallProductMapper,MallPr
|
||||||
if (mallProductVo.getOrder() == 1){
|
if (mallProductVo.getOrder() == 1){
|
||||||
mallProductLambdaQueryWrapper.orderByDesc(MallProduct::getProductId);
|
mallProductLambdaQueryWrapper.orderByDesc(MallProduct::getProductId);
|
||||||
}else {
|
}else {
|
||||||
mallProductLambdaQueryWrapper.orderByDesc(MallProduct::getNumber);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 开始时间和结束时间过滤
|
// 开始时间和结束时间过滤
|
||||||
|
@ -107,12 +107,6 @@ public class MallProductServiceImpl extends ServiceImpl<MallProductMapper,MallPr
|
||||||
LambdaQueryWrapper<MallProduct> mallProductLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<MallProduct> mallProductLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
mallProductLambdaQueryWrapper.in(MallProduct::getProductId,list);
|
mallProductLambdaQueryWrapper.in(MallProduct::getProductId,list);
|
||||||
|
|
||||||
if (mallProductVo.getOrder() == 1){
|
|
||||||
mallProductLambdaQueryWrapper.orderByDesc(MallProduct::getProductId);
|
|
||||||
}else {
|
|
||||||
mallProductLambdaQueryWrapper.orderByDesc(MallProduct::getNumber);
|
|
||||||
}
|
|
||||||
|
|
||||||
return postMapper.selectPage(mallProductPage,mallProductLambdaQueryWrapper);
|
return postMapper.selectPage(mallProductPage,mallProductLambdaQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,80 +0,0 @@
|
||||||
package com.mcwl.resource.service.impl;
|
|
||||||
|
|
||||||
import com.mcwl.common.core.domain.AjaxResult;
|
|
||||||
import com.mcwl.common.utils.SecurityUtils;
|
|
||||||
import com.mcwl.resource.domain.SysUserAttention;
|
|
||||||
import com.mcwl.resource.domain.SysUserInfo;
|
|
||||||
import com.mcwl.resource.mapper.MallProductLikeMapper;
|
|
||||||
import com.mcwl.resource.mapper.MallProductMapper;
|
|
||||||
import com.mcwl.resource.mapper.SysUserAttentionMapper;
|
|
||||||
import com.mcwl.resource.service.SysUserAttentionService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关注表 业务实现层
|
|
||||||
*
|
|
||||||
* @author DaiZibo
|
|
||||||
* @date 2025/1/3
|
|
||||||
* @apiNote
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class SysUserAttentionServiceImpl implements SysUserAttentionService {
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private MallProductMapper mallProductMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private MallProductLikeMapper mallProductLikeMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SysUserAttentionMapper sysUserAttentionMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AjaxResult addAttention(Long userId) {
|
|
||||||
|
|
||||||
//查看是否已关注
|
|
||||||
Boolean aBoolean = selectAttention(userId);
|
|
||||||
if (aBoolean == true){
|
|
||||||
//取关
|
|
||||||
sysUserAttentionMapper.deleteByUserId(SecurityUtils.getUserId(),userId);
|
|
||||||
return AjaxResult.success(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
//关注
|
|
||||||
SysUserAttention sysUserAttention = SysUserAttention.builder().userId(SecurityUtils.getUserId())
|
|
||||||
.toUserId(userId)
|
|
||||||
.createName(SecurityUtils.getUsername())
|
|
||||||
.createTime(new Date())
|
|
||||||
.build();
|
|
||||||
sysUserAttentionMapper.insert(sysUserAttention);
|
|
||||||
return AjaxResult.success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean selectAttention(Long userId) {
|
|
||||||
|
|
||||||
SysUserAttention sysUserAttention = sysUserAttentionMapper.selectAttention(SecurityUtils.getUserId(),userId);
|
|
||||||
|
|
||||||
if (sysUserAttention == null){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SysUserInfo selectUserInfo() {
|
|
||||||
|
|
||||||
Long userId = SecurityUtils.getUserId();
|
|
||||||
|
|
||||||
return SysUserInfo.builder().bean(sysUserAttentionMapper.selectBean(userId))
|
|
||||||
.download(mallProductMapper.sumNumber(userId))
|
|
||||||
.likeCount(mallProductLikeMapper.countLike(userId))
|
|
||||||
.attention(sysUserAttentionMapper.selectAttentionCount(userId)).build();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,20 +3,9 @@
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.mcwl.resource.mapper.MallProductLikeMapper">
|
<mapper namespace="com.mcwl.resource.mapper.MallProductLikeMapper">
|
||||||
<delete id="deleteByUserIdAndProductId">
|
|
||||||
delete from mall_product_like where user_id = #{userId} and product_id = #{productId}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
|
|
||||||
<select id="selectByUserId" resultType="java.lang.Long">
|
<select id="selectByUserId" resultType="java.lang.Long">
|
||||||
select product_id FROM mall_product_like WHERE user_id = #{userId}
|
select product_id FROM mall_product_like WHERE user_id = #{userId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectByUserIdAndProductId" resultType="com.mcwl.resource.domain.MallProductLike">
|
|
||||||
select id,user_id,product_id from mall_product_like where user_id = #{userId} and product_id = #{productId}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="countLike" resultType="java.lang.Long">
|
|
||||||
SELECT count(id)likeCount FROM mall_product_like where user_id = #{userId} ORDER BY(user_id);
|
|
||||||
</select>
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -24,8 +24,4 @@
|
||||||
del_flag
|
del_flag
|
||||||
from mall_product where product_id =#{mallProductId}
|
from mall_product where product_id =#{mallProductId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="sumNumber" resultType="java.lang.Long">
|
|
||||||
SELECT sum(number)sum FROM mall_product where user_id = #{userId} ORDER BY(user_id);
|
|
||||||
</select>
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -1,22 +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="com.mcwl.resource.mapper.SysUserAttentionMapper">
|
|
||||||
<delete id="deleteByUserId">
|
|
||||||
delete from sys_user_attention where user_id = #{userId} and to_user_id = #{toUserId}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
|
|
||||||
<select id="selectAttention" resultType="com.mcwl.resource.domain.SysUserAttention">
|
|
||||||
select id,user_id,to_user_id from sys_user_attention where user_id = #{userId} and to_user_id = #{toUserId}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectBean" resultType="java.lang.Long">
|
|
||||||
SELECT count(id)bean FROM sys_user_attention where to_user_id = #{userId} ORDER BY(to_user_id);
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectAttentionCount" resultType="java.lang.Long">
|
|
||||||
SELECT count(id)attention FROM sys_user_attention where user_id = #{userId} ORDER BY(user_id);
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
|
@ -128,8 +128,4 @@ public interface SysUserMapper
|
||||||
|
|
||||||
SysUser selectUserByPhone(@Param("phone") String phone);
|
SysUser selectUserByPhone(@Param("phone") String phone);
|
||||||
|
|
||||||
void updateUserInfo(SysUser sysUser);
|
|
||||||
|
|
||||||
SysUser selectUserInfoById(@Param("userId") Long userId);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,9 +208,4 @@ public interface ISysUserService
|
||||||
SysUser selectUserByPhone(String phone);
|
SysUser selectUserByPhone(String phone);
|
||||||
|
|
||||||
void addUser(String openid,String type,String phone);
|
void addUser(String openid,String type,String phone);
|
||||||
|
|
||||||
void updateUserInfo(SysUser sysUser);
|
|
||||||
|
|
||||||
SysUser selectUserInfoById(Long userId);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -587,18 +587,6 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateUserInfo(SysUser sysUser) {
|
|
||||||
|
|
||||||
userMapper.updateUserInfo(sysUser);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SysUser selectUserInfoById(Long userId) {
|
|
||||||
|
|
||||||
return userMapper.selectUserInfoById(userId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成随机密码
|
* 生成随机密码
|
||||||
* @param length
|
* @param length
|
||||||
|
|
|
@ -147,10 +147,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where u.phonenumber = #{phone} and u.del_flag = '0'
|
where u.phonenumber = #{phone} and u.del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUserInfoById" resultType="com.mcwl.common.core.domain.entity.SysUser">
|
|
||||||
select user_id,avatar,brief,nick_name from sys_user where user_id = #{userId}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||||
insert into sys_user(
|
insert into sys_user(
|
||||||
<if test="userId != null and userId != 0">user_id,</if>
|
<if test="userId != null and userId != 0">user_id,</if>
|
||||||
|
@ -216,13 +212,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
update sys_user set password = #{password} where user_name = #{userName}
|
update sys_user set password = #{password} where user_name = #{userName}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateUserInfo">
|
|
||||||
update sys_user set nick_name = #{nickName},
|
|
||||||
avatar = #{avatar},
|
|
||||||
brief = #{brief}
|
|
||||||
where user_id = #{userId}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<delete id="deleteUserById" parameterType="Long">
|
<delete id="deleteUserById" parameterType="Long">
|
||||||
update sys_user set del_flag = '2' where user_id = #{userId}
|
update sys_user set del_flag = '2' where user_id = #{userId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
Loading…
Reference in New Issue