第七天

cloud-server
刘河平 2024-11-20 01:14:29 +08:00
parent de0bc16a1c
commit 3c231b0b6c
41 changed files with 783 additions and 61 deletions

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.muyu</groupId>
<artifactId>muyu-marketing</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>marketing-common</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-annotation</artifactId>
<version>3.4.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-common-core</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,70 @@
package com.muyu.marketing.domain;
import com.alibaba.ttl.threadpool.agent.internal.javassist.bytecode.AttributeInfo;
import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
import com.muyu.marketing.domain.req.ActivityTeamInfoReq;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.apache.xmlbeans.impl.xb.xsdschema.AttributeGroup;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
import java.util.function.Function;
/**
*
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@TableName("activity_team_info")
@ApiModel(value = "activity_team_info", description = "商品拼团信息")
public class ActivityTeamInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
private Long id;
private String name;
private BigInteger productId;
private String productName;
private String productImage;
private String introduction;
private String unit;
private String imageList;
private String endTime;
private Integer sort;
private String content;
private String status;
private String strategyType;
private BigInteger strategyId;
private String remark;
private String createBy;
private Date createTime;
private String updateBy;
private Date updateTime;
private Integer pageNum=1;
private Integer pageSize=3;
public static ActivityTeamInfo queryBuild(ActivityTeamInfoReq activityTeamInfoReq) {
return ActivityTeamInfo.builder()
.name(activityTeamInfoReq.getName())
.status(activityTeamInfoReq.getStatus())
.build();
}
public static ActivityTeamInfo groupFunBuild (ActivityTeamInfo activityTeamInfo, Function<Long, List<ActivityTeamInfo>> function) {
return ActivityTeamInfo.builder()
.id(activityTeamInfo.getId())
.name(activityTeamInfo.getName())
.status(activityTeamInfo.status)
.build();
}
}

View File

@ -0,0 +1,26 @@
package com.muyu.marketing.domain.req;
import com.muyu.marketing.domain.ActivityTeamInfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ActivityTeamInfoReq extends ActivityTeamInfo {
private static final long serialVersionUID = 1L;
/**
*
*/
@ApiModelProperty(name = "组名称", value = "组名称")
private String name;
/**
*
*/
@ApiModelProperty(name = "状态", value = "状态")
private String states;
}

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.muyu</groupId>
<artifactId>muyu-marketing</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>marketing-remote</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View File

@ -0,0 +1,7 @@
package com.muyu;
public class Main {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}

View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.muyu</groupId>
<artifactId>muyu-marketing</artifactId>
<version>3.6.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>marketing-server</artifactId>
<description>
marketing-server系统模块
</description>
<dependencies>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Swagger UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.fox.version}</version>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<!-- MuYu Common DataSource -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-common-datasource</artifactId>
</dependency>
<!-- MuYu Common DataScope -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-common-datascope</artifactId>
</dependency>
<!-- MuYu Common Log -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-common-log</artifactId>
</dependency>
<!-- MuYu Common Swagger -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-common-swagger</artifactId>
</dependency>
<dependency>
<groupId>com.dtflys.forest</groupId>
<artifactId>forest-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-common-core</artifactId>
</dependency>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>marketing-common</artifactId>
<version>3.6.3</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- 加入maven deploy插件当在deploy时忽略些model-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,22 @@
package com.muyu.marketing;
import com.muyu.common.security.annotation.EnableCustomConfig;
import com.muyu.common.security.annotation.EnableMyFeignClients;
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
*
*
* @author muyu
*/
@EnableCustomConfig
@EnableCustomSwagger2
@EnableMyFeignClients
@SpringBootApplication
public class MuYuMarketingApplication {
public static void main (String[] args) {
SpringApplication.run(MuYuMarketingApplication.class, args);
}
}

View File

@ -0,0 +1,44 @@
package com.muyu.marketing.controller;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.poi.ExcelUtil;
import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.common.log.annotation.Log;
import com.muyu.common.log.enums.BusinessType;
import com.muyu.common.security.annotation.RequiresPermissions;
import com.muyu.marketing.domain.ActivityTeamInfo;
import com.muyu.marketing.domain.req.ActivityTeamInfoReq;
import com.muyu.marketing.service.ActivityTeamInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import static com.muyu.common.core.utils.PageUtils.startPage;
/**
* controller
*/
@Api(tags = "商品拼团信息")
@RestController
@RequestMapping("/activityTeamInfo")
public class ActivityTeamInfoController {
@Autowired
private ActivityTeamInfoService activityTeamInfoService;
/**
*
*/
@ApiModelProperty("获取商品拼团信息列表")
@GetMapping("/list")
public Result<TableDataInfo<ActivityTeamInfo>> list(@RequestBody ActivityTeamInfoReq activityTeamInfoReq) {
return activityTeamInfoService.list(activityTeamInfoReq);
}
}

View File

@ -0,0 +1,10 @@
package com.muyu.marketing.mapper;
import com.muyu.marketing.domain.ActivityTeamInfo;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface ActivityTeamInfoMapper {
List<ActivityTeamInfo> list();
}

View File

@ -0,0 +1,19 @@
package com.muyu.marketing.service;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.marketing.domain.ActivityTeamInfo;
import java.util.List;
public interface ActivityTeamInfoService {
/**
*
* @param activityTeamInfo
* @return
*/
Result list(ActivityTeamInfo activityTeamInfo);
}

View File

@ -0,0 +1,36 @@
package com.muyu.marketing.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.marketing.domain.ActivityTeamInfo;
import com.muyu.marketing.mapper.ActivityTeamInfoMapper;
import com.muyu.marketing.service.ActivityTeamInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
@Slf4j
@Service
public class ActivityTeamInfoServiceImpl implements ActivityTeamInfoService {
@Autowired
private ActivityTeamInfoMapper activityTeamInfoMapper;
@Override
public Result list(ActivityTeamInfo activityTeamInfo) {
PageHelper.startPage(activityTeamInfo.getPageNum(),activityTeamInfo.getPageSize());
List<ActivityTeamInfo> list=activityTeamInfoMapper.list();
PageInfo pageInfo = new PageInfo(list);
return Result.success(pageInfo);
}
}

View File

@ -0,0 +1,2 @@
Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name}

View File

@ -0,0 +1,30 @@
# Tomcat
server:
port: 9209
# Spring
spring:
application:
# 应用名称
name: muyu-marketing
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 113.44.45.42:8848
namespace: e6fc646f-719d-4642-9228-b68fb4ed42aa
config:
# 配置中心地址
server-addr: 113.44.45.42:8848
namespace: e6fc646f-719d-4642-9228-b68fb4ed42aa
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
logging:
level:
com.muyu.system.mapper: DEBUG

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/muyu-system"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.muyu" level="info"/>
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn"/>
<root level="info">
<appender-ref ref="console"/>
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info"/>
<appender-ref ref="file_error"/>
</root>
</configuration>

View File

@ -0,0 +1,10 @@
<?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.muyu.marketing.mapper.ActivityTeamInfoMapper">
<select id="list" resultType="com.muyu.marketing.domain.ActivityTeamInfo">
select * from activity_team_info
</select>
</mapper>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.muyu</groupId>
<artifactId>muyu-modules</artifactId>
<version>3.6.3</version>
</parent>
<packaging>pom</packaging>
<modules>
<module>marketing-remote</module>
<module>marketing-serve</module>
<module>marketing-common</module>
</modules>
<modelVersion>4.0.0</modelVersion>
<artifactId>muyu-marketing</artifactId>
<description>
muyu-modules-system系统模块
</description>
</project>

View File

@ -38,61 +38,86 @@ public class ProjectInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 主键 */
@TableId(value = "id",type = IdType.AUTO)
/**
*
*/
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(name = "主键", value = "主键")
private Long id;
/** 商品名称 */
/**
*
*/
@Excel(name = "商品名称")
@ApiModelProperty(name = "商品名称", value = "商品名称")
private String name;
/** 商品描述 */
/**
*
*/
@Excel(name = "商品描述")
@ApiModelProperty(name = "商品描述", value = "商品描述")
private String introduction;
/** 主类型 */
/**
*
*/
@Excel(name = "主类型")
@ApiModelProperty(name = "主类型", value = "主类型")
private Long mianType;
/** 父类型 */
/**
*
*/
@Excel(name = "父类型")
@ApiModelProperty(name = "父类型", value = "父类型")
private Long parentType;
/** 商品类型 */
/**
*
*/
@Excel(name = "商品类型")
@ApiModelProperty(name = "商品类型", value = "商品类型")
private Long type;
/** 商品图片 */
/**
*
*/
@Excel(name = "商品图片")
@ApiModelProperty(name = "商品图片", value = "商品图片")
private String image;
/** 商品轮播图 */
/**
*
*/
@Excel(name = "商品轮播图")
@ApiModelProperty(name = "商品轮播图", value = "商品轮播图")
private String carouselImages;
/** 商品状态 */
/**
*
*/
@Excel(name = "商品状态")
@ApiModelProperty(name = "商品状态", value = "商品状态")
private String status;
/** 规格 */
/**
*
*/
@Excel(name = "规格")
@ApiModelProperty(name = "规格", value = "规格")
private Long ruleId;
/** 品牌 */
/**
*
*/
@Excel(name = "品牌")
@ApiModelProperty(name = "品牌", value = "品牌")
private Long brandId;
@Excel(name = "备注")
@ApiModelProperty(name = "备注", value = "备注")
private String remark;
@ -105,7 +130,9 @@ public class ProjectInfo extends BaseEntity {
@ApiModelProperty(name = "创建时间", value = "创建时间")
private Date createTime;
/** 品牌 */
/**
*
*/
@Excel(name = "更新人")
@ApiModelProperty(name = "更新人", value = "更新人")
private String updateBy;
@ -115,9 +142,9 @@ public class ProjectInfo extends BaseEntity {
private Date updateTime;
/**
*
*/
public static ProjectInfo queryBuild( ProjectInfoQueryReq projectInfoQueryReq){
*
*/
public static ProjectInfo queryBuild(ProjectInfoQueryReq projectInfoQueryReq) {
return ProjectInfo.builder()
.name(projectInfoQueryReq.getName())
.introduction(projectInfoQueryReq.getIntroduction())
@ -133,9 +160,9 @@ public class ProjectInfo extends BaseEntity {
}
/**
*
*/
public static ProjectInfo saveModelBuild(ProjectAddModel projectAddModel, Supplier<String> createBy){
*
*/
public static ProjectInfo saveModelBuild(ProjectAddModel projectAddModel, Supplier<String> createBy) {
return ProjectInfo.builder()
.name(projectAddModel.getName())
.introduction(projectAddModel.getIntroduction())
@ -153,11 +180,11 @@ public class ProjectInfo extends BaseEntity {
}
/**
*
*/
public static ProjectInfo editBuild(Long id, ProjectInfoEditReq projectInfoEditReq){
*
*/
public static ProjectInfo editBuild(Long id, ProjectInfoEditReq projectInfoEditReq) {
return ProjectInfo.builder()
.id(id)
.id(id)
.name(projectInfoEditReq.getName())
.introduction(projectInfoEditReq.getIntroduction())
.mianType(projectInfoEditReq.getMianType())

View File

@ -34,6 +34,10 @@ public class TemplateAttributeGroupModel extends BaseEntity {
*
*/
private List<TemplateAttributeModel> attributeList;
/**
*
*/
private List<TemplateAttributeGroupModel> templateAttributeGroupList;
/**
*
@ -51,10 +55,10 @@ public class TemplateAttributeGroupModel extends BaseEntity {
*/
public static TemplateAttributeGroupModel attributeGroupBuild(AttributeGroup attributeGroup,
Function<Long, List<TemplateAttributeModel>> attributeList){
return TemplateAttributeGroupModel.builder()
.groupName(attributeGroup.getName())
.attributeList(attributeList.apply(attributeGroup.getId()))
.build();
}
}

View File

@ -59,8 +59,12 @@ public class ProjectInfoQueryReq extends BaseEntity {
@ApiModelProperty(name = "规格", value = "规格")
private Long ruleId;
/** 品牌 */
@ApiModelProperty(name = "品牌", value = "品牌")
private Long brandId;
}

View File

@ -0,0 +1,32 @@
package com.muyu.product.domain.resp;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ProjectInfoListResp {
private Long id;
private String name;
private String introduction;
private Long mianType;
private String mianTypeName;
private Long parentType;
private Long type;
private String image;
private String carouselImages;
private String status;
private Long ruleId;
private String ruleName;
private Long brandId;
private String brandName;
private String parentTypeName;
private String typeName;
}

View File

@ -50,8 +50,10 @@ public class AttributeGroupController extends BaseController {
@GetMapping("/list")
public Result<TableDataInfo<AttributeGroupPageResp>> list(AttributeGroupQueryReq attributeGroupQueryReq) {
startPage();
TableDataInfo<AttributeGroupPageResp> tableDataInfo =
attributeGroupService.page(AttributeGroup.queryBuild(attributeGroupQueryReq));
TableDataInfo<AttributeGroupPageResp>
tableDataInfo =
attributeGroupService.
page(AttributeGroup.queryBuild(attributeGroupQueryReq));
return Result.success(tableDataInfo);
}

View File

@ -3,14 +3,13 @@ package com.muyu.product.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.muyu.product.cache.ProjectInfoCache;
import com.muyu.product.domain.BrandInfo;
import com.muyu.product.domain.RuleInfo;
import com.muyu.product.domain.resp.ProjectDetailResp;
import com.muyu.product.domain.resp.ProjectInfoListResp;
import com.muyu.product.service.BrandInfoService;
import com.muyu.product.service.RuleInfoService;
import io.swagger.annotations.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -58,9 +57,9 @@ public class ProjectInfoController extends BaseController {
@ApiOperation("获取商品信息列表")
@RequiresPermissions("product:info:list")
@GetMapping("/list")
public Result<TableDataInfo<ProjectInfo>> list(ProjectInfoQueryReq projectInfoQueryReq) {
public Result<TableDataInfo<ProjectInfoListResp>> list(ProjectInfoQueryReq projectInfoQueryReq) {
startPage();
List<ProjectInfo> list = projectInfoService.list(ProjectInfo.queryBuild(projectInfoQueryReq));
List<ProjectInfoListResp> list = projectInfoService.pageInfo(ProjectInfo.queryBuild(projectInfoQueryReq));
return getDataTable(list);
}

View File

@ -12,4 +12,7 @@ import com.muyu.product.domain.BrandInfo;
*/
public interface BrandInfoMapper extends BaseMapper<BrandInfo> {
String getName(Long brandId);
BrandInfo getById(Long brandId);
}

View File

@ -12,4 +12,5 @@ import com.muyu.product.domain.ProjectInfo;
*/
public interface ProjectInfoMapper extends BaseMapper<ProjectInfo> {
ProjectInfo getProjectName(String name);
}

View File

@ -24,4 +24,8 @@ public interface RuleInfoMapper extends BaseMapper<RuleInfo> {
void addRuleAttrModel(@Param("id") Long id, @Param("name") String name, @Param("valueData") String substring);
Integer have(Long id);
String getName(Long ruleId);
RuleInfo getById(Long ruleId);
}

View File

@ -19,4 +19,5 @@ public interface BrandInfoService extends IService<BrandInfo> {
*/
public List<BrandInfo> list(BrandInfo brandInfo);
String getName(Long brandId);
}

View File

@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.product.domain.req.ProjectInfoEditReq;
import com.muyu.product.domain.req.ProjectInfoSaveReq;
import com.muyu.product.domain.resp.ProjectDetailResp;
import com.muyu.product.domain.resp.ProjectInfoListResp;
/**
* Service
@ -45,4 +46,9 @@ public interface ProjectInfoService extends IService<ProjectInfo> {
* @return
*/
Result updProject(Long id, ProjectInfoEditReq projectInfoEditReq);
List<ProjectInfoListResp> pageInfo(ProjectInfo projectInfo);
// ProjectInfo getProjectName(String name);
}

View File

@ -44,4 +44,6 @@ public interface RuleInfoService extends IService<RuleInfo> {
void edit(Long id, RuleAttrInfoReq ruleInfoEditReq);
Result have(Long id);
String getName(Long ruleId);
}

View File

@ -39,11 +39,6 @@ public class AsBrandProjectServiceImpl extends ServiceImpl<AsBrandProjectMapper,
if (ObjUtils.notNull(asBrandProject.getProjectId())){
queryWrapper.eq(AsBrandProject::getProjectId, asBrandProject.getProjectId());
}
return list(queryWrapper);
}
}

View File

@ -39,11 +39,6 @@ public class AsCategoryAttributeGroupServiceImpl extends ServiceImpl<AsCategoryA
if (ObjUtils.notNull(asCategoryAttributeGroup.getAttributeGroupId())){
queryWrapper.eq(AsCategoryAttributeGroup::getAttributeGroupId, asCategoryAttributeGroup.getAttributeGroupId());
}
return list(queryWrapper);
}
}

View File

@ -31,7 +31,6 @@ public class AsCategoryAttributeServiceImpl extends ServiceImpl<AsCategoryAttrib
public List<AsCategoryAttribute> list(AsCategoryAttribute asCategoryAttribute) {
LambdaQueryWrapper<AsCategoryAttribute> queryWrapper = new LambdaQueryWrapper<>();
if (ObjUtils.notNull(asCategoryAttribute.getCategoryId())){
queryWrapper.eq(AsCategoryAttribute::getCategoryId, asCategoryAttribute.getCategoryId());
}
@ -39,11 +38,6 @@ public class AsCategoryAttributeServiceImpl extends ServiceImpl<AsCategoryAttrib
if (ObjUtils.notNull(asCategoryAttribute.getAttributeId())){
queryWrapper.eq(AsCategoryAttribute::getAttributeId, asCategoryAttribute.getAttributeId());
}
return list(queryWrapper);
}
}

View File

@ -31,7 +31,6 @@ public class AsCategoryBrandServiceImpl extends ServiceImpl<AsCategoryBrandMappe
public List<AsCategoryBrand> list(AsCategoryBrand asCategoryBrand) {
LambdaQueryWrapper<AsCategoryBrand> queryWrapper = new LambdaQueryWrapper<>();
if (ObjUtils.notNull(asCategoryBrand.getCategoryId())){
queryWrapper.eq(AsCategoryBrand::getCategoryId, asCategoryBrand.getCategoryId());
}
@ -40,10 +39,6 @@ public class AsCategoryBrandServiceImpl extends ServiceImpl<AsCategoryBrandMappe
queryWrapper.eq(AsCategoryBrand::getBrandId, asCategoryBrand.getBrandId());
}
return list(queryWrapper);
}
}

View File

@ -53,10 +53,12 @@ public class AttributeGroupServiceImpl extends ServiceImpl<AttributeGroupMapper,
@Override
public TableDataInfo<AttributeGroupPageResp> page (AttributeGroup attributeGroupQuery) {
List<AttributeGroup> list = this.list(attributeGroupQuery);
List<AttributeGroupPageResp> pageRespList = list.stream()
List<AttributeGroupPageResp> pageRespList
= list.stream()
.map(attributeGroup ->
AttributeGroupPageResp.groupFunBuild(
attributeGroup, groupId -> attributeInfoService.attributeListByGroupId(groupId)
attributeGroup, groupId
-> attributeInfoService.attributeListByGroupId(groupId)
)
)
.toList();

View File

@ -6,6 +6,7 @@ import java.util.List;
import com.muyu.common.core.utils.ObjUtils;
import com.muyu.common.security.utils.SecurityUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.muyu.product.mapper.BrandInfoMapper;
import com.muyu.product.domain.BrandInfo;
@ -23,6 +24,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@Service
public class BrandInfoServiceImpl extends ServiceImpl<BrandInfoMapper, BrandInfo> implements BrandInfoService {
@Autowired
private BrandInfoMapper brandInfoMapper;
/**
*
*
@ -53,6 +56,11 @@ public class BrandInfoServiceImpl extends ServiceImpl<BrandInfoMapper, BrandInfo
return list(queryWrapper);
}
@Override
public String getName(Long brandId) {
return brandInfoMapper.getName(brandId);
}
@Override
public boolean save(BrandInfo entity) {
entity.setCreateBy(SecurityUtils.getUsername());

View File

@ -371,7 +371,7 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
}
CategoryInfo categoryInfo = this.getById(cateGoryId);
parentIdList.add(categoryInfo.getId());
getParentIdListByCateGoryId(parentIdList, categoryInfo.getParentId());
getParentIdListByCateGoryId(parentIdList,categoryInfo.getParentId());
}
/**
@ -384,12 +384,14 @@ public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, Cat
@Override
public CategoryCommonElementResp getTemplateAttributeByCateGoryId (Long cateGoryId) {
List<Long> cateGoryIdList = new ArrayList<>();
getParentIdListByCateGoryId(cateGoryIdList, cateGoryId);
getParentIdListByCateGoryId(cateGoryIdList,cateGoryId);
// 取出和品类相关联的属性组关系 - 中间表
LambdaQueryWrapper<AsCategoryAttributeGroup> asCategoryAttributeGroupLambdaQueryWrapper = new LambdaQueryWrapper<>(){{
LambdaQueryWrapper<AsCategoryAttributeGroup> asCategoryAttributeGroupLambdaQueryWrapper =
new LambdaQueryWrapper<>(){{
in(AsCategoryAttributeGroup::getCategoryId, cateGoryIdList);
}};
List<AsCategoryAttributeGroup> categoryAttributeGroupList = asCategoryAttributeGroupService.list(asCategoryAttributeGroupLambdaQueryWrapper);
List<AsCategoryAttributeGroup> categoryAttributeGroupList =
asCategoryAttributeGroupService.list(asCategoryAttributeGroupLambdaQueryWrapper);
List<TemplateAttributeGroupModel> attributeGroupModelList = categoryAttributeGroupList.stream()
.map(AsCategoryAttributeGroup::getAttributeGroupId)
.distinct()

View File

@ -1,9 +1,6 @@
package com.muyu.product.service.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.*;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.muyu.common.core.domain.Result;
@ -16,6 +13,9 @@ import com.muyu.product.domain.req.ProjectInfoEditReq;
import com.muyu.product.domain.req.ProjectInfoSaveReq;
import com.muyu.product.domain.resp.CategoryCommonElementResp;
import com.muyu.product.domain.resp.ProjectDetailResp;
import com.muyu.product.domain.resp.ProjectInfoListResp;
import com.muyu.product.mapper.BrandInfoMapper;
import com.muyu.product.mapper.RuleInfoMapper;
import com.muyu.product.service.*;
import io.netty.util.internal.StringUtil;
import lombok.extern.slf4j.Slf4j;
@ -54,6 +54,12 @@ public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoMapper, Proje
@Autowired
private AttributeInfoService attributeInfoService;
@Autowired
private ProjectInfoMapper projectInfoMapper;
@Autowired
private RuleInfoMapper ruleInfoMapper;
@Autowired
private BrandInfoMapper brandInfoMapper;
/**
*
@ -122,6 +128,13 @@ public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoMapper, Proje
*/
@Override
public boolean save (ProjectInfoSaveReq projectInfoSaveReq) {
ProjectAddModel projectAddModel1 = projectInfoSaveReq.getProjectAddModel();
String name = projectAddModel1.getName();
//根据name查询project_info数据库
ProjectInfo getProjectInfo=projectInfoMapper.getProjectName(name);
if (getProjectInfo!=null){
return false;
}
ProjectAddModel projectAddModel = projectInfoSaveReq.getProjectAddModel();
ProjectInfo projectInfo = ProjectInfo.saveModelBuild(projectAddModel, SecurityUtils::getUsername);
boolean save = this.save(projectInfo);
@ -245,6 +258,12 @@ public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoMapper, Proje
*/
@Override
public Result updProject(Long id, ProjectInfoEditReq projectInfoEditReq) {
String name = projectInfoEditReq.getName();
//根据name查询project_info数据库
ProjectInfo getProjectInfo=projectInfoMapper.getProjectName(name);
if (getProjectInfo!=null){
return Result.error("商品名称重复,不能修改");
}
this.updateById(ProjectAddModel.editBuild(id,projectInfoEditReq));
if(!CollectionUtils.isEmpty(projectInfoEditReq.getAttrValueList())){
List<AttributeInfo> attributeInfos = projectInfoEditReq.getAttrValueList().stream()
@ -286,4 +305,47 @@ public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoMapper, Proje
}
return Result.success(null,"修改成功");
}
@Override
public List<ProjectInfoListResp> pageInfo(ProjectInfo projectInfo) {
List<ProjectInfo> list = list(projectInfo);
LinkedList<ProjectInfoListResp> listRespLinkedList = new LinkedList<>();
list.forEach(item->{
CategoryInfo mainTypeName = categoryInfoService.getById(item.getMianType());
CategoryInfo parentTypeName = categoryInfoService.getById(item.getParentType());
CategoryInfo typeName = item.getType() != null ? categoryInfoService.getById(item.getType()) : null;
//获取规则
RuleInfo ruleName=ruleInfoMapper.getById(item.getRuleId());
//获取品牌信息
BrandInfo brandName=brandInfoMapper.getById(item.getBrandId());
//构建响应对象
ProjectInfoListResp projectInfoListResp=ProjectInfoListResp.builder()
.id(item.getId())
.name(item.getName())
.introduction(item.getIntroduction())
.mianType(item.getMianType())
.parentType(item.getParentType())
.type(item.getType())
.image(item.getImage())
.carouselImages(item.getCarouselImages())
.status(item.getStatus())
.mianTypeName(mainTypeName!=null?mainTypeName.getName():"")
.parentTypeName(parentTypeName!=null?parentTypeName.getName():"")
.typeName(typeName!=null?typeName.getName():"")
.ruleName(ruleName != null ? ruleName.getName() : null)
.brandName(brandName != null ? brandName.getNam() : null)
.build();
//添加到结果列表
listRespLinkedList.add(projectInfoListResp);
});
return listRespLinkedList;
}
// @Override
// public ProjectInfo getProjectName(String name) {
// return projectInfoMapper.getProjectName(name);
// }
}

View File

@ -50,6 +50,8 @@ public class RuleInfoServiceImpl extends ServiceImpl<RuleInfoMapper, RuleInfo> i
private RuleInfoMapper ruleAttrInfoMapper;
@Autowired
private ProjectInfoService projectInfoService;
@Autowired
private RuleInfoMapper ruleInfoMapper;
/**
*
@ -194,4 +196,9 @@ public class RuleInfoServiceImpl extends ServiceImpl<RuleInfoMapper, RuleInfo> i
}
return Result.success(count);
}
@Override
public String getName(Long ruleId) {
return ruleInfoMapper.getName(ruleId);
}
}

View File

@ -20,4 +20,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectBrandInfoVo">
select id, nam, logo, start, introduction, remark, create_by, create_time, update_by, update_time from brand_info
</sql>
<select id="getName" resultType="java.lang.String">
select name from product_info where id=#{brandId}
</select>
<select id="getById" resultType="com.muyu.product.domain.BrandInfo">
SELECT * FROM brand_info WHERE id=#{id}
</select>
</mapper>

View File

@ -26,4 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectProjectInfoVo">
select id, name, introduction, mian_type, parent_type, type, image, carousel_images, status, rule_id, brand_id, remark, create_by, create_time, update_by, update_time from project_info
</sql>
<select id="getProjectName" resultType="com.muyu.product.domain.ProjectInfo">
select * from project_info where name=#{name}
</select>
</mapper>

View File

@ -56,4 +56,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="have" resultType="java.lang.Integer">
SELECT count(1) FROM project_info WHERE id=#{id}
</select>
<select id="getName" resultType="java.lang.String">
SELECT name FROM rule_info WHERE id=#{ruleId}
</select>
<select id="getById" resultType="com.muyu.product.domain.RuleInfo">
SELECT id, name, status, remark, create_by, create_time, update_by, update_time FROM rule_info WHERE id=#{id}
</select>
</mapper>

View File

@ -15,6 +15,7 @@
<module>muyu-file</module>
<module>muyu-product</module>
<module>muyu-shop-cart</module>
<module>muyu-marketing</module>
</modules>
<artifactId>muyu-modules</artifactId>