diff --git a/.idea/encodings.xml b/.idea/encodings.xml index acc0700..df3044c 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -7,6 +7,7 @@ + diff --git a/bwie-common/src/main/java/com/bwie/common/domain/Import.java b/bwie-common/src/main/java/com/bwie/common/domain/Import.java new file mode 100644 index 0000000..3745485 --- /dev/null +++ b/bwie-common/src/main/java/com/bwie/common/domain/Import.java @@ -0,0 +1,31 @@ +package com.bwie.common.domain; + +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * @ClassName Import + * @Description 描述 + * @Author XingHua.Han + * @Date 2023/11/24 14:44 + */ +@Data +public class Import { + + private Integer importId; + private Integer merchId; + private Integer planNum; + private Date importTime; + + private Integer merchName; + private String merchType; + private BigDecimal merchPrice; + private String barCode; + private BigDecimal salesProPrice; + private Date merchDeadTime; + private Integer merchNum; + private Integer merchSta; + +} diff --git a/bwie-common/src/main/java/com/bwie/common/domain/Merch.java b/bwie-common/src/main/java/com/bwie/common/domain/Merch.java new file mode 100644 index 0000000..049092b --- /dev/null +++ b/bwie-common/src/main/java/com/bwie/common/domain/Merch.java @@ -0,0 +1,26 @@ +package com.bwie.common.domain; + +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * @ClassName Merch + * @Description 描述 + * @Author XingHua.Han + * @Date 2023/11/24 9:25 + */ +@Data +public class Merch { + private Integer merchId; + private String merchName; + private String merchType; + private BigDecimal merchPrice; + private String barCode; + private BigDecimal salesProPrice; + private Date merchDeadTime; + private Integer merchNum; + private Integer merchSta; + +} diff --git a/bwie-common/src/main/java/com/bwie/common/domain/dto/MerchIns.java b/bwie-common/src/main/java/com/bwie/common/domain/dto/MerchIns.java new file mode 100644 index 0000000..7ef40b2 --- /dev/null +++ b/bwie-common/src/main/java/com/bwie/common/domain/dto/MerchIns.java @@ -0,0 +1,23 @@ +package com.bwie.common.domain.dto; + +/** + * @ClassName MerchIns + * @Description 描述 + * @Author XingHua.Han + * @Date 2023/11/24 9:30 + */ + +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +public class MerchIns { + private String merchName; + private String merchType; + private BigDecimal merchPrice; + private String barCode; + private BigDecimal salesProPrice; + private Date merchDeadTime; +} diff --git a/bwie-common/src/main/java/com/bwie/common/domain/dto/MerchRestock.java b/bwie-common/src/main/java/com/bwie/common/domain/dto/MerchRestock.java new file mode 100644 index 0000000..a43a78a --- /dev/null +++ b/bwie-common/src/main/java/com/bwie/common/domain/dto/MerchRestock.java @@ -0,0 +1,15 @@ +package com.bwie.common.domain.dto; + +import lombok.Data; + +/** + * @ClassName MerchRestock + * @Description 描述 + * @Author XingHua.Han + * @Date 2023/11/24 14:38 + */ +@Data +public class MerchRestock { + private Integer merchId; + private Integer restockNum; +} diff --git a/bwie-common/src/main/java/com/bwie/common/domain/dto/MerchUpd.java b/bwie-common/src/main/java/com/bwie/common/domain/dto/MerchUpd.java new file mode 100644 index 0000000..cfc9899 --- /dev/null +++ b/bwie-common/src/main/java/com/bwie/common/domain/dto/MerchUpd.java @@ -0,0 +1,23 @@ +package com.bwie.common.domain.dto; + +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * @ClassName MerchUpd + * @Description 描述 + * @Author XingHua.Han + * @Date 2023/11/24 14:07 + */ +@Data +public class MerchUpd { + private Integer merchId; + private String merchName; + private String merchType; + private BigDecimal merchPrice; + private String barCode; + private BigDecimal salesProPrice; + private Date merchDeadTime; +} diff --git a/bwie-models/bwie-merch/pom.xml b/bwie-models/bwie-merch/pom.xml new file mode 100644 index 0000000..85fea25 --- /dev/null +++ b/bwie-models/bwie-merch/pom.xml @@ -0,0 +1,55 @@ + + + 4.0.0 + + com.bwie + bwie-models + 1.0-SNAPSHOT + + + bwie-merch + + + 17 + 17 + UTF-8 + + + + + com.bwie + bwie-common + 1.0-SNAPSHOT + + + + org.springframework.boot + spring-boot-starter-web + + + + com.alibaba + druid-spring-boot-starter + 1.2.8 + + + + mysql + mysql-connector-java + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 2.2.2 + + + + com.github.pagehelper + pagehelper-spring-boot-starter + 1.4.1 + + + diff --git a/bwie-models/bwie-merch/src/main/java/com/bwie/merch/MerchApp.java b/bwie-models/bwie-merch/src/main/java/com/bwie/merch/MerchApp.java new file mode 100644 index 0000000..906db40 --- /dev/null +++ b/bwie-models/bwie-merch/src/main/java/com/bwie/merch/MerchApp.java @@ -0,0 +1,17 @@ +package com.bwie.merch; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * @ClassName MerchApp + * @Description 描述 + * @Author XingHua.Han + * @Date 2023/11/24 15:50 + */ +@SpringBootApplication +public class MerchApp { + public static void main(String[] args) { + SpringApplication.run(MerchApp.class); + } +} diff --git a/bwie-models/bwie-merch/src/main/java/com/bwie/merch/controller/MerchController.java b/bwie-models/bwie-merch/src/main/java/com/bwie/merch/controller/MerchController.java new file mode 100644 index 0000000..a72ee3c --- /dev/null +++ b/bwie-models/bwie-merch/src/main/java/com/bwie/merch/controller/MerchController.java @@ -0,0 +1,58 @@ +package com.bwie.merch.controller; + +import com.bwie.common.domain.dto.MerchIns; +import com.bwie.common.domain.dto.MerchRestock; +import com.bwie.common.domain.dto.MerchUpd; +import com.bwie.common.result.Result; +import com.bwie.merch.service.MerchService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +/** + * @ClassName MerchController + * @Description 描述 + * @Author XingHua.Han + * @Date 2023/11/24 9:17 + */ +@RestController +public class MerchController { + @Autowired + private MerchService merchService; + @PostMapping("allShow") + public Result allShow() { + Result result = merchService.allShow(); + return result; + } + @PostMapping("insert") + public Result insert(@RequestBody MerchIns merchIns){ + Result result = merchService.insert(merchIns); + return result; + } + @PostMapping("delete/{merchId}") + public Result delete(@RequestBody String merchId){ + Result result = merchService.delete(merchId); + return result; + } + @PostMapping("update") + public Result update(@RequestBody MerchUpd merchUpd){ + Result result = merchService.update(merchUpd); + return result; + } + @PostMapping("listing/merchId") + public Result listing(@RequestBody String merchId){ + Result result = merchService.listing(merchId); + return result; + } + @PostMapping("restock") + public Result restock(@RequestBody MerchRestock merchRestock){ + Result result = merchService.restock(merchRestock); + return result; + } + @PostMapping("importAllShow") + public Result importAllShow(){ + Result result = merchService.importAllShow(); + return result; + } +} diff --git a/bwie-models/bwie-merch/src/main/java/com/bwie/merch/mapper/MerchMapper.java b/bwie-models/bwie-merch/src/main/java/com/bwie/merch/mapper/MerchMapper.java new file mode 100644 index 0000000..ea35e84 --- /dev/null +++ b/bwie-models/bwie-merch/src/main/java/com/bwie/merch/mapper/MerchMapper.java @@ -0,0 +1,40 @@ +package com.bwie.merch.mapper; + +import com.bwie.common.domain.Import; +import com.bwie.common.domain.Merch; +import com.bwie.common.domain.dto.MerchIns; +import com.bwie.common.domain.dto.MerchRestock; +import com.bwie.common.domain.dto.MerchUpd; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @ClassName MerchMapper + * @Description 描述 + * @Author XingHua.Han + * @Date 2023/11/24 9:23 + */ + + +@Mapper +public interface MerchMapper { + List allShow(); + + void insert(MerchIns merchIns); + + void delete(@Param("merchId") String merchId); + + void update(MerchUpd merchUpd); + + Merch findById(@Param("merchId") String merchId); + + void listing(@Param("merchId") String merchId, @Param("i") int i); + + void restock(MerchRestock merchRestock); + + void insertImport(MerchRestock merchRestock); + + List importAllShow(); +} diff --git a/bwie-models/bwie-merch/src/main/java/com/bwie/merch/service/MerchService.java b/bwie-models/bwie-merch/src/main/java/com/bwie/merch/service/MerchService.java new file mode 100644 index 0000000..8c40e14 --- /dev/null +++ b/bwie-models/bwie-merch/src/main/java/com/bwie/merch/service/MerchService.java @@ -0,0 +1,30 @@ +package com.bwie.merch.service; + +import com.bwie.common.domain.dto.MerchIns; +import com.bwie.common.domain.dto.MerchRestock; +import com.bwie.common.domain.dto.MerchUpd; +import com.bwie.common.result.Result; +import org.springframework.web.bind.annotation.RestController; + +/** + * @ClassName MercherService + * @Description 描述 + * @Author XingHua.Han + * @Date 2023/11/24 9:22 + */ +@RestController +public interface MerchService { + Result allShow(); + + Result insert(MerchIns merchIns); + + Result delete(String merchId); + + Result update(MerchUpd merchUpd); + + Result listing(String merchId); + + Result restock(MerchRestock merchRestock); + + Result importAllShow(); +} diff --git a/bwie-models/bwie-merch/src/main/java/com/bwie/merch/service/impl/MerchServiceImpl.java b/bwie-models/bwie-merch/src/main/java/com/bwie/merch/service/impl/MerchServiceImpl.java new file mode 100644 index 0000000..669f2cb --- /dev/null +++ b/bwie-models/bwie-merch/src/main/java/com/bwie/merch/service/impl/MerchServiceImpl.java @@ -0,0 +1,74 @@ +package com.bwie.merch.service.impl; + +import com.bwie.common.domain.Import; +import com.bwie.common.domain.Merch; +import com.bwie.common.domain.dto.MerchIns; +import com.bwie.common.domain.dto.MerchRestock; +import com.bwie.common.domain.dto.MerchUpd; +import com.bwie.common.result.Result; +import com.bwie.merch.mapper.MerchMapper; +import com.bwie.merch.service.MerchService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @ClassName MerchServiceImpl + * @Description 描述 + * @Author XingHua.Han + * @Date 2023/11/24 9:23 + */ +@Service +public class MerchServiceImpl implements MerchService { + @Autowired + private MerchMapper merchMapper; + @Override + public Result allShow() { + List merchList = merchMapper.allShow(); + return Result.success(merchList); + } + + @Override + public Result insert(MerchIns merchIns) { + merchMapper.insert(merchIns); + return Result.success(); + } + + @Override + public Result delete(String merchId) { + merchMapper.delete(merchId); + return Result.success(); + } + + @Override + public Result update(MerchUpd merchUpd) { + merchMapper.update(merchUpd); + return Result.success(); + } + + @Override + public Result listing(String merchId) { + Merch merch = merchMapper.findById(merchId); + if(merch.getMerchSta()==1){ + merchMapper.listing(merchId,2); + }else{ + merchMapper.listing(merchId,1); + } + + return Result.success(); + } + + @Override + public Result restock(MerchRestock merchRestock) { + merchMapper.restock(merchRestock); + merchMapper.insertImport(merchRestock); + return Result.success(); + } + + @Override + public Result importAllShow() { + List list = merchMapper.importAllShow(); + return Result.success(list); + } +} diff --git a/bwie-models/bwie-merch/src/main/resources/bootstrap.yml b/bwie-models/bwie-merch/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..9e758ea --- /dev/null +++ b/bwie-models/bwie-merch/src/main/resources/bootstrap.yml @@ -0,0 +1,30 @@ +# Tomcat +server: + port: 9003 +# Spring +spring: + main: + allow-circular-references: true + jackson: + date-format: yyyy-MM-dd HH:mm:ss + time-zone: GMT+8 + application: + # 应用名称 + name: bwie-merch + profiles: + # 环境配置 + active: dev + cloud: + nacos: + discovery: + # 服务注册地址 + server-addr: 111.229.204.42:8848 + config: + # 配置中心地址 + server-addr: 111.229.204.42:8848 + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + namespace: 6296b935-334a-42d6-84cf-508ca67756de diff --git a/bwie-models/bwie-merch/src/main/resources/mapper/MerchMapper.xml b/bwie-models/bwie-merch/src/main/resources/mapper/MerchMapper.xml new file mode 100644 index 0000000..c8e4882 --- /dev/null +++ b/bwie-models/bwie-merch/src/main/resources/mapper/MerchMapper.xml @@ -0,0 +1,77 @@ + + + + + + INSERT INTO `zhuangao5`.`t_merch` + (`merch_name`, + `merch_type`, + `merch_price`, + `bar_code`, + `sales_pro_price`, + `merch_dead_time`, + `merch_num`, + `merch_sta`) + VALUES (#{merchName}, + #{merchType}, + #{merchPrice}, + #{barCode}, + #{salesProPrice}, + #{merchDeadTime}, + 0, + 2); + + + INSERT INTO `zhuangao5`.`t_import` + ( `merch_id`, `plan_num`, `import_time`) + VALUES ( #{merchId}, #{restockNum}, now()); + + + + + update t_merch set + merch_name=#{merchName}, + merch_type=#{merchType}, + merch_price=#{merchPrice}, + bar_code=#{barCode}, + sales_pro_price=#{salesProPrice}, + merch_dead_time=#{merchDeadTime} + where + merch_id=#{merchId} + + + update t_merch set + merch_sta= #{i} + where + merch_id=#{merchId} + + + update t_merch set + merch_num=merch_num+#{restockNum} + where + merch_id=#{merchId} + + + + + delete from t_merch where merch_id=#{merchId} + + + + + + + + + diff --git a/bwie-models/pom.xml b/bwie-models/pom.xml index ffeb88d..72cf36d 100644 --- a/bwie-models/pom.xml +++ b/bwie-models/pom.xml @@ -13,6 +13,7 @@ pom bwie-system + bwie-merch @@ -21,4 +22,4 @@ UTF-8 - \ No newline at end of file +