新增产品公共内容模板
This commit is contained in:
1 parent
4345bef876
commit
f26b663e46
30 files changed
+1069
-18
No files matched your search
@@ -5,7 +5,7 @@ public enum BusinessCodePrefixEnum {
|
||||
SITE("SIT"), DOMAIN("DOM"), PRODUCT("PRD"), SKU("SKU"), CATEGORY("CAT"),
|
||||
PRODUCT_CATEGORY("PCT"), PRODUCT_CATEGORY_RELATION("PCR"), PRODUCT_ATTRIBUTE("PAT"),
|
||||
PRODUCT_ATTRIBUTE_OPTION("PAO"), PRODUCT_ATTRIBUTE_VALUE("PAV"), PRODUCT_SPECIFICATION("PSP"), PRODUCT_MEDIA_RELATION("PMG"),
|
||||
PRODUCT_RELATION("PRR"), CONTENT("CNT"), CONTENT_CATEGORY("CCT"),
|
||||
PRODUCT_RELATION("PRR"), PRODUCT_CONTENT_TEMPLATE("PTM"), CONTENT("CNT"), CONTENT_CATEGORY("CCT"),
|
||||
CONTENT_CATEGORY_RELATION("CCR"), CONTENT_PRODUCT_RELATION("CPR"),
|
||||
CASE("CAS"), NEWS("NWS"), PAGE("PAG"), SERVICE("SRV"), HELP("HLP"),
|
||||
DECORATION("DEC"), CUSTOM_CODE("CCD"), NAVIGATION("NAV"),
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.shoplix.modules.product.enums;
|
||||
|
||||
/** 产品公共内容模板的插入位置。 */
|
||||
public enum ProductTemplatePositionEnum {
|
||||
/** 插入产品独立详情之前。 */
|
||||
BEFORE,
|
||||
/** 插入产品独立详情之后。 */
|
||||
AFTER
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.shoplix.modules.product.repository.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/** 产品公共富文本内容模板持久化实体。 */
|
||||
@Data
|
||||
@TableName("product_content_template")
|
||||
public class ProductContentTemplateEntity {
|
||||
/** 数据库内部主键。 */ @TableId(type = IdType.AUTO) private Long id;
|
||||
/** 产品内容模板业务编号。 */ private String templateCode;
|
||||
/** 所属站点业务编号。 */ private String siteCode;
|
||||
/** 模板名称。 */ private String templateName;
|
||||
/** 模板用途说明。 */ private String description;
|
||||
/** 模板英文富文本内容。 */ private String templateContent;
|
||||
/** 发布状态:DRAFT草稿,PUBLISHED已发布,OFFLINE已下线。 */ private String status;
|
||||
/** 模板排序值。 */ private Integer sortNo;
|
||||
/** 逻辑删除状态:0未删除,1已删除。 */ private Integer deleted;
|
||||
/** 创建时间毫秒时间戳。 */ private Long createTime;
|
||||
/** 更新时间毫秒时间戳。 */ private Long updateTime;
|
||||
}
|
||||
@@ -19,6 +19,8 @@ public class ProductEntity {
|
||||
/** 产品型号。 */ private String model;
|
||||
/** 英文摘要。 */ private String summary;
|
||||
/** 英文详情。 */ private String productContent;
|
||||
/** 关联产品内容模板业务编号。 */ private String contentTemplateCode;
|
||||
/** 模板插入位置:BEFORE详情前,AFTER详情后。 */ private String templatePosition;
|
||||
/** 封面媒体业务编号。 */ private String coverMediaCode;
|
||||
/** 推荐标识。 */ private Integer featuredFlag;
|
||||
/** 询盘启用标识。 */ private Integer inquiryEnabled;
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.shoplix.modules.product.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.shoplix.modules.product.repository.entity.ProductContentTemplateEntity;
|
||||
|
||||
/** 产品内容模板基础 Mapper。 */
|
||||
public interface ProductContentTemplateMapper extends BaseMapper<ProductContentTemplateEntity> {
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package com.shoplix.modules.product.repository.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.shoplix.modules.product.repository.entity.ProductContentTemplateEntity;
|
||||
import com.shoplix.modules.product.repository.mapper.ProductContentTemplateMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/** 产品内容模板单表数据源服务。 */
|
||||
@Service
|
||||
public class ProductContentTemplateRepositoryService {
|
||||
private final ProductContentTemplateMapper mapper;
|
||||
|
||||
/** 注入产品内容模板 Mapper。 */
|
||||
public ProductContentTemplateRepositoryService(ProductContentTemplateMapper mapper) {
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
/** 按站点和模板编号查询未删除模板。 */
|
||||
public Optional<ProductContentTemplateEntity> find(String siteCode, String templateCode) {
|
||||
return Optional.ofNullable(mapper.selectOne(Wrappers.<ProductContentTemplateEntity>lambdaQuery()
|
||||
.eq(ProductContentTemplateEntity::getSiteCode, siteCode)
|
||||
.eq(ProductContentTemplateEntity::getTemplateCode, templateCode)
|
||||
.eq(ProductContentTemplateEntity::getDeleted, 0).last("LIMIT 1")));
|
||||
}
|
||||
|
||||
/** 查询站点全部未删除模板。 */
|
||||
public List<ProductContentTemplateEntity> list(String siteCode) {
|
||||
return mapper.selectList(Wrappers.<ProductContentTemplateEntity>lambdaQuery()
|
||||
.eq(ProductContentTemplateEntity::getSiteCode, siteCode)
|
||||
.eq(ProductContentTemplateEntity::getDeleted, 0)
|
||||
.orderByAsc(ProductContentTemplateEntity::getSortNo)
|
||||
.orderByDesc(ProductContentTemplateEntity::getUpdateTime));
|
||||
}
|
||||
|
||||
/** 查询已发布模板。 */
|
||||
public Optional<ProductContentTemplateEntity> findPublished(String siteCode, String templateCode) {
|
||||
return Optional.ofNullable(mapper.selectOne(Wrappers.<ProductContentTemplateEntity>lambdaQuery()
|
||||
.eq(ProductContentTemplateEntity::getSiteCode, siteCode)
|
||||
.eq(ProductContentTemplateEntity::getTemplateCode, templateCode)
|
||||
.eq(ProductContentTemplateEntity::getStatus, "PUBLISHED")
|
||||
.eq(ProductContentTemplateEntity::getDeleted, 0).last("LIMIT 1")));
|
||||
}
|
||||
|
||||
/** 新增模板。 */ public int insert(ProductContentTemplateEntity entity) { return mapper.insert(entity); }
|
||||
|
||||
/** 按模板业务编号更新模板。 */
|
||||
public int update(ProductContentTemplateEntity entity) {
|
||||
return mapper.update(entity, Wrappers.<ProductContentTemplateEntity>lambdaUpdate()
|
||||
.eq(ProductContentTemplateEntity::getSiteCode, entity.getSiteCode())
|
||||
.eq(ProductContentTemplateEntity::getTemplateCode, entity.getTemplateCode())
|
||||
.eq(ProductContentTemplateEntity::getDeleted, 0));
|
||||
}
|
||||
|
||||
/** 按模板业务编号逻辑删除模板。 */
|
||||
public int delete(String siteCode, String templateCode) {
|
||||
return mapper.update(null, Wrappers.<ProductContentTemplateEntity>lambdaUpdate()
|
||||
.set(ProductContentTemplateEntity::getDeleted, 1)
|
||||
.set(ProductContentTemplateEntity::getUpdateTime, System.currentTimeMillis())
|
||||
.eq(ProductContentTemplateEntity::getSiteCode, siteCode)
|
||||
.eq(ProductContentTemplateEntity::getTemplateCode, templateCode)
|
||||
.eq(ProductContentTemplateEntity::getDeleted, 0));
|
||||
}
|
||||
}
|
||||
+1
@@ -33,6 +33,7 @@ public class ProductRepositoryService {
|
||||
}
|
||||
/** 统计站点全部未删除产品。 */ public long count(String siteCode) { return mapper.selectCount(Wrappers.<ProductEntity>lambdaQuery().eq(ProductEntity::getSiteCode, siteCode).eq(ProductEntity::getDeleted, 0)); }
|
||||
/** 统计站点指定发布状态的产品。 */ public long countByStatus(String siteCode, String status) { return mapper.selectCount(Wrappers.<ProductEntity>lambdaQuery().eq(ProductEntity::getSiteCode, siteCode).eq(ProductEntity::getDeleted, 0).eq(ProductEntity::getStatus, status)); }
|
||||
/** 统计使用指定内容模板的未删除产品。 */ public long countByContentTemplate(String siteCode, String templateCode) { return mapper.selectCount(Wrappers.<ProductEntity>lambdaQuery().eq(ProductEntity::getSiteCode, siteCode).eq(ProductEntity::getContentTemplateCode, templateCode).eq(ProductEntity::getDeleted, 0)); }
|
||||
/** 查询前台已发布产品列表。 */
|
||||
public List<ProductEntity> listPublished(String siteCode, String categoryCode) {
|
||||
var query = Wrappers.<ProductEntity>lambdaQuery().eq(ProductEntity::getSiteCode, siteCode)
|
||||
|
||||
Reference in new issue
Block a user