diff --git a/common/service-util/pom.xml b/common/service-util/pom.xml index 42c8fe1..8662030 100644 --- a/common/service-util/pom.xml +++ b/common/service-util/pom.xml @@ -55,5 +55,23 @@ mybatis-plus-boot-starter provided + + + com.baomidou + mybatis-plus-generator + 3.4.1 + + + + org.apache.velocity + velocity-engine-core + 2.0 + + + + + mysql + mysql-connector-java + diff --git a/common/service-util/src/main/java/com/atguigu/ssyx/CodeGet.java b/common/service-util/src/main/java/com/atguigu/ssyx/CodeGet.java new file mode 100644 index 0000000..982bb3e --- /dev/null +++ b/common/service-util/src/main/java/com/atguigu/ssyx/CodeGet.java @@ -0,0 +1,60 @@ +package com.atguigu.ssyx; + +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.generator.AutoGenerator; +import com.baomidou.mybatisplus.generator.config.DataSourceConfig; +import com.baomidou.mybatisplus.generator.config.GlobalConfig; +import com.baomidou.mybatisplus.generator.config.PackageConfig; +import com.baomidou.mybatisplus.generator.config.StrategyConfig; +import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; + +public class CodeGet { + + public static void main(String[] args) { + // 1、创建代码生成器 + AutoGenerator mpg = new AutoGenerator(); + + // 2、全局配置 + // 全局配置 + GlobalConfig gc = new GlobalConfig(); + gc.setOutputDir("F:\\File\\Java\\ssyx\\guigu-ssyx-parent\\service\\service-sys" + "/src/main/java\\com\\atguigu\\ssyx\\sys"); + + gc.setServiceName("%sService"); // 去掉Service接口的首字母I + gc.setAuthor("atguigu"); + gc.setOpen(false); + mpg.setGlobalConfig(gc); + + // 3、数据源配置 + DataSourceConfig dsc = new DataSourceConfig(); + dsc.setUrl("jdbc:mysql://106.15.251.123:3305/shequ-sys?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true"); + dsc.setDriverName("com.mysql.cj.jdbc.Driver"); + dsc.setUsername("root"); + dsc.setPassword("02120212"); + dsc.setDbType(DbType.MYSQL); + mpg.setDataSource(dsc); + + // 4、包配置 + PackageConfig pc = new PackageConfig(); + pc.setParent("com.atguigu"); + pc.setModuleName("system"); // 模块名 + pc.setController("controller"); + pc.setService("service"); + pc.setMapper("mapper"); + mpg.setPackageInfo(pc); + + // 5、策略配置 + StrategyConfig strategy = new StrategyConfig(); + + strategy.setInclude("region", "region_ware", "ware"); + strategy.setNaming(NamingStrategy.underline_to_camel);// 数据库表映射到实体的命名策略 + strategy.setColumnNaming(NamingStrategy.underline_to_camel);// 数据库表字段映射到实体的命名策略 + strategy.setEntityLombokModel(true); // lombok 模型 @Accessors(chain = true) setter链式操作 + strategy.setRestControllerStyle(true); // restful api风格控制器 + strategy.setControllerMappingHyphenStyle(true); // url中驼峰转连字符 + + mpg.setStrategy(strategy); + + // 6、执行 + mpg.execute(); + } +} diff --git a/service/service-acl/src/main/java/com/atguigu/ssyx/acl/ServiceAclApplication.java b/service/service-acl/src/main/java/com/atguigu/ssyx/acl/ServiceAclApplication.java index 878caaa..f38d0d9 100644 --- a/service/service-acl/src/main/java/com/atguigu/ssyx/acl/ServiceAclApplication.java +++ b/service/service-acl/src/main/java/com/atguigu/ssyx/acl/ServiceAclApplication.java @@ -6,7 +6,7 @@ import org.springframework.context.annotation.ComponentScan; import org.springframework.transaction.annotation.EnableTransactionManagement; @SpringBootApplication -@ComponentScan(basePackages = {"com.atguigu.ssyx", "com.atguigu.ssyx.acl"}) +@ComponentScan(basePackages = {"com.atguigu.ssyx"}) @EnableTransactionManagement public class ServiceAclApplication { public static void main(String[] args) { diff --git a/service/service-sys/Dockerfile b/service/service-sys/Dockerfile new file mode 100644 index 0000000..ef109ac --- /dev/null +++ b/service/service-sys/Dockerfile @@ -0,0 +1,21 @@ +FROM openjdk:17 +MAINTAINER bunny + +#系统编码 +ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 + +# 设置时区,构建镜像时执行的命令 +RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime +RUN echo "Asia/Shanghai" > /etc/timezone + +# 设定工作目录 +WORKDIR /home/bunny + +# 复制jar包 +COPY target/*.jar /home/bunny/app.jar + +#启动容器时的进程 +ENTRYPOINT ["java","-jar","/home/bunny/app.jar"] + +#暴露 8080 端口 +EXPOSE 8080 \ No newline at end of file diff --git a/service/service-sys/pom.xml b/service/service-sys/pom.xml index 9d4d320..ec1ceaf 100644 --- a/service/service-sys/pom.xml +++ b/service/service-sys/pom.xml @@ -18,6 +18,6 @@ - + diff --git a/service/service-sys/src/main/java/com/atguigu/ssyx/sys/ServiceSysApplication.java b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/ServiceSysApplication.java new file mode 100644 index 0000000..5f5c71b --- /dev/null +++ b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/ServiceSysApplication.java @@ -0,0 +1,15 @@ +package com.atguigu.ssyx.sys; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@SpringBootApplication +@EnableTransactionManagement +@ComponentScan(basePackages = {"com.atguigu.ssyx"}) +public class ServiceSysApplication { + public static void main(String[] args) { + SpringApplication.run(ServiceSysApplication.class, args); + } +} diff --git a/common/service-util/src/main/java/com/atguigu/ssyx/common/config/WebKnife4jConfig.java b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/config/Knife4jConfig.java similarity index 90% rename from common/service-util/src/main/java/com/atguigu/ssyx/common/config/WebKnife4jConfig.java rename to service/service-sys/src/main/java/com/atguigu/ssyx/sys/config/Knife4jConfig.java index 4d2ef87..8c01a06 100644 --- a/common/service-util/src/main/java/com/atguigu/ssyx/common/config/WebKnife4jConfig.java +++ b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/config/Knife4jConfig.java @@ -1,4 +1,4 @@ -package com.atguigu.ssyx.common.config; +package com.atguigu.ssyx.sys.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -19,7 +19,7 @@ import java.util.List; @Configuration @EnableSwagger2WebMvc -public class WebKnife4jConfig { +public class Knife4jConfig { @Bean public Docket webApiConfig() { List pars = new ArrayList<>(); @@ -35,12 +35,12 @@ public class WebKnife4jConfig { pars.add(tokenPar.build()); return new Docket(DocumentationType.SWAGGER_2) - .groupName("webApi") + .groupName("区域查询API") .apiInfo(webApiInfo()) .select() // 只显示api路径下的页面 - .apis(RequestHandlerSelectors.basePackage("com.atguigu.ssyx")) - .paths(PathSelectors.regex("/api/.*")) + .apis(RequestHandlerSelectors.basePackage("com.atguigu.ssyx.sys")) + .paths(PathSelectors.regex("/admin/sys/regionWare/.*|/system/.*")) .build() .globalOperationParameters(pars); } diff --git a/service/service-sys/src/main/java/com/atguigu/ssyx/sys/controller/RegionController.java b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/controller/RegionController.java new file mode 100644 index 0000000..d08a6ac --- /dev/null +++ b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/controller/RegionController.java @@ -0,0 +1,43 @@ +package com.atguigu.ssyx.sys.controller; + + +import com.atguigu.ssyx.common.result.Result; +import com.atguigu.ssyx.model.sys.RegionWare; +import com.atguigu.ssyx.sys.service.RegionWareService; +import com.atguigu.ssyx.vo.sys.RegionWareQueryVo; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +@Api(value = "获取开通区管理", tags = "获取开通区管理") +@RestController +@RequestMapping(value = "/admin/sys/regionWare") +public class RegionController { + @Resource + private RegionWareService regionWareService; + + @ApiOperation(value = "获取开通区域列表") + @GetMapping("{page}/{limit}") + public Result> index( + @ApiParam(name = "page", value = "当前页码", required = true) + @PathVariable Long page, + @ApiParam(name = "limit", value = "每页记录数", required = true) + @PathVariable Long limit, + @ApiParam(name = "regionWareVo", value = "查询对象", required = false) + RegionWareQueryVo regionWareQueryVo) { + + Page pageParam = new Page<>(page, limit); + IPage pageModel = regionWareService.selectPage(pageParam, regionWareQueryVo); + + return Result.success(pageModel); + } +} + diff --git a/service/service-sys/src/main/java/com/atguigu/ssyx/sys/controller/RegionWareController.java b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/controller/RegionWareController.java new file mode 100644 index 0000000..c0d7221 --- /dev/null +++ b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/controller/RegionWareController.java @@ -0,0 +1,12 @@ +package com.atguigu.ssyx.sys.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/system/region-ware") +public class RegionWareController { + +} + diff --git a/service/service-sys/src/main/java/com/atguigu/ssyx/sys/controller/WareController.java b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/controller/WareController.java new file mode 100644 index 0000000..1bc9640 --- /dev/null +++ b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/controller/WareController.java @@ -0,0 +1,20 @@ +package com.atguigu.ssyx.sys.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 仓库表 前端控制器 + *

+ * + * @author atguigu + * @since 2024-04-02 + */ +@RestController +@RequestMapping("/system/ware") +public class WareController { + +} + diff --git a/service/service-sys/src/main/java/com/atguigu/ssyx/sys/mapper/RegionMapper.java b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/mapper/RegionMapper.java new file mode 100644 index 0000000..ffb7879 --- /dev/null +++ b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/mapper/RegionMapper.java @@ -0,0 +1,16 @@ +package com.atguigu.ssyx.sys.mapper; + +import com.atguigu.ssyx.model.sys.Region; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 地区表 Mapper 接口 + *

+ * + * @author atguigu + * @since 2024-04-02 + */ +public interface RegionMapper extends BaseMapper { + +} diff --git a/service/service-sys/src/main/java/com/atguigu/ssyx/sys/mapper/RegionWareMapper.java b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/mapper/RegionWareMapper.java new file mode 100644 index 0000000..2176497 --- /dev/null +++ b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/mapper/RegionWareMapper.java @@ -0,0 +1,16 @@ +package com.atguigu.ssyx.sys.mapper; + +import com.atguigu.ssyx.model.sys.RegionWare; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 城市仓库关联表 Mapper 接口 + *

+ * + * @author atguigu + * @since 2024-04-02 + */ +public interface RegionWareMapper extends BaseMapper { + +} diff --git a/service/service-sys/src/main/java/com/atguigu/ssyx/sys/mapper/WareMapper.java b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/mapper/WareMapper.java new file mode 100644 index 0000000..a0704b2 --- /dev/null +++ b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/mapper/WareMapper.java @@ -0,0 +1,16 @@ +package com.atguigu.ssyx.sys.mapper; + +import com.atguigu.ssyx.model.sys.Ware; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 仓库表 Mapper 接口 + *

+ * + * @author atguigu + * @since 2024-04-02 + */ +public interface WareMapper extends BaseMapper { + +} diff --git a/service/service-sys/src/main/java/com/atguigu/ssyx/sys/service/RegionService.java b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/service/RegionService.java new file mode 100644 index 0000000..82234ae --- /dev/null +++ b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/service/RegionService.java @@ -0,0 +1,16 @@ +package com.atguigu.ssyx.sys.service; + +import com.atguigu.ssyx.model.sys.Region; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 地区表 服务类 + *

+ * + * @author atguigu + * @since 2024-04-02 + */ +public interface RegionService extends IService { + +} diff --git a/service/service-sys/src/main/java/com/atguigu/ssyx/sys/service/RegionWareService.java b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/service/RegionWareService.java new file mode 100644 index 0000000..e90a91c --- /dev/null +++ b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/service/RegionWareService.java @@ -0,0 +1,15 @@ +package com.atguigu.ssyx.sys.service; + +import com.atguigu.ssyx.model.sys.RegionWare; +import com.atguigu.ssyx.vo.sys.RegionWareQueryVo; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; + +public interface RegionWareService extends IService { + + /** + * 开通区域列表 + */ + IPage selectPage(Page pageParam, RegionWareQueryVo regionWareQueryVo); +} diff --git a/service/service-sys/src/main/java/com/atguigu/ssyx/sys/service/WareService.java b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/service/WareService.java new file mode 100644 index 0000000..8fc37a7 --- /dev/null +++ b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/service/WareService.java @@ -0,0 +1,16 @@ +package com.atguigu.ssyx.sys.service; + +import com.atguigu.ssyx.model.sys.Ware; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 仓库表 服务类 + *

+ * + * @author atguigu + * @since 2024-04-02 + */ +public interface WareService extends IService { + +} diff --git a/service/service-sys/src/main/java/com/atguigu/ssyx/sys/service/impl/RegionServiceImpl.java b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/service/impl/RegionServiceImpl.java new file mode 100644 index 0000000..2bfe14e --- /dev/null +++ b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/service/impl/RegionServiceImpl.java @@ -0,0 +1,20 @@ +package com.atguigu.ssyx.sys.service.impl; + +import com.atguigu.ssyx.model.sys.Region; +import com.atguigu.ssyx.sys.mapper.RegionMapper; +import com.atguigu.ssyx.sys.service.RegionService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 地区表 服务实现类 + *

+ * + * @author atguigu + * @since 2024-04-02 + */ +@Service +public class RegionServiceImpl extends ServiceImpl implements RegionService { + +} diff --git a/service/service-sys/src/main/java/com/atguigu/ssyx/sys/service/impl/RegionWareServiceImpl.java b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/service/impl/RegionWareServiceImpl.java new file mode 100644 index 0000000..df3058f --- /dev/null +++ b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/service/impl/RegionWareServiceImpl.java @@ -0,0 +1,30 @@ +package com.atguigu.ssyx.sys.service.impl; + +import com.atguigu.ssyx.model.sys.RegionWare; +import com.atguigu.ssyx.sys.mapper.RegionWareMapper; +import com.atguigu.ssyx.sys.service.RegionWareService; +import com.atguigu.ssyx.vo.sys.RegionWareQueryVo; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +@Service +public class RegionWareServiceImpl extends ServiceImpl implements RegionWareService { + + /** + * 开通区域列表 + */ + @Override + public IPage selectPage(Page pageParam, RegionWareQueryVo regionWareQueryVo) { + String keyword = regionWareQueryVo.getKeyword(); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + // 查询 + wrapper.like(!StringUtils.isEmpty(keyword), RegionWare::getRegionName, keyword).or().like(!StringUtils.isEmpty(keyword), RegionWare::getWareName, keyword); + + return baseMapper.selectPage(pageParam, wrapper); + } +} diff --git a/service/service-sys/src/main/java/com/atguigu/ssyx/sys/service/impl/WareServiceImpl.java b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/service/impl/WareServiceImpl.java new file mode 100644 index 0000000..471ddf3 --- /dev/null +++ b/service/service-sys/src/main/java/com/atguigu/ssyx/sys/service/impl/WareServiceImpl.java @@ -0,0 +1,20 @@ +package com.atguigu.ssyx.sys.service.impl; + +import com.atguigu.ssyx.model.sys.Ware; +import com.atguigu.ssyx.sys.mapper.WareMapper; +import com.atguigu.ssyx.sys.service.WareService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 仓库表 服务实现类 + *

+ * + * @author atguigu + * @since 2024-04-02 + */ +@Service +public class WareServiceImpl extends ServiceImpl implements WareService { + +} diff --git a/service/service-sys/src/main/resources/application-dev.yml b/service/service-sys/src/main/resources/application-dev.yml index 5f1e5ac..f56edaf 100644 --- a/service/service-sys/src/main/resources/application-dev.yml +++ b/service/service-sys/src/main/resources/application-dev.yml @@ -1,11 +1,11 @@ server: - port: 8200 + port: 8202 bunny: datasource: host: 106.15.251.123 port: 3305 - sqlData: shequ-acl + sqlData: shequ-sys username: root password: "02120212" diff --git a/service/service-sys/src/main/resources/banner.txt b/service/service-sys/src/main/resources/banner.txt new file mode 100644 index 0000000..cc77fc2 --- /dev/null +++ b/service/service-sys/src/main/resources/banner.txt @@ -0,0 +1,16 @@ +-----------------▄██-█▄--------- +-----------------███▄██▄-------- +-----------------███████-------- +-----------------▀███████------- +-------------------██████▄▄----- +-------------------█████████▄--- +-------------------██████▄████-- +-------▄███████████████████████- +-----▄███████████████████████▀-- +---▄██████████████████████------ +---███████████████████████------ +---███████████████████████------ +-▄▄██████████████████████▀------ +-█████████████████▀█████-------- +-▀██████████████▀▀-▀█████▄------ +-------▀▀▀▀▀▀▀▀▀------▀▀▀▀------ \ No newline at end of file diff --git a/service/service-sys/src/main/resources/favicon.ico b/service/service-sys/src/main/resources/favicon.ico new file mode 100644 index 0000000..1ba397c Binary files /dev/null and b/service/service-sys/src/main/resources/favicon.ico differ diff --git a/service/service-sys/src/main/resources/mapper/RegionMapper.xml b/service/service-sys/src/main/resources/mapper/RegionMapper.xml new file mode 100644 index 0000000..639a34d --- /dev/null +++ b/service/service-sys/src/main/resources/mapper/RegionMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/service/service-sys/src/main/resources/mapper/RegionWareMapper.xml b/service/service-sys/src/main/resources/mapper/RegionWareMapper.xml new file mode 100644 index 0000000..ea74838 --- /dev/null +++ b/service/service-sys/src/main/resources/mapper/RegionWareMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/service/service-sys/src/main/resources/mapper/WareMapper.xml b/service/service-sys/src/main/resources/mapper/WareMapper.xml new file mode 100644 index 0000000..0a302a7 --- /dev/null +++ b/service/service-sys/src/main/resources/mapper/WareMapper.xml @@ -0,0 +1,5 @@ + + + + +