feat(generator): 优化模板生成逻辑并添加新功能
- 改进 index.tsx 模板,增加智能字段检测和条件性功能生成 - 修复字段注释为空时模板渲染失败的问题 - 添加自动更新 app.config.ts 页面路径的功能 - 新增 ShopArticle相关的实体、Mapper、Service 等代码 - 优化 add.tsx 和 add.config.ts模板,提高用户体验
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
package com.gxwebsoft.shop.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.shop.service.ShopArticleService;
|
||||
import com.gxwebsoft.shop.entity.ShopArticle;
|
||||
import com.gxwebsoft.shop.param.ShopArticleParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品文章控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-08-13 00:28:23
|
||||
*/
|
||||
@Tag(name = "商品文章管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/shop/shop-article")
|
||||
public class ShopArticleController extends BaseController {
|
||||
@Resource
|
||||
private ShopArticleService shopArticleService;
|
||||
|
||||
@Operation(summary = "分页查询商品文章")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<ShopArticle>> page(ShopArticleParam param) {
|
||||
// 使用关联查询
|
||||
return success(shopArticleService.pageRel(param));
|
||||
}
|
||||
|
||||
@Operation(summary = "查询全部商品文章")
|
||||
@GetMapping()
|
||||
public ApiResult<List<ShopArticle>> list(ShopArticleParam param) {
|
||||
// 使用关联查询
|
||||
return success(shopArticleService.listRel(param));
|
||||
}
|
||||
|
||||
@Operation(summary = "根据id查询商品文章")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<ShopArticle> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(shopArticleService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@Operation(summary = "添加商品文章")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody ShopArticle shopArticle) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
shopArticle.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (shopArticleService.save(shopArticle)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@Operation(summary = "修改商品文章")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody ShopArticle shopArticle) {
|
||||
if (shopArticleService.updateById(shopArticle)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@Operation(summary = "删除商品文章")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (shopArticleService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@Operation(summary = "批量添加商品文章")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<ShopArticle> list) {
|
||||
if (shopArticleService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@Operation(summary = "批量修改商品文章")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<ShopArticle> batchParam) {
|
||||
if (batchParam.update(shopArticleService, "article_id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@Operation(summary = "批量删除商品文章")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (shopArticleService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
192
src/main/java/com/gxwebsoft/shop/entity/ShopArticle.java
Normal file
192
src/main/java/com/gxwebsoft/shop/entity/ShopArticle.java
Normal file
@@ -0,0 +1,192 @@
|
||||
package com.gxwebsoft.shop.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 商品文章
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-08-13 00:28:23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(name = "ShopArticle对象", description = "商品文章")
|
||||
public class ShopArticle implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "文章ID")
|
||||
@TableId(value = "article_id", type = IdType.AUTO)
|
||||
private Integer articleId;
|
||||
|
||||
@Schema(description = "文章标题")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "文章类型 0常规 1视频")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "模型")
|
||||
private String model;
|
||||
|
||||
@Schema(description = "详情页模板")
|
||||
private String detail;
|
||||
|
||||
@Schema(description = "文章分类ID")
|
||||
private Integer categoryId;
|
||||
|
||||
@Schema(description = "上级id, 0是顶级")
|
||||
private Integer parentId;
|
||||
|
||||
@Schema(description = "话题")
|
||||
private String topic;
|
||||
|
||||
@Schema(description = "标签")
|
||||
private String tags;
|
||||
|
||||
@Schema(description = "封面图")
|
||||
private String image;
|
||||
|
||||
@Schema(description = "封面图宽")
|
||||
private Integer imageWidth;
|
||||
|
||||
@Schema(description = "封面图高")
|
||||
private Integer imageHeight;
|
||||
|
||||
@Schema(description = "付费金额")
|
||||
private BigDecimal price;
|
||||
|
||||
@Schema(description = "开始时间")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
@Schema(description = "结束时间")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
@Schema(description = "来源")
|
||||
private String source;
|
||||
|
||||
@Schema(description = "产品概述")
|
||||
private String overview;
|
||||
|
||||
@Schema(description = "虚拟阅读量(仅用作展示)")
|
||||
private Integer virtualViews;
|
||||
|
||||
@Schema(description = "实际阅读量")
|
||||
private Integer actualViews;
|
||||
|
||||
@Schema(description = "评分")
|
||||
private BigDecimal rate;
|
||||
|
||||
@Schema(description = "列表显示方式(10小图展示 20大图展示)")
|
||||
private Integer showType;
|
||||
|
||||
@Schema(description = "访问密码")
|
||||
private String password;
|
||||
|
||||
@Schema(description = "可见类型 0所有人 1登录可见 2密码可见")
|
||||
private Integer permission;
|
||||
|
||||
@Schema(description = "发布来源客户端 (APP、H5、小程序等)")
|
||||
private String platform;
|
||||
|
||||
@Schema(description = "文章附件")
|
||||
private String files;
|
||||
|
||||
@Schema(description = "视频地址")
|
||||
private String video;
|
||||
|
||||
@Schema(description = "接受的文件类型")
|
||||
private String accept;
|
||||
|
||||
@Schema(description = "经度")
|
||||
private String longitude;
|
||||
|
||||
@Schema(description = "纬度")
|
||||
private String latitude;
|
||||
|
||||
@Schema(description = "所在省份")
|
||||
private String province;
|
||||
|
||||
@Schema(description = "所在城市")
|
||||
private String city;
|
||||
|
||||
@Schema(description = "所在辖区")
|
||||
private String region;
|
||||
|
||||
@Schema(description = "街道地址")
|
||||
private String address;
|
||||
|
||||
@Schema(description = "点赞数")
|
||||
private Integer likes;
|
||||
|
||||
@Schema(description = "评论数")
|
||||
private Integer commentNumbers;
|
||||
|
||||
@Schema(description = "提醒谁看")
|
||||
private String toUsers;
|
||||
|
||||
@Schema(description = "作者")
|
||||
private String author;
|
||||
|
||||
@Schema(description = "推荐")
|
||||
private Integer recommend;
|
||||
|
||||
@Schema(description = "报名人数")
|
||||
private Integer bmUsers;
|
||||
|
||||
@Schema(description = "用户ID")
|
||||
private Integer userId;
|
||||
|
||||
@Schema(description = "商户ID")
|
||||
private Integer merchantId;
|
||||
|
||||
@Schema(description = "项目ID")
|
||||
private Integer projectId;
|
||||
|
||||
@Schema(description = "语言")
|
||||
private String lang;
|
||||
|
||||
@Schema(description = "关联默认语言的文章ID")
|
||||
private Integer langArticleId;
|
||||
|
||||
@Schema(description = "是否自动翻译")
|
||||
private Boolean translation;
|
||||
|
||||
@Schema(description = "编辑器类型 0 Markdown编辑器 1 富文本编辑器 ")
|
||||
private Boolean editor;
|
||||
|
||||
@Schema(description = "pdf文件地址")
|
||||
private String pdfUrl;
|
||||
|
||||
@Schema(description = "版本号")
|
||||
private Integer version;
|
||||
|
||||
@Schema(description = "排序(数字越小越靠前)")
|
||||
private Integer sortNumber;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String comments;
|
||||
|
||||
@Schema(description = "状态, 0已发布, 1待审核 2已驳回 3违规内容")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@Schema(description = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.shop.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.shop.entity.ShopArticle;
|
||||
import com.gxwebsoft.shop.param.ShopArticleParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品文章Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-08-13 00:28:23
|
||||
*/
|
||||
public interface ShopArticleMapper extends BaseMapper<ShopArticle> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<ShopArticle>
|
||||
*/
|
||||
List<ShopArticle> selectPageRel(@Param("page") IPage<ShopArticle> page,
|
||||
@Param("param") ShopArticleParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<ShopArticle> selectListRel(@Param("param") ShopArticleParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
<?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.gxwebsoft.shop.mapper.ShopArticleMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
FROM shop_article a
|
||||
<where>
|
||||
<if test="param.articleId != null">
|
||||
AND a.article_id = #{param.articleId}
|
||||
</if>
|
||||
<if test="param.title != null">
|
||||
AND a.title LIKE CONCAT('%', #{param.title}, '%')
|
||||
</if>
|
||||
<if test="param.type != null">
|
||||
AND a.type = #{param.type}
|
||||
</if>
|
||||
<if test="param.model != null">
|
||||
AND a.model LIKE CONCAT('%', #{param.model}, '%')
|
||||
</if>
|
||||
<if test="param.detail != null">
|
||||
AND a.detail LIKE CONCAT('%', #{param.detail}, '%')
|
||||
</if>
|
||||
<if test="param.categoryId != null">
|
||||
AND a.category_id = #{param.categoryId}
|
||||
</if>
|
||||
<if test="param.parentId != null">
|
||||
AND a.parent_id = #{param.parentId}
|
||||
</if>
|
||||
<if test="param.topic != null">
|
||||
AND a.topic LIKE CONCAT('%', #{param.topic}, '%')
|
||||
</if>
|
||||
<if test="param.tags != null">
|
||||
AND a.tags LIKE CONCAT('%', #{param.tags}, '%')
|
||||
</if>
|
||||
<if test="param.image != null">
|
||||
AND a.image LIKE CONCAT('%', #{param.image}, '%')
|
||||
</if>
|
||||
<if test="param.imageWidth != null">
|
||||
AND a.image_width = #{param.imageWidth}
|
||||
</if>
|
||||
<if test="param.imageHeight != null">
|
||||
AND a.image_height = #{param.imageHeight}
|
||||
</if>
|
||||
<if test="param.price != null">
|
||||
AND a.price = #{param.price}
|
||||
</if>
|
||||
<if test="param.startTime != null">
|
||||
AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%')
|
||||
</if>
|
||||
<if test="param.endTime != null">
|
||||
AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%')
|
||||
</if>
|
||||
<if test="param.source != null">
|
||||
AND a.source LIKE CONCAT('%', #{param.source}, '%')
|
||||
</if>
|
||||
<if test="param.overview != null">
|
||||
AND a.overview LIKE CONCAT('%', #{param.overview}, '%')
|
||||
</if>
|
||||
<if test="param.virtualViews != null">
|
||||
AND a.virtual_views = #{param.virtualViews}
|
||||
</if>
|
||||
<if test="param.actualViews != null">
|
||||
AND a.actual_views = #{param.actualViews}
|
||||
</if>
|
||||
<if test="param.rate != null">
|
||||
AND a.rate = #{param.rate}
|
||||
</if>
|
||||
<if test="param.showType != null">
|
||||
AND a.show_type = #{param.showType}
|
||||
</if>
|
||||
<if test="param.password != null">
|
||||
AND a.password LIKE CONCAT('%', #{param.password}, '%')
|
||||
</if>
|
||||
<if test="param.permission != null">
|
||||
AND a.permission = #{param.permission}
|
||||
</if>
|
||||
<if test="param.platform != null">
|
||||
AND a.platform LIKE CONCAT('%', #{param.platform}, '%')
|
||||
</if>
|
||||
<if test="param.files != null">
|
||||
AND a.files LIKE CONCAT('%', #{param.files}, '%')
|
||||
</if>
|
||||
<if test="param.video != null">
|
||||
AND a.video LIKE CONCAT('%', #{param.video}, '%')
|
||||
</if>
|
||||
<if test="param.accept != null">
|
||||
AND a.accept LIKE CONCAT('%', #{param.accept}, '%')
|
||||
</if>
|
||||
<if test="param.longitude != null">
|
||||
AND a.longitude LIKE CONCAT('%', #{param.longitude}, '%')
|
||||
</if>
|
||||
<if test="param.latitude != null">
|
||||
AND a.latitude LIKE CONCAT('%', #{param.latitude}, '%')
|
||||
</if>
|
||||
<if test="param.province != null">
|
||||
AND a.province LIKE CONCAT('%', #{param.province}, '%')
|
||||
</if>
|
||||
<if test="param.city != null">
|
||||
AND a.city LIKE CONCAT('%', #{param.city}, '%')
|
||||
</if>
|
||||
<if test="param.region != null">
|
||||
AND a.region LIKE CONCAT('%', #{param.region}, '%')
|
||||
</if>
|
||||
<if test="param.address != null">
|
||||
AND a.address LIKE CONCAT('%', #{param.address}, '%')
|
||||
</if>
|
||||
<if test="param.likes != null">
|
||||
AND a.likes = #{param.likes}
|
||||
</if>
|
||||
<if test="param.commentNumbers != null">
|
||||
AND a.comment_numbers = #{param.commentNumbers}
|
||||
</if>
|
||||
<if test="param.toUsers != null">
|
||||
AND a.to_users LIKE CONCAT('%', #{param.toUsers}, '%')
|
||||
</if>
|
||||
<if test="param.author != null">
|
||||
AND a.author LIKE CONCAT('%', #{param.author}, '%')
|
||||
</if>
|
||||
<if test="param.recommend != null">
|
||||
AND a.recommend = #{param.recommend}
|
||||
</if>
|
||||
<if test="param.bmUsers != null">
|
||||
AND a.bm_users = #{param.bmUsers}
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.merchantId != null">
|
||||
AND a.merchant_id = #{param.merchantId}
|
||||
</if>
|
||||
<if test="param.projectId != null">
|
||||
AND a.project_id = #{param.projectId}
|
||||
</if>
|
||||
<if test="param.lang != null">
|
||||
AND a.lang LIKE CONCAT('%', #{param.lang}, '%')
|
||||
</if>
|
||||
<if test="param.langArticleId != null">
|
||||
AND a.lang_article_id = #{param.langArticleId}
|
||||
</if>
|
||||
<if test="param.translation != null">
|
||||
AND a.translation = #{param.translation}
|
||||
</if>
|
||||
<if test="param.editor != null">
|
||||
AND a.editor = #{param.editor}
|
||||
</if>
|
||||
<if test="param.pdfUrl != null">
|
||||
AND a.pdf_url LIKE CONCAT('%', #{param.pdfUrl}, '%')
|
||||
</if>
|
||||
<if test="param.version != null">
|
||||
AND a.version = #{param.version}
|
||||
</if>
|
||||
<if test="param.sortNumber != null">
|
||||
AND a.sort_number = #{param.sortNumber}
|
||||
</if>
|
||||
<if test="param.comments != null">
|
||||
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
|
||||
</if>
|
||||
<if test="param.status != null">
|
||||
AND a.status = #{param.status}
|
||||
</if>
|
||||
<if test="param.deleted != null">
|
||||
AND a.deleted = #{param.deleted}
|
||||
</if>
|
||||
<if test="param.deleted == null">
|
||||
AND a.deleted = 0
|
||||
</if>
|
||||
<if test="param.createTimeStart != null">
|
||||
AND a.create_time >= #{param.createTimeStart}
|
||||
</if>
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
<if test="param.keywords != null">
|
||||
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.shop.entity.ShopArticle">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.shop.entity.ShopArticle">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
207
src/main/java/com/gxwebsoft/shop/param/ShopArticleParam.java
Normal file
207
src/main/java/com/gxwebsoft/shop/param/ShopArticleParam.java
Normal file
@@ -0,0 +1,207 @@
|
||||
package com.gxwebsoft.shop.param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||
import com.gxwebsoft.common.core.web.BaseParam;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 商品文章查询参数
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-08-13 00:28:23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@Schema(name = "ShopArticleParam对象", description = "商品文章查询参数")
|
||||
public class ShopArticleParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "文章ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer articleId;
|
||||
|
||||
@Schema(description = "文章标题")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "文章类型 0常规 1视频")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "模型")
|
||||
private String model;
|
||||
|
||||
@Schema(description = "详情页模板")
|
||||
private String detail;
|
||||
|
||||
@Schema(description = "文章分类ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer categoryId;
|
||||
|
||||
@Schema(description = "上级id, 0是顶级")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer parentId;
|
||||
|
||||
@Schema(description = "话题")
|
||||
private String topic;
|
||||
|
||||
@Schema(description = "标签")
|
||||
private String tags;
|
||||
|
||||
@Schema(description = "封面图")
|
||||
private String image;
|
||||
|
||||
@Schema(description = "封面图宽")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer imageWidth;
|
||||
|
||||
@Schema(description = "封面图高")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer imageHeight;
|
||||
|
||||
@Schema(description = "付费金额")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private BigDecimal price;
|
||||
|
||||
@Schema(description = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
@Schema(description = "结束时间")
|
||||
private String endTime;
|
||||
|
||||
@Schema(description = "来源")
|
||||
private String source;
|
||||
|
||||
@Schema(description = "产品概述")
|
||||
private String overview;
|
||||
|
||||
@Schema(description = "虚拟阅读量(仅用作展示)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer virtualViews;
|
||||
|
||||
@Schema(description = "实际阅读量")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer actualViews;
|
||||
|
||||
@Schema(description = "评分")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private BigDecimal rate;
|
||||
|
||||
@Schema(description = "列表显示方式(10小图展示 20大图展示)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer showType;
|
||||
|
||||
@Schema(description = "访问密码")
|
||||
private String password;
|
||||
|
||||
@Schema(description = "可见类型 0所有人 1登录可见 2密码可见")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer permission;
|
||||
|
||||
@Schema(description = "发布来源客户端 (APP、H5、小程序等)")
|
||||
private String platform;
|
||||
|
||||
@Schema(description = "文章附件")
|
||||
private String files;
|
||||
|
||||
@Schema(description = "视频地址")
|
||||
private String video;
|
||||
|
||||
@Schema(description = "接受的文件类型")
|
||||
private String accept;
|
||||
|
||||
@Schema(description = "经度")
|
||||
private String longitude;
|
||||
|
||||
@Schema(description = "纬度")
|
||||
private String latitude;
|
||||
|
||||
@Schema(description = "所在省份")
|
||||
private String province;
|
||||
|
||||
@Schema(description = "所在城市")
|
||||
private String city;
|
||||
|
||||
@Schema(description = "所在辖区")
|
||||
private String region;
|
||||
|
||||
@Schema(description = "街道地址")
|
||||
private String address;
|
||||
|
||||
@Schema(description = "点赞数")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer likes;
|
||||
|
||||
@Schema(description = "评论数")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer commentNumbers;
|
||||
|
||||
@Schema(description = "提醒谁看")
|
||||
private String toUsers;
|
||||
|
||||
@Schema(description = "作者")
|
||||
private String author;
|
||||
|
||||
@Schema(description = "推荐")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer recommend;
|
||||
|
||||
@Schema(description = "报名人数")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer bmUsers;
|
||||
|
||||
@Schema(description = "用户ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer userId;
|
||||
|
||||
@Schema(description = "商户ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Long merchantId;
|
||||
|
||||
@Schema(description = "项目ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer projectId;
|
||||
|
||||
@Schema(description = "语言")
|
||||
private String lang;
|
||||
|
||||
@Schema(description = "关联默认语言的文章ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer langArticleId;
|
||||
|
||||
@Schema(description = "是否自动翻译")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Boolean translation;
|
||||
|
||||
@Schema(description = "编辑器类型 0 Markdown编辑器 1 富文本编辑器 ")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Boolean editor;
|
||||
|
||||
@Schema(description = "pdf文件地址")
|
||||
private String pdfUrl;
|
||||
|
||||
@Schema(description = "版本号")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer version;
|
||||
|
||||
@Schema(description = "排序(数字越小越靠前)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer sortNumber;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String comments;
|
||||
|
||||
@Schema(description = "状态, 0已发布, 1待审核 2已驳回 3违规内容")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "是否删除, 0否, 1是")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer deleted;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.gxwebsoft.shop.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.shop.entity.ShopArticle;
|
||||
import com.gxwebsoft.shop.param.ShopArticleParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品文章Service
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-08-13 00:28:23
|
||||
*/
|
||||
public interface ShopArticleService extends IService<ShopArticle> {
|
||||
|
||||
/**
|
||||
* 分页关联查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return PageResult<ShopArticle>
|
||||
*/
|
||||
PageResult<ShopArticle> pageRel(ShopArticleParam param);
|
||||
|
||||
/**
|
||||
* 关联查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<ShopArticle>
|
||||
*/
|
||||
List<ShopArticle> listRel(ShopArticleParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param articleId 文章ID
|
||||
* @return ShopArticle
|
||||
*/
|
||||
ShopArticle getByIdRel(Integer articleId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.gxwebsoft.shop.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.shop.mapper.ShopArticleMapper;
|
||||
import com.gxwebsoft.shop.service.ShopArticleService;
|
||||
import com.gxwebsoft.shop.entity.ShopArticle;
|
||||
import com.gxwebsoft.shop.param.ShopArticleParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品文章Service实现
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-08-13 00:28:23
|
||||
*/
|
||||
@Service
|
||||
public class ShopArticleServiceImpl extends ServiceImpl<ShopArticleMapper, ShopArticle> implements ShopArticleService {
|
||||
|
||||
@Override
|
||||
public PageResult<ShopArticle> pageRel(ShopArticleParam param) {
|
||||
PageParam<ShopArticle, ShopArticleParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
List<ShopArticle> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ShopArticle> listRel(ShopArticleParam param) {
|
||||
List<ShopArticle> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<ShopArticle, ShopArticleParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShopArticle getByIdRel(Integer articleId) {
|
||||
ShopArticleParam param = new ShopArticleParam();
|
||||
param.setArticleId(articleId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user