feat: sp模块
parent
a045ab58b6
commit
72a737eda7
|
@ -20,18 +20,8 @@ public class McWlApplication
|
|||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||
SpringApplication.run(McWlApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 魔创未来启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||
" .-------. ____ __ \n" +
|
||||
" | _ _ \\ \\ \\ / / \n" +
|
||||
" | ( ' ) | \\ _. / ' \n" +
|
||||
" |(_ o _) / _( )_ .' \n" +
|
||||
" | (_,_).' __ ___(_ o _)' \n" +
|
||||
" | |\\ \\ | || |(_,_)' \n" +
|
||||
" | | \\ `' /| `-' / \n" +
|
||||
" | | \\ / \\ / \n" +
|
||||
" ''-' `'-' `-..-' ");
|
||||
System.out.println("(♥◠‿◠)ノ゙ 魔创未来启动成功 ლ(´ڡ`ლ)゙ ");
|
||||
}
|
||||
|
||||
// 序列化枚举值为前端返回值
|
||||
|
|
|
@ -1,77 +0,0 @@
|
|||
package com.mcwl.web.controller.comment;
|
||||
|
||||
|
||||
import com.mcwl.comment.domain.ProductCommentConditionEntity;
|
||||
import com.mcwl.comment.domain.ProductCommentEntity;
|
||||
import com.mcwl.comment.service.impl.CommentServiceImpl;
|
||||
import com.mcwl.common.utils.ResponsePageEntity;
|
||||
import com.mcwl.resource.domain.MallProduct;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
* @Project:McWl
|
||||
* @Package:com.mcwl.web.controller.comment
|
||||
* @Filename:CommentController
|
||||
* @Description TODO
|
||||
* @Date:2025/1/4 18:56
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/comment")
|
||||
public class CommentController {
|
||||
|
||||
@Autowired
|
||||
private CommentServiceImpl commentService;
|
||||
|
||||
/**
|
||||
* 通过id查询商品评论信息
|
||||
*
|
||||
* @param id 系统ID
|
||||
* @return 商品评论信息
|
||||
*/
|
||||
@GetMapping("/findById")
|
||||
public MallProduct findById(Long id) {
|
||||
return commentService.findById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 添加商品评论
|
||||
*
|
||||
* @param productCommentEntity 商品评论实体
|
||||
* @return 影响行数
|
||||
*/
|
||||
@PostMapping("/insert")
|
||||
public int insert(@RequestBody ProductCommentEntity productCommentEntity) {
|
||||
return commentService.insert(productCommentEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品评论
|
||||
*
|
||||
* @param productCommentEntity 商品评论实体
|
||||
* @return 影响行数
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
public int update(@RequestBody ProductCommentEntity productCommentEntity) {
|
||||
return commentService.update(productCommentEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除商品评论
|
||||
*
|
||||
* @param ids 商品评论ID集合
|
||||
* @return 影响行数
|
||||
*/
|
||||
@PostMapping("/deleteByIds")
|
||||
public int deleteByIds(@RequestBody @NotNull List<Long> ids) {
|
||||
return commentService.deleteByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -5,8 +5,7 @@ import com.mcwl.common.core.controller.BaseController;
|
|||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.common.domain.IdsParam;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.resource.domain.MallProduct;
|
||||
import com.mcwl.resource.domain.ModelProduct;
|
||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||
import com.mcwl.resource.service.MallProductService;
|
||||
import com.mcwl.web.controller.common.OssUtil;
|
||||
|
@ -38,6 +37,7 @@ public class MallProductController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* 图片
|
||||
|
@ -86,11 +86,11 @@ public class MallProductController extends BaseController {
|
|||
/**
|
||||
* 查询商品列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(MallProduct sysJob)
|
||||
@PostMapping("/list")
|
||||
public TableDataInfo list(@RequestBody ModelProduct mallProduct)
|
||||
{
|
||||
startPage();
|
||||
List<MallProduct> list = mallProductRuleInfoService.selectMallProductList(sysJob);
|
||||
List<ModelProduct> list = mallProductRuleInfoService.selectMallProductList(mallProduct);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
@ -99,35 +99,33 @@ public class MallProductController extends BaseController {
|
|||
* 获取详细信息
|
||||
*/
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long jobId)
|
||||
public AjaxResult getInfo(@PathVariable("id") Long Id)
|
||||
{
|
||||
return success(mallProductRuleInfoService.selectMallProductById(jobId));
|
||||
return success(mallProductRuleInfoService.getById(Id));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody MallProduct mallProduct)
|
||||
public AjaxResult add(@RequestBody ModelProduct mallProduct)
|
||||
{
|
||||
mallProduct.setUserId(SecurityUtils.getUserId());
|
||||
mallProduct.setCreateBy(getUsername());
|
||||
|
||||
return toAjax(mallProductRuleInfoService.insertMallProduct(mallProduct));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PutMapping("/upda")
|
||||
public AjaxResult edit(@RequestBody MallProduct mallProduct)
|
||||
public AjaxResult edit(@RequestBody ModelProduct mallProduct)
|
||||
{
|
||||
mallProduct.setUpdateBy(getUsername());
|
||||
return toAjax(mallProductRuleInfoService.updateMallProduct(mallProduct));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
|
@ -145,7 +143,7 @@ public class MallProductController extends BaseController {
|
|||
@PostMapping("/selectByUserId")
|
||||
public AjaxResult selectByUserId(@RequestBody MallProductVo mallProductVo){
|
||||
|
||||
Page<MallProduct> mallProductList = mallProductRuleInfoService.selectByUserId(mallProductVo);
|
||||
Page<ModelProduct> mallProductList = mallProductRuleInfoService.selectByUserId(mallProductVo);
|
||||
return AjaxResult.success(mallProductList);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.mcwl.web.controller.resource;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.mcwl.common.annotation.RepeatSubmit;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.resource.domain.MallProduct;
|
||||
import com.mcwl.resource.domain.ModelProduct;
|
||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||
import com.mcwl.resource.service.MallProductLikeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -31,7 +31,7 @@ public class MallProductLikeController {
|
|||
@PostMapping("/selectByUserLike")
|
||||
public AjaxResult selectByUserLike(@RequestBody MallProductVo mallProductVo){
|
||||
|
||||
Page<MallProduct> mallProductPage = mallProductLikeService.selectByUserLike(mallProductVo);
|
||||
Page<ModelProduct> mallProductPage = mallProductLikeService.selectByUserLike(mallProductVo);
|
||||
return AjaxResult.success(mallProductPage);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
package com.mcwl.comment.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mcwl.common.core.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
* @Project:McWl
|
||||
* @Package:com.mcwl.comment.domain
|
||||
* @Filename:Comment
|
||||
* @Description 评论表
|
||||
* @Date:2025/1/4 18:47
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@TableName("mall_product_comment")
|
||||
public class Comment extends BaseEntity {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 父评论ID
|
||||
*/
|
||||
private String parentId;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private String productId;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private String userId;
|
||||
/**
|
||||
* 评论内容
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 评分
|
||||
*/
|
||||
private String rating;
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
package com.mcwl.comment.domain;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品评论查询条件实体
|
||||
*/
|
||||
@Data
|
||||
public class ProductCommentConditionEntity extends RequestConditionEntity {
|
||||
|
||||
/**
|
||||
* ID集合
|
||||
*/
|
||||
private List<Long> idList;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 父评论ID
|
||||
*/
|
||||
private Long parentId;
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 商品ID集合
|
||||
*/
|
||||
private List<Long> productIdList;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 评论内容
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 评分
|
||||
*/
|
||||
private Integer rating;
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
// /**
|
||||
// * 评论类型
|
||||
// */
|
||||
// private Integer type;
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
package com.mcwl.comment.domain;
|
||||
|
||||
import com.mcwl.common.core.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
* @Project:McWl
|
||||
* @Package:com.mcwl.comment.domain
|
||||
* @Filename:ProductCommentEntity
|
||||
* @Description 评论实体
|
||||
* @Date:2025/1/6 13:21
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class ProductCommentEntity extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 父评论ID
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 评论内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 评分
|
||||
*/
|
||||
private Integer rating;
|
||||
|
||||
// /**
|
||||
// * 评论类型
|
||||
// */
|
||||
// private Integer type;
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
package com.mcwl.comment.domain;
|
||||
|
||||
import com.mcwl.common.utils.RequestPageEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 请求条件实体
|
||||
*/
|
||||
@Data
|
||||
public class RequestConditionEntity extends RequestPageEntity {
|
||||
|
||||
|
||||
/**
|
||||
* 创建日期范围
|
||||
*/
|
||||
@ApiModelProperty("创建日期范围")
|
||||
private List<String> betweenTime;
|
||||
|
||||
/**
|
||||
* 创建开始时间
|
||||
*/
|
||||
private String createBeginTime;
|
||||
|
||||
/**
|
||||
* 创建结束时间
|
||||
*/
|
||||
private String createEndTime;
|
||||
|
||||
/**
|
||||
* 自定义excel表头列表
|
||||
*/
|
||||
private List<String> customizeColumnNameList;
|
||||
|
||||
/**
|
||||
* 查询条件
|
||||
*/
|
||||
private String blurry;
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
package com.mcwl.comment.domain;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 分页请求实体
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class RequestPageEntity implements Serializable {
|
||||
|
||||
private static final int DEFAULT_PAGE_SIZE = 10;
|
||||
|
||||
/**
|
||||
* 页码,默认从一页开始
|
||||
*/
|
||||
private Integer pageNo = 1;
|
||||
|
||||
/**
|
||||
* 每页大小,默认一页查询10条数据
|
||||
*/
|
||||
private Integer pageSize = DEFAULT_PAGE_SIZE;
|
||||
|
||||
/**
|
||||
* 排序字段
|
||||
*/
|
||||
private List<String> sortField;
|
||||
|
||||
|
||||
/**
|
||||
* 获取分页开始位置
|
||||
*
|
||||
* @return 分页开始位置
|
||||
*/
|
||||
public Integer getPageBegin() {
|
||||
if (Objects.isNull(this.pageNo) || this.pageNo <= 0) {
|
||||
this.pageNo = 1;
|
||||
}
|
||||
|
||||
if (Objects.isNull(this.pageSize)) {
|
||||
this.pageSize = DEFAULT_PAGE_SIZE;
|
||||
}
|
||||
|
||||
return (this.pageNo - 1) * this.pageSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户自定义排序集合
|
||||
*
|
||||
* @return 排序集合实体
|
||||
*/
|
||||
public String getSortString() {
|
||||
List<String> sortField = this.getSortField();
|
||||
if (CollectionUtil.isEmpty(sortField)) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder sortBuilder = new StringBuilder();
|
||||
for (String field : sortField) {
|
||||
String[] values = field.split(",");
|
||||
sortBuilder.append(String.format("%s %s", values[0], values[1])).append(",");
|
||||
}
|
||||
return sortBuilder.deleteCharAt(sortBuilder.length() - 1).toString();
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
package com.mcwl.comment.mapper;
|
||||
|
||||
|
||||
import com.mcwl.comment.domain.ProductCommentConditionEntity;
|
||||
import com.mcwl.comment.domain.ProductCommentEntity;
|
||||
import com.mcwl.common.web.BaseMapper;
|
||||
import com.mcwl.resource.domain.MallProduct;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
* @Project:McWl
|
||||
* @Package:com.mcwl.comment.mapper
|
||||
* @Filename:CommentMapper
|
||||
* @Description TODO
|
||||
* @Date:2025/1/4 19:04
|
||||
*/
|
||||
public interface CommentMapper extends BaseMapper<ProductCommentEntity, ProductCommentConditionEntity> {
|
||||
|
||||
MallProduct findById(@Param("id") Long id);
|
||||
|
||||
int insert(ProductCommentEntity productCommentEntity);
|
||||
|
||||
int upda(ProductCommentEntity productCommentEntity);
|
||||
|
||||
List<ProductCommentEntity> findByIds(List<Long> ids);
|
||||
|
||||
int deleteByIds(List<Long> ids, ProductCommentEntity productCommentEntity);
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
package com.mcwl.comment.service.impl;
|
||||
|
||||
|
||||
import com.mcwl.comment.domain.ProductCommentConditionEntity;
|
||||
import com.mcwl.comment.domain.ProductCommentEntity;
|
||||
import com.mcwl.comment.mapper.CommentMapper;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.utils.AssertUtil;
|
||||
import com.mcwl.common.utils.FillUserUtil;
|
||||
import com.mcwl.common.utils.ResponsePageEntity;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.common.utils.bean.BaseService;
|
||||
|
||||
import com.mcwl.common.web.BaseMapper;
|
||||
import com.mcwl.resource.domain.MallProduct;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.mcwl.common.utils.SecurityUtils.getUsername;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
* @Project:McWl
|
||||
* @Package:com.mcwl.comment.service.impl
|
||||
* @Filename:CommentServiceImpl
|
||||
* @Description TODO
|
||||
* @Date:2025/1/4 19:04
|
||||
*/
|
||||
@Service
|
||||
public class CommentServiceImpl extends BaseService<ProductCommentEntity, ProductCommentConditionEntity> {
|
||||
|
||||
@Autowired
|
||||
private CommentMapper commentMapper;
|
||||
|
||||
|
||||
public MallProduct findById(Long id) {
|
||||
return commentMapper.findById(id);
|
||||
}
|
||||
|
||||
|
||||
public int insert(ProductCommentEntity productCommentEntity) {
|
||||
// 获取当前用户
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
productCommentEntity.setUserId(userId);
|
||||
productCommentEntity.setCreateBy(getUsername());
|
||||
checkParam(productCommentEntity);
|
||||
return commentMapper.insert(productCommentEntity);
|
||||
}
|
||||
|
||||
|
||||
public int update(ProductCommentEntity productCommentEntity) {
|
||||
// 获取当前用户
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
productCommentEntity.setUserId(userId);
|
||||
productCommentEntity.setUpdateBy(getUsername());
|
||||
checkParam(productCommentEntity);
|
||||
return commentMapper.upda(productCommentEntity);
|
||||
}
|
||||
|
||||
|
||||
public int deleteByIds(List<Long> ids) {
|
||||
List<ProductCommentEntity> entities = commentMapper.findByIds(ids);
|
||||
AssertUtil.notEmpty(entities, "商品评论已被删除");
|
||||
|
||||
ProductCommentEntity entity = new ProductCommentEntity();
|
||||
FillUserUtil.fillUpdateUserInfo(entity);
|
||||
return commentMapper.deleteByIds(ids, entity);
|
||||
}
|
||||
private void checkParam(ProductCommentEntity productCommentEntity) {
|
||||
if (Objects.nonNull(productCommentEntity.getParentId()) && productCommentEntity.getParentId() > 0) {
|
||||
MallProduct productEntity = commentMapper.findById(productCommentEntity.getParentId());
|
||||
AssertUtil.notNull(productEntity, "该父评论在系统中不存在");
|
||||
}
|
||||
|
||||
MallProduct userEntity = commentMapper.findById(productCommentEntity.getUserId());
|
||||
AssertUtil.notNull(userEntity, "该用户在系统中不存在");
|
||||
|
||||
MallProduct productEntity = commentMapper.findById(productCommentEntity.getProductId());
|
||||
AssertUtil.notNull(productEntity, "该商品在系统中不存在");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BaseMapper getBaseMapper() {
|
||||
return commentMapper;
|
||||
}
|
||||
}
|
|
@ -9,67 +9,30 @@
|
|||
values (#{id}, #{parentId}, #{productId}, #{userId}, #{content}, #{rating}, #{createBy}, #{createTime},
|
||||
#{updateBy}, #{updateTime}, #{remark}, #{delFlag})
|
||||
</insert>
|
||||
<update id="upda">
|
||||
update mall_product_comment
|
||||
<set>
|
||||
<if test="parentId != null">
|
||||
parent_id = #{parentId},
|
||||
</if>
|
||||
<if test="productId != null">
|
||||
product_id = #{productId},
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
user_id = #{userId},
|
||||
</if>
|
||||
<if test="content != null">
|
||||
content = #{content},
|
||||
</if>
|
||||
<if test="rating !=null">
|
||||
rating = #{rating},
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
create_by = #{createBy},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
update_by = #{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
remark = #{remark},
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
del_flag = #{delFlag},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="upda"></update>
|
||||
|
||||
<delete id="deleteByIds">
|
||||
delete
|
||||
from mall_product_comment
|
||||
from model
|
||||
where id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<select id="findById" resultType="com.mcwl.resource.domain.MallProduct">
|
||||
select productId,
|
||||
userId,
|
||||
productName,
|
||||
detail,
|
||||
model,
|
||||
amount,
|
||||
status,
|
||||
name,
|
||||
url,
|
||||
zipUrl,
|
||||
delFlag
|
||||
from mall_product
|
||||
<select id="findById" resultType="com.mcwl.resource.domain.ModelProduct">
|
||||
select
|
||||
id,
|
||||
parent_id,
|
||||
product_id,
|
||||
user_id,
|
||||
content,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
remark,
|
||||
del_flag
|
||||
from model
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="findByIds" resultType="com.mcwl.comment.domain.ProductCommentEntity">
|
||||
|
@ -79,7 +42,6 @@
|
|||
product_id,
|
||||
user_id,
|
||||
content,
|
||||
rating,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package com.mcwl.common.constant;
|
||||
|
||||
public class ShopCodeConstants {
|
||||
/**
|
||||
* 模型编号
|
||||
*/
|
||||
public static final String MODEL = "model-";
|
||||
/**
|
||||
* 工作流cf编号
|
||||
*/
|
||||
public static final String CF = "cf-";
|
||||
}
|
|
@ -58,6 +58,9 @@ public class SysUser extends BaseEntity
|
|||
/** 密码 */
|
||||
private String password;
|
||||
|
||||
/** 钱包 */
|
||||
private Long wallet;
|
||||
|
||||
/** 帐号状态(0正常 1停用) */
|
||||
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>${mybatis-plus.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mcwl</groupId>
|
||||
<artifactId>mcwl-system</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -3,7 +3,9 @@ package com.mcwl.pay.service;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.common.domain.IdsParam;
|
||||
import com.mcwl.pay.domain.OrderTrade;
|
||||
import com.mcwl.pay.domain.PaymentResult;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -23,6 +25,4 @@ public interface OrderTradeService extends IService<OrderTrade> {
|
|||
|
||||
int updateMallProduct(OrderTrade orderTrade);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.mcwl.pay.service.impl;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.domain.IdsParam;
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
import com.mcwl.pay.domain.OrderTrade;
|
||||
|
@ -10,11 +11,13 @@ import com.mcwl.pay.domain.PaymentResult;
|
|||
import com.mcwl.pay.domain.enums.PaymentStatus;
|
||||
import com.mcwl.pay.mapper.OrderTradeMapper;
|
||||
import com.mcwl.pay.service.OrderTradeService;
|
||||
import com.mcwl.system.service.impl.SysUserServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
|
@ -27,6 +30,12 @@ import java.util.List;
|
|||
@Service
|
||||
public class OrderTradeServiceImpl extends ServiceImpl<OrderTradeMapper, OrderTrade> implements OrderTradeService {
|
||||
|
||||
@Autowired
|
||||
private SysUserServiceImpl userExtensionService;
|
||||
|
||||
@Autowired
|
||||
private OrderTradeService orderTradeService;
|
||||
|
||||
@Autowired
|
||||
private OrderTradeMapper orderTradeMapper;
|
||||
|
||||
|
@ -73,19 +82,8 @@ public class OrderTradeServiceImpl extends ServiceImpl<OrderTradeMapper, OrderTr
|
|||
|
||||
@Override
|
||||
public int insertMallProduct(OrderTrade orderTrade) {
|
||||
PaymentResult paymentResult = orderTradeMapper.chargeCard(orderTrade.getTotalAmount(), orderTrade.getPaymentMethod());
|
||||
|
||||
if (paymentResult.isSuccess()) {
|
||||
// 支付成功后的处理:更新订单状态、生成激活码、更新用户权限等
|
||||
orderTrade.setOrderStatus(PaymentStatus.COMPLETED.ordinal());
|
||||
|
||||
// 保存订单
|
||||
return orderTradeMapper.insert(orderTrade);
|
||||
} else {
|
||||
// 支付失败处理...
|
||||
orderTrade.setOrderStatus(PaymentStatus.FAILED.ordinal());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -100,5 +98,4 @@ public class OrderTradeServiceImpl extends ServiceImpl<OrderTradeMapper, OrderTr
|
|||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<?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.pay.mapper.OrderTradeMapper">
|
||||
|
||||
|
||||
<update id="chargeCard">
|
||||
|
||||
</update>
|
||||
</mapper>
|
|
@ -0,0 +1,62 @@
|
|||
package com.mcwl.resource.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**图片表
|
||||
* @Author:ChenYan
|
||||
* @Project:McWl
|
||||
* @Package:com.mcwl.resource.domain
|
||||
* @Filename:ModelImage
|
||||
* @Description 图片表
|
||||
* @Date:2025/1/8 19:35
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@TableName("model_image")
|
||||
public class ModelImage {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 图片地址(最多8张,切割)
|
||||
*/
|
||||
private Long image_paths;
|
||||
/**
|
||||
* 是否添加水印
|
||||
*/
|
||||
private Long has_watermark;
|
||||
/**
|
||||
* 是否会员下载
|
||||
*/
|
||||
private Long is_member_download;
|
||||
/**
|
||||
* 是否不可下载
|
||||
*/
|
||||
private Long is_not_downloadable;
|
||||
/**
|
||||
* 是否隐藏生成信息
|
||||
*/
|
||||
private Long hide_gen_info;
|
||||
/**
|
||||
* 图片标题(最多30字)
|
||||
*/
|
||||
private Long title;
|
||||
/**
|
||||
* 图片标签(多个,切割)
|
||||
*/
|
||||
private Long tags;
|
||||
/**
|
||||
* 描述信息(最多500)
|
||||
*/
|
||||
private Long description;
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private Long del_flag;
|
||||
}
|
|
@ -10,70 +10,73 @@ import lombok.NoArgsConstructor;
|
|||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 模型表
|
||||
* @Author:ChenYan
|
||||
* @Project:McWl
|
||||
* @Package:com.mcwl.common.domain.resource
|
||||
* @Filename:MallProduct
|
||||
* @Description TODO
|
||||
* @Description 模型表
|
||||
* @Date:2024/12/30 17:22
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@TableName("mall_product")
|
||||
public class MallProduct extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@TableName("model")
|
||||
public class ModelProduct extends BaseEntity {
|
||||
|
||||
/**
|
||||
* ID
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId
|
||||
private Long productId;
|
||||
private Long id;
|
||||
/**
|
||||
* 用户ID
|
||||
* 名称
|
||||
*/
|
||||
private String modelName;
|
||||
/***
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 商品名称
|
||||
* 模型类型ID
|
||||
*/
|
||||
private String productName;
|
||||
private Long modelTypeId;
|
||||
/**
|
||||
* 商品详情
|
||||
* 垂类
|
||||
*/
|
||||
private String detail;
|
||||
private String category;
|
||||
/**
|
||||
* 商品规格
|
||||
* 功能
|
||||
*/
|
||||
private String model;
|
||||
private String functions;
|
||||
/**
|
||||
* 金额
|
||||
* 标签(最多三个,切割)
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
|
||||
private String tags;
|
||||
/**
|
||||
* 状态(0全部 1未审核 2公开 3隐私 4未通过)
|
||||
* 参与活动
|
||||
*/
|
||||
private String status;
|
||||
private String activityParticipation;
|
||||
/**
|
||||
* 图片名称
|
||||
* 是否原创
|
||||
*/
|
||||
private String name;
|
||||
private Integer isOriginal;
|
||||
/**
|
||||
* 图片url
|
||||
* 原创作者姓名
|
||||
*/
|
||||
private String url;
|
||||
private String originalAuthorName;
|
||||
/**
|
||||
* 图片url
|
||||
* 生图次数
|
||||
*/
|
||||
private String zipUrl;
|
||||
private Integer real;
|
||||
/**
|
||||
* 下载次数
|
||||
*/
|
||||
private Integer number;
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 下载次数
|
||||
*/
|
||||
private Long number;
|
||||
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
package com.mcwl.resource.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mcwl.common.core.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.locationtech.jts.noding.SegmentString;
|
||||
|
||||
/**
|
||||
* 模型版本
|
||||
* @Author:ChenYan
|
||||
* @Project:McWl
|
||||
* @Package:com.mcwl.resource.domain
|
||||
* @Filename:ModelVersion
|
||||
* @Description TODO
|
||||
* @Date:2025/1/8 19:25
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@TableName("model_version")
|
||||
public class ModelVersion extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 版本名称
|
||||
*/
|
||||
private String versionName;
|
||||
/**
|
||||
* 模型类型ID
|
||||
*/
|
||||
private Long modelTypeId;
|
||||
/**
|
||||
* 文件地址
|
||||
*/
|
||||
private String filePath;
|
||||
/**
|
||||
* 版本介绍(富文本编辑)
|
||||
*/
|
||||
private String versionDescription;
|
||||
/**
|
||||
* 触发词
|
||||
*/
|
||||
private String triggerWords;
|
||||
/**
|
||||
* 是否公开
|
||||
*/
|
||||
private Integer isPublic;
|
||||
/**
|
||||
* 是否在线使用
|
||||
*/
|
||||
private Integer isOnlineUse;
|
||||
/**
|
||||
* 允许下载生图
|
||||
*/
|
||||
private Integer allowDownloadImage;
|
||||
/**
|
||||
* 允许在软件旗下使用
|
||||
*/
|
||||
private Integer allowSoftwareUse;
|
||||
/**
|
||||
* 允许进行融合
|
||||
*/
|
||||
private Integer allowFusion;
|
||||
/**
|
||||
* 是否允许商用
|
||||
*/
|
||||
private Integer allowCommercialUse;
|
||||
/**
|
||||
* 是否允许使用
|
||||
*/
|
||||
private Integer allowUsage;
|
||||
/**
|
||||
* 是否为独家模型
|
||||
*/
|
||||
private Integer isExclusiveModel;
|
||||
/**
|
||||
* 示例图片地址(多张使用切割)
|
||||
*/
|
||||
private String sampleImagePaths;
|
||||
/**
|
||||
* 是否隐藏图片生成信息
|
||||
*/
|
||||
private Integer hideImageGenInfo;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.mcwl.resource.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mcwl.common.core.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**活动
|
||||
* @Author:ChenYan
|
||||
* @Project:McWl
|
||||
* @Package:com.mcwl.resource.domain
|
||||
* @Filename:ToActivity
|
||||
* @Description TODO
|
||||
* @Date:2025/1/8 19:23
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@TableName("to_activity")
|
||||
public class ToActivity extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 活动名称
|
||||
*/
|
||||
private String activityName;
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.mcwl.resource.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 工作流表
|
||||
* @Author:ChenYan
|
||||
* @Project:McWl
|
||||
* @Package:com.mcwl.resource.domain
|
||||
* @Filename:WorkFlow
|
||||
* @Description 工作流表
|
||||
* @Version:1.0
|
||||
* @Date:2025/1/8 19:38
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@TableName("work_flow")
|
||||
public class WorkFlow {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 名称(最多30字)
|
||||
*/
|
||||
private String workflowName;
|
||||
/**
|
||||
* 垂类
|
||||
*/
|
||||
private String category;
|
||||
/**
|
||||
* 主题
|
||||
*/
|
||||
private String theme;
|
||||
/**
|
||||
* 风格
|
||||
*/
|
||||
private String style;
|
||||
/**
|
||||
* 功能
|
||||
*/
|
||||
private String functions;
|
||||
/**
|
||||
* 参与活动
|
||||
*/
|
||||
private String activityParticipation;
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String del_flag;
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package com.mcwl.resource.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**工作流版本表
|
||||
* @Author:ChenYan
|
||||
* @Project:McWl
|
||||
* @Package:com.mcwl.resource.domain
|
||||
* @Filename:WorkFlow
|
||||
* @Description TODO
|
||||
* @Date:2025/1/8 19:38
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@TableName("work_flow_version")
|
||||
public class WorkFlowVersion {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 版本名称
|
||||
*/
|
||||
private String versionName;
|
||||
/**
|
||||
* 版本介绍(富文本)
|
||||
*/
|
||||
private String versionDescription;
|
||||
/**
|
||||
* 文件地址
|
||||
*/
|
||||
private String filePath;
|
||||
/**
|
||||
* 图片地址(最多20张,切割)
|
||||
*/
|
||||
private String imagePaths;
|
||||
/**
|
||||
* 是否隐藏图片生成信息
|
||||
*/
|
||||
private String hideGenInfo;
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.mcwl.resource.domain.enums;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
* @Project:McWl
|
||||
* @Package:com.mcwl.resource.domain
|
||||
* @Filename:OrderTypeEnum
|
||||
* @Description TODO
|
||||
* @Date:2025/1/6 19:51
|
||||
*/
|
||||
public enum OrderTypeEnum {
|
||||
TIME("time"), NUM("num");
|
||||
|
||||
private final String name;
|
||||
|
||||
OrderTypeEnum(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
|
@ -1,10 +1,13 @@
|
|||
package com.mcwl.resource.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mcwl.resource.domain.MallProduct;
|
||||
|
||||
import com.mcwl.resource.domain.ModelProduct;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
* @Project:McWl
|
||||
|
@ -14,10 +17,12 @@ import org.apache.ibatis.annotations.Param;
|
|||
* @Date:2024/12/30 18:23
|
||||
*/
|
||||
@Mapper
|
||||
public interface MallProductMapper extends BaseMapper<MallProduct> {
|
||||
public interface MallProductMapper extends BaseMapper<ModelProduct> {
|
||||
|
||||
|
||||
String selectMallProductById(@Param("mallProductId") Long mallProductId);
|
||||
|
||||
Long sumNumber(@Param("userId") Long userId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.mcwl.resource.service;
|
|||
|
||||
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.ModelProduct;
|
||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||
|
||||
/**
|
||||
|
@ -12,7 +12,7 @@ import com.mcwl.resource.domain.vo.MallProductVo;
|
|||
*/
|
||||
|
||||
public interface MallProductLikeService {
|
||||
Page<MallProduct> selectByUserLike(MallProductVo mallProductVo);
|
||||
Page<ModelProduct> selectByUserLike(MallProductVo mallProductVo);
|
||||
|
||||
AjaxResult addLike(Long productId);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.mcwl.resource.service;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.common.domain.IdsParam;
|
||||
import com.mcwl.resource.domain.MallProduct;
|
||||
import com.mcwl.resource.domain.ModelProduct;
|
||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -16,21 +16,23 @@ import java.util.List;
|
|||
* @Description TODO
|
||||
* @Date:2024/12/30 18:20
|
||||
*/
|
||||
public interface MallProductService extends IService<MallProduct> {
|
||||
public interface MallProductService extends IService<ModelProduct> {
|
||||
|
||||
List<MallProduct> selectMallProductList(MallProduct sysJob);
|
||||
|
||||
String selectMallProductById(Long mallProductId);
|
||||
List<ModelProduct> selectMallProductList(ModelProduct sysJob);
|
||||
|
||||
|
||||
int insertMallProduct(MallProduct mallProduct);
|
||||
|
||||
int updateMallProduct(MallProduct mallProduct);
|
||||
|
||||
int insertMallProduct(ModelProduct mallProduct);
|
||||
|
||||
int updateMallProduct(ModelProduct mallProduct);
|
||||
|
||||
|
||||
void deleteMallProductByIds(IdsParam ids);
|
||||
|
||||
Page<MallProduct> selectByUserId(MallProductVo mallProductVo);
|
||||
Page<ModelProduct> selectByUserId(MallProductVo mallProductVo);
|
||||
|
||||
Page<ModelProduct> pageLike(MallProductVo mallProductVo, List<Long> list);
|
||||
|
||||
|
||||
Page<MallProduct> pageLike(MallProductVo mallProductVo, List<Long> list);
|
||||
}
|
||||
|
|
|
@ -3,10 +3,11 @@ package com.mcwl.resource.service.impl;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.resource.domain.MallProduct;
|
||||
import com.mcwl.resource.domain.MallProductLike;
|
||||
import com.mcwl.resource.domain.ModelProduct;
|
||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||
import com.mcwl.resource.mapper.MallProductLikeMapper;
|
||||
import com.mcwl.resource.mapper.MallProductMapper;
|
||||
import com.mcwl.resource.service.MallProductLikeService;
|
||||
import com.mcwl.resource.service.MallProductService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -31,12 +32,11 @@ public class MallProductLikeServiceImpl implements MallProductLikeService {
|
|||
private MallProductService mallProductService;
|
||||
|
||||
@Override
|
||||
public Page<MallProduct> selectByUserLike(MallProductVo mallProductVo) {
|
||||
public Page<ModelProduct> selectByUserLike(MallProductVo mallProductVo) {
|
||||
|
||||
//获取登录人
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
List<Long> list = mallProductLikeMapper.selectByUserId(userId);
|
||||
|
||||
//分页查询作品数据
|
||||
return mallProductService.pageLike(mallProductVo, list);
|
||||
}
|
||||
|
|
|
@ -4,9 +4,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.core.redis.RedisCache;
|
||||
import com.mcwl.common.domain.IdsParam;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.resource.domain.MallProduct;
|
||||
import com.mcwl.resource.domain.ModelProduct;
|
||||
import com.mcwl.resource.mapper.MallProductMapper;
|
||||
import com.mcwl.resource.service.MallProductService;
|
||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||
|
@ -25,33 +26,30 @@ import java.util.List;
|
|||
* @Date:2024/12/30 18:22
|
||||
*/
|
||||
@Service
|
||||
public class MallProductServiceImpl extends ServiceImpl<MallProductMapper,MallProduct> implements MallProductService {
|
||||
public class MallProductServiceImpl extends ServiceImpl<MallProductMapper,ModelProduct> implements MallProductService {
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private MallProductMapper postMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<MallProduct> selectMallProductList(MallProduct mallProduct) {
|
||||
QueryWrapper<MallProduct> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(MallProduct::getProductName, mallProduct.getProductName());
|
||||
queryWrapper.lambda().eq(MallProduct::getName, mallProduct.getName());
|
||||
queryWrapper.lambda().eq(MallProduct::getAmount, mallProduct.getAmount());
|
||||
public List<ModelProduct> selectMallProductList(ModelProduct mallProduct) {
|
||||
QueryWrapper<ModelProduct> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(ModelProduct::getModelName, mallProduct.getModelName());
|
||||
queryWrapper.lambda().eq(ModelProduct::getOriginalAuthorName, mallProduct.getOriginalAuthorName());
|
||||
return postMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String selectMallProductById(Long mallProductId) {
|
||||
return postMapper.selectMallProductById(mallProductId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertMallProduct(MallProduct mallProduct) {
|
||||
public int insertMallProduct(ModelProduct mallProduct) {
|
||||
return postMapper.insert(mallProduct);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateMallProduct(MallProduct mallProduct) {
|
||||
public int updateMallProduct(ModelProduct mallProduct) {
|
||||
return postMapper.updateById(mallProduct);
|
||||
}
|
||||
|
||||
|
@ -61,60 +59,55 @@ public class MallProductServiceImpl extends ServiceImpl<MallProductMapper,MallPr
|
|||
}
|
||||
|
||||
@Override
|
||||
public Page<MallProduct> selectByUserId(MallProductVo mallProductVo) {
|
||||
public Page<ModelProduct> selectByUserId(MallProductVo mallProductVo) {
|
||||
|
||||
// 创建分页对象
|
||||
Page<MallProduct> mallProductPage = new Page<>(mallProductVo.getPageNumber(), mallProductVo.getPageSize());
|
||||
Page<ModelProduct> mallProductPage = new Page<>(mallProductVo.getPageNumber(), mallProductVo.getPageSize());
|
||||
|
||||
//获取当前登录人ID
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
LambdaQueryWrapper<MallProduct> mallProductLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
LambdaQueryWrapper<ModelProduct> mallProductLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
mallProductLambdaQueryWrapper.eq(MallProduct::getUserId,userId);
|
||||
mallProductLambdaQueryWrapper.eq(MallProduct::getDelFlag,0);
|
||||
mallProductLambdaQueryWrapper.eq(ModelProduct::getUserId,userId);
|
||||
mallProductLambdaQueryWrapper.eq(ModelProduct::getDelFlag,0);
|
||||
|
||||
if (mallProductVo.getStatus() != 0){
|
||||
mallProductLambdaQueryWrapper.eq(MallProduct::getStatus,mallProductVo.getStatus());
|
||||
}
|
||||
|
||||
if (mallProductVo.getOrder() == 1){
|
||||
mallProductLambdaQueryWrapper.orderByDesc(MallProduct::getProductId);
|
||||
}else {
|
||||
mallProductLambdaQueryWrapper.orderByDesc(MallProduct::getNumber);
|
||||
}
|
||||
|
||||
// 开始时间和结束时间过滤
|
||||
if (mallProductVo.getStartTime() != null && mallProductVo.getEndTime() != null) {
|
||||
// 查询开始时间和结束时间之间的商品
|
||||
mallProductLambdaQueryWrapper.between(MallProduct::getCreateTime, mallProductVo.getStartTime(), mallProductVo.getEndTime());
|
||||
mallProductLambdaQueryWrapper.between(ModelProduct::getCreateTime, mallProductVo.getStartTime(), mallProductVo.getEndTime());
|
||||
} else if (mallProductVo.getStartTime() != null) {
|
||||
// 只有开始时间,查询大于等于开始时间的商品
|
||||
mallProductLambdaQueryWrapper.ge(MallProduct::getCreateTime, mallProductVo.getStartTime());
|
||||
mallProductLambdaQueryWrapper.ge(ModelProduct::getCreateTime, mallProductVo.getStartTime());
|
||||
} else if (mallProductVo.getEndTime() != null) {
|
||||
// 只有结束时间,查询小于等于结束时间的商品
|
||||
mallProductLambdaQueryWrapper.le(MallProduct::getCreateTime, mallProductVo.getEndTime());
|
||||
mallProductLambdaQueryWrapper.le(ModelProduct::getCreateTime, mallProductVo.getEndTime());
|
||||
}
|
||||
|
||||
return postMapper.selectPage(mallProductPage, mallProductLambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<MallProduct> pageLike(MallProductVo mallProductVo, List<Long> list) {
|
||||
public Page<ModelProduct> pageLike(MallProductVo mallProductVo, List<Long> list) {
|
||||
|
||||
// 创建分页对象
|
||||
Page<MallProduct> mallProductPage = new Page<>(mallProductVo.getPageNumber(), mallProductVo.getPageSize());
|
||||
Page<ModelProduct> mallProductPage = new Page<>(mallProductVo.getPageNumber(), mallProductVo.getPageSize());
|
||||
|
||||
LambdaQueryWrapper<MallProduct> mallProductLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
mallProductLambdaQueryWrapper.in(MallProduct::getProductId,list);
|
||||
LambdaQueryWrapper<ModelProduct> mallProductLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
mallProductLambdaQueryWrapper.in(ModelProduct::getModelTypeId,list);
|
||||
|
||||
if (mallProductVo.getOrder() == 1){
|
||||
mallProductLambdaQueryWrapper.orderByDesc(MallProduct::getProductId);
|
||||
mallProductLambdaQueryWrapper.orderByDesc(ModelProduct::getModelTypeId);
|
||||
}else {
|
||||
mallProductLambdaQueryWrapper.orderByDesc(MallProduct::getNumber);
|
||||
mallProductLambdaQueryWrapper.orderByDesc(ModelProduct::getNumber);
|
||||
}
|
||||
|
||||
return postMapper.selectPage(mallProductPage,mallProductLambdaQueryWrapper);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,27 +5,8 @@
|
|||
<mapper namespace="com.mcwl.resource.mapper.MallProductMapper">
|
||||
|
||||
|
||||
<select id="selectMallProductById" resultType="java.lang.String">
|
||||
select product_id,
|
||||
user_id,
|
||||
product_name,
|
||||
detail,
|
||||
model,
|
||||
amount,
|
||||
name,
|
||||
status,
|
||||
zip_url,
|
||||
url,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
remark,
|
||||
del_flag
|
||||
from mall_product where product_id =#{mallProductId}
|
||||
</select>
|
||||
|
||||
<select id="sumNumber" resultType="java.lang.Long">
|
||||
SELECT sum(number)sum FROM mall_product where user_id = #{userId} ORDER BY(user_id);
|
||||
SELECT sum(number)sum FROM model where user_id = #{userId} ORDER BY(user_id);
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.mcwl.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
@ -132,4 +133,5 @@ public interface SysUserMapper
|
|||
|
||||
SysUser selectUserInfoById(@Param("userId") Long userId);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.mcwl.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mcwl.common.annotation.DataScope;
|
||||
import com.mcwl.common.constant.UserConstants;
|
||||
import com.mcwl.common.core.domain.entity.SysRole;
|
||||
|
@ -617,4 +618,5 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="sex" column="sex"/>
|
||||
<result property="avatar" column="avatar"/>
|
||||
<result property="password" column="password"/>
|
||||
<result property="wallet" column="wallet"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="loginIp" column="login_ip"/>
|
||||
|
@ -47,9 +48,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectUserVo">
|
||||
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
|
||||
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
|
||||
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
|
||||
select u.user_id,
|
||||
u.dept_id,
|
||||
u.user_name,
|
||||
u.nick_name,
|
||||
u.email,
|
||||
u.avatar,
|
||||
u.phonenumber,
|
||||
u.password,
|
||||
u.sex,
|
||||
u.wallet,
|
||||
u.status,
|
||||
u.del_flag,
|
||||
u.login_ip,
|
||||
u.login_date,
|
||||
u.create_by,
|
||||
u.create_time,
|
||||
u.remark,
|
||||
d.dept_id,
|
||||
d.parent_id,
|
||||
d.ancestors,
|
||||
d.dept_name,
|
||||
d.order_num,
|
||||
d.leader,
|
||||
d.status as dept_status,
|
||||
r.role_id,
|
||||
r.role_name,
|
||||
r.role_key,
|
||||
r.role_sort,
|
||||
r.data_scope,
|
||||
r.status as role_status
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
left join sys_user_role ur on u.user_id = ur.user_id
|
||||
|
@ -57,7 +85,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</sql>
|
||||
|
||||
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
|
||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
|
||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status,
|
||||
u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user
|
||||
u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
where u.del_flag = '0'
|
||||
<if test="userId != null and userId != 0">
|
||||
|
@ -79,7 +109,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND date_format(u.create_time,'%Y%m%d') <= date_format(#{params.endTime},'%Y%m%d')
|
||||
</if>
|
||||
<if test="deptId != null and deptId != 0">
|
||||
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
|
||||
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId},
|
||||
ancestors) ))
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
|
@ -109,7 +140,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join sys_user_role ur on u.user_id = ur.user_id
|
||||
left join sys_role r on r.role_id = ur.role_id
|
||||
where u.del_flag = '0' and (r.role_id != #{roleId} or r.role_id IS NULL)
|
||||
and u.user_id not in (select u.user_id from sys_user u inner join sys_user_role ur on u.user_id = ur.user_id and ur.role_id = #{roleId})
|
||||
and u.user_id not in (select u.user_id from sys_user u inner join sys_user_role ur on u.user_id = ur.user_id and
|
||||
ur.role_id = #{roleId})
|
||||
<if test="userName != null and userName != ''">
|
||||
AND u.user_name like concat('%', #{userName}, '%')
|
||||
</if>
|
||||
|
@ -131,15 +163,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="checkUserNameUnique" parameterType="String" resultMap="SysUserResult">
|
||||
select user_id, user_name from sys_user where user_name = #{userName} and del_flag = '0' limit 1
|
||||
select user_id, user_name
|
||||
from sys_user
|
||||
where user_name = #{userName}
|
||||
and del_flag = '0' limit 1
|
||||
</select>
|
||||
|
||||
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
|
||||
select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1
|
||||
select user_id, phonenumber
|
||||
from sys_user
|
||||
where phonenumber = #{phonenumber}
|
||||
and del_flag = '0' limit 1
|
||||
</select>
|
||||
|
||||
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
|
||||
select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1
|
||||
select user_id, email
|
||||
from sys_user
|
||||
where email = #{email}
|
||||
and del_flag = '0' limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectUserByPhone" resultMap="SysUserResult">
|
||||
|
@ -148,7 +189,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</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 user_id, avatar, brief, nick_name
|
||||
from sys_user
|
||||
where user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||
|
@ -162,7 +205,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
|
||||
<if test="sex != null and sex != ''">sex,</if>
|
||||
<if test="password != null and password != ''">password,</if>
|
||||
<if test="wallet != null and wallet != ''">wallet,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
create_time
|
||||
|
@ -176,6 +221,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
|
||||
<if test="sex != null and sex != ''">#{sex},</if>
|
||||
<if test="password != null and password != ''">#{password},</if>
|
||||
<if test="wallet != null and wallet != ''">#{wallet},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
|
@ -194,6 +240,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="sex != null and sex != ''">sex = #{sex},</if>
|
||||
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
|
||||
<if test="password != null and password != ''">password = #{password},</if>
|
||||
<if test="wallet != null and wallet != ''">wallet = #{wallet},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
|
||||
<if test="loginDate != null">login_date = #{loginDate},</if>
|
||||
|
@ -205,26 +252,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</update>
|
||||
|
||||
<update id="updateUserStatus" parameterType="SysUser">
|
||||
update sys_user set status = #{status} where user_id = #{userId}
|
||||
update sys_user
|
||||
set status = #{status}
|
||||
where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<update id="updateUserAvatar" parameterType="SysUser">
|
||||
update sys_user set avatar = #{avatar} where user_name = #{userName}
|
||||
update sys_user
|
||||
set avatar = #{avatar}
|
||||
where user_name = #{userName}
|
||||
</update>
|
||||
|
||||
<update id="resetUserPwd" parameterType="SysUser">
|
||||
update sys_user set password = #{password} where user_name = #{userName}
|
||||
update sys_user
|
||||
set password = #{password}
|
||||
where user_name = #{userName}
|
||||
</update>
|
||||
|
||||
<update id="updateUserInfo">
|
||||
update sys_user set nick_name = #{nickName},
|
||||
update sys_user
|
||||
set nick_name = #{nickName},
|
||||
avatar = #{avatar},
|
||||
brief = #{brief}
|
||||
where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<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 id="deleteUserByIds" parameterType="Long">
|
||||
|
|
Loading…
Reference in New Issue