From e9c96f32b0830cf7bc6ee66ce2c7a9784c679753 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期三, 14 六月 2023 16:08:46 +0800
Subject: [PATCH] 新增加接口
---
cloud-server-other/src/main/java/com/dsh/other/entity/Protocol.java | 38 ++++++
cloud-server-other/src/main/java/com/dsh/other/mapper/TImgConfigMapper.java | 2
cloud-server-other/src/main/resources/mapper/ProtocolMapper.xml | 13 ++
cloud-server-other/pom.xml | 26 ----
cloud-server-other/src/main/java/com/dsh/other/controller/ImgConfigController.java | 4
/dev/null | 88 --------------
cloud-server-other/src/main/java/com/dsh/other/mapper/ProtocolMapper.java | 11 +
cloud-server-other/src/main/java/com/dsh/other/service/TImgConfigService.java | 2
cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java | 17 ++
cloud-server-other/src/main/java/com/dsh/other/service/impl/ProtocolServiceImpl.java | 15 ++
cloud-server-account/src/main/java/com/dsh/account/controller/AppUserController.java | 41 ++++++
cloud-server-other/src/main/java/com/dsh/other/service/impl/TImgConfigServiceImpl.java | 2
cloud-server-other/src/main/java/com/dsh/other/entity/TImgConfig.java | 8
cloud-server-other/src/main/java/com/dsh/other/service/IProtocolService.java | 11 +
cloud-server-account/src/main/java/com/dsh/account/service/TAppUserService.java | 11 +
cloud-server-other/src/main/java/com/dsh/other/controller/ProtocolController.java | 45 +++++++
16 files changed, 211 insertions(+), 123 deletions(-)
diff --git a/cloud-server-account/src/main/java/com/dsh/account/controller/AppUserController.java b/cloud-server-account/src/main/java/com/dsh/account/controller/AppUserController.java
new file mode 100644
index 0000000..b64144b
--- /dev/null
+++ b/cloud-server-account/src/main/java/com/dsh/account/controller/AppUserController.java
@@ -0,0 +1,41 @@
+package com.dsh.account.controller;
+
+import com.dsh.account.service.TAppUserService;
+import com.dsh.account.util.ResultUtil;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * @author zhibing.pu
+ * @date 2023/6/14 15:30
+ */
+@RestController
+@RequestMapping("")
+public class AppUserController {
+
+ @Autowired
+ private TAppUserService appUserService;
+
+
+
+
+ @ResponseBody
+ @PostMapping("/base/appUser/getSMSCode")
+ @ApiOperation(value = "获取短信验证码", tags = {"用户—登录注册"})
+ @ApiImplicitParams({
+ @ApiImplicitParam(value = "类型(1:登录,2:注册,3:修改密码,4:忘记密码)", name = "type", dataType = "int", required = true),
+ @ApiImplicitParam(value = "电话号码", name = "phone", dataType = "string", required = true)
+ })
+ public ResultUtil getSMSCode(@RequestBody Integer type, @RequestBody String phone){
+ try {
+ ResultUtil smsCode = appUserService.getSMSCode(type, phone);
+ return smsCode;
+ }catch (Exception e){
+ e.printStackTrace();
+ return ResultUtil.runErr();
+ }
+ }
+}
diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/TAppUserService.java b/cloud-server-account/src/main/java/com/dsh/account/service/TAppUserService.java
index f1709fe..1232e65 100644
--- a/cloud-server-account/src/main/java/com/dsh/account/service/TAppUserService.java
+++ b/cloud-server-account/src/main/java/com/dsh/account/service/TAppUserService.java
@@ -3,6 +3,7 @@
import com.dsh.account.entity.TAppUser;
import com.baomidou.mybatisplus.service.IService;
import com.dsh.account.model.vo.classDetails.classInsVo.ClassInfoVo;
+import com.dsh.account.util.ResultUtil;
/**
* <p>
@@ -15,4 +16,14 @@
public interface TAppUserService extends IService<TAppUser> {
ClassInfoVo queryUserOfStus(Integer id);
+
+
+ /**
+ * 获取短信验证码
+ * @param type
+ * @param phone
+ * @return
+ * @throws Exception
+ */
+ ResultUtil getSMSCode(Integer type, String phone) throws Exception;
}
diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java
index e401e8d..88c8ab8 100644
--- a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java
+++ b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java
@@ -10,6 +10,7 @@
import com.dsh.account.mapper.TAppUserMapper;
import com.dsh.account.model.vo.classDetails.classInsVo.ClassInfoVo;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.dsh.account.util.ResultUtil;
import com.dsh.account.util.ToolUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -54,4 +55,20 @@
}
return null;
}
+
+
+ /**
+ * 获取短信验证码
+ * @param type 1:登录,2:注册,3:修改密码,4:忘记密码
+ * @param phone
+ * @return
+ * @throws Exception
+ */
+ @Override
+ public ResultUtil getSMSCode(Integer type, String phone) throws Exception {
+ if(type == 2){
+// this.baseMapper.selectOne(new EntityWrapper<>())
+ }
+ return null;
+ }
}
diff --git a/cloud-server-other/pom.xml b/cloud-server-other/pom.xml
index 1c6fbcb..31d2638 100644
--- a/cloud-server-other/pom.xml
+++ b/cloud-server-other/pom.xml
@@ -75,32 +75,6 @@
<artifactId>swagger-models</artifactId>
<version>1.5.22</version>
</dependency>
-
-
- <!-- mybatis generertor-->
-
- <dependency>
- <groupId>com.baomidou</groupId>
- <artifactId>mybatisplus-spring-boot-starter</artifactId>
- <version>1.0.5</version>
- </dependency>
-
- <dependency>
- <groupId>com.baomidou</groupId>
- <artifactId>mybatis-plus</artifactId>
- <version>3.4.1</version>
- </dependency>
- <dependency>
- <groupId>com.baomidou</groupId>
- <artifactId>mybatis-plus-generate</artifactId>
- <version>2.3</version>
- </dependency>
- <dependency>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity</artifactId>
- <version>1.7</version>
- </dependency>
-
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/ImgConfigController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/ImgConfigController.java
index 17019b6..6c46c90 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/controller/ImgConfigController.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/controller/ImgConfigController.java
@@ -1,6 +1,6 @@
package com.dsh.other.controller;
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dsh.other.entity.TImgConfig;
import com.dsh.other.service.TImgConfigService;
import io.swagger.annotations.Api;
@@ -32,7 +32,7 @@
*/
@PostMapping("/imgConfig/getNoneStu")
public List<TImgConfig> getDriver(){
- return imgConfigService.selectList(new EntityWrapper<TImgConfig>()
+ return imgConfigService.list(new QueryWrapper<TImgConfig>()
.eq("position", 1));
}
diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/ProtocolController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/ProtocolController.java
new file mode 100644
index 0000000..8394193
--- /dev/null
+++ b/cloud-server-other/src/main/java/com/dsh/other/controller/ProtocolController.java
@@ -0,0 +1,45 @@
+package com.dsh.other.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.dsh.other.entity.Protocol;
+import com.dsh.other.service.IProtocolService;
+import com.dsh.other.util.ResultUtil;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * @author zhibing.pu
+ * @date 2023/6/14 15:06
+ */
+@RestController
+@RequestMapping("/base/protocol")
+public class ProtocolController {
+
+ @Autowired
+ private IProtocolService protocolService;
+
+
+
+ @ResponseBody
+ @PostMapping("/queryProtocol")
+ @ApiOperation(value = "获取各种协议", tags = {"用户—登录注册"})
+ @ApiImplicitParams({
+ @ApiImplicitParam(value = "类型(1=用户协议,2=隐私协议,3=运动安全公告书)", name = "type", dataType = "int", required = true)
+ })
+ public ResultUtil<String> queryProtocol(@RequestBody Integer type){
+ try {
+ Protocol protocol = protocolService.getBaseMapper().selectOne(new QueryWrapper<Protocol>().eq("type", type));
+ return ResultUtil.success(protocol.getContent());
+ }catch (Exception e){
+ e.printStackTrace();
+ return ResultUtil.runErr();
+ }
+ }
+
+
+
+
+}
diff --git a/cloud-server-other/src/main/java/com/dsh/other/entity/Protocol.java b/cloud-server-other/src/main/java/com/dsh/other/entity/Protocol.java
new file mode 100644
index 0000000..c8cc59e
--- /dev/null
+++ b/cloud-server-other/src/main/java/com/dsh/other/entity/Protocol.java
@@ -0,0 +1,38 @@
+package com.dsh.other.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author zhibing.pu
+ * @date 2023/6/14 14:59
+ */
+@Data
+@TableName
+public class Protocol {
+ /**
+ * 主键
+ */
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+ /**
+ * 数据类型(1=用户协议,2=隐私协议,3=运动安全公告书)
+ */
+ @TableField("type")
+ private Integer type;
+ /**
+ * 内容
+ */
+ @TableField("content")
+ private String content;
+ /**
+ * 添加时间
+ */
+ @TableField("insertTime")
+ private Date insertTime;
+}
diff --git a/cloud-server-other/src/main/java/com/dsh/other/entity/TImgConfig.java b/cloud-server-other/src/main/java/com/dsh/other/entity/TImgConfig.java
index 00a14a1..10e7b88 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/entity/TImgConfig.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/entity/TImgConfig.java
@@ -1,11 +1,11 @@
package com.dsh.other.entity;
-import com.baomidou.mybatisplus.enums.IdType;
-import com.baomidou.mybatisplus.annotations.TableId;
-import com.baomidou.mybatisplus.activerecord.Model;
-import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
diff --git a/cloud-server-other/src/main/java/com/dsh/other/mapper/ProtocolMapper.java b/cloud-server-other/src/main/java/com/dsh/other/mapper/ProtocolMapper.java
new file mode 100644
index 0000000..7a407e1
--- /dev/null
+++ b/cloud-server-other/src/main/java/com/dsh/other/mapper/ProtocolMapper.java
@@ -0,0 +1,11 @@
+package com.dsh.other.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.dsh.other.entity.Protocol;
+
+/**
+ * @author zhibing.pu
+ * @date 2023/6/14 15:03
+ */
+public interface ProtocolMapper extends BaseMapper<Protocol> {
+}
diff --git a/cloud-server-other/src/main/java/com/dsh/other/mapper/TImgConfigMapper.java b/cloud-server-other/src/main/java/com/dsh/other/mapper/TImgConfigMapper.java
index 9064e72..eaffc00 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/mapper/TImgConfigMapper.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/mapper/TImgConfigMapper.java
@@ -1,7 +1,7 @@
package com.dsh.other.mapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsh.other.entity.TImgConfig;
-import com.baomidou.mybatisplus.mapper.BaseMapper;
/**
* <p>
diff --git a/cloud-server-other/src/main/java/com/dsh/other/service/IProtocolService.java b/cloud-server-other/src/main/java/com/dsh/other/service/IProtocolService.java
new file mode 100644
index 0000000..937a1dc
--- /dev/null
+++ b/cloud-server-other/src/main/java/com/dsh/other/service/IProtocolService.java
@@ -0,0 +1,11 @@
+package com.dsh.other.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.dsh.other.entity.Protocol;
+
+/**
+ * @author zhibing.pu
+ * @date 2023/6/14 15:04
+ */
+public interface IProtocolService extends IService<Protocol> {
+}
diff --git a/cloud-server-other/src/main/java/com/dsh/other/service/TImgConfigService.java b/cloud-server-other/src/main/java/com/dsh/other/service/TImgConfigService.java
index 3f90939..f460813 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/service/TImgConfigService.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/service/TImgConfigService.java
@@ -1,7 +1,7 @@
package com.dsh.other.service;
+import com.baomidou.mybatisplus.extension.service.IService;
import com.dsh.other.entity.TImgConfig;
-import com.baomidou.mybatisplus.service.IService;
/**
* <p>
diff --git a/cloud-server-other/src/main/java/com/dsh/other/service/impl/ProtocolServiceImpl.java b/cloud-server-other/src/main/java/com/dsh/other/service/impl/ProtocolServiceImpl.java
new file mode 100644
index 0000000..7d9ba39
--- /dev/null
+++ b/cloud-server-other/src/main/java/com/dsh/other/service/impl/ProtocolServiceImpl.java
@@ -0,0 +1,15 @@
+package com.dsh.other.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.dsh.other.entity.Protocol;
+import com.dsh.other.mapper.ProtocolMapper;
+import com.dsh.other.service.IProtocolService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author zhibing.pu
+ * @date 2023/6/14 15:05
+ */
+@Service
+public class ProtocolServiceImpl extends ServiceImpl<ProtocolMapper, Protocol> implements IProtocolService {
+}
diff --git a/cloud-server-other/src/main/java/com/dsh/other/service/impl/TImgConfigServiceImpl.java b/cloud-server-other/src/main/java/com/dsh/other/service/impl/TImgConfigServiceImpl.java
index a2be308..d5ed258 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/service/impl/TImgConfigServiceImpl.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/service/impl/TImgConfigServiceImpl.java
@@ -1,9 +1,9 @@
package com.dsh.other.service.impl;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dsh.other.entity.TImgConfig;
import com.dsh.other.mapper.TImgConfigMapper;
import com.dsh.other.service.TImgConfigService;
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
diff --git a/cloud-server-other/src/main/java/com/dsh/other/util/CodeGeneration.java b/cloud-server-other/src/main/java/com/dsh/other/util/CodeGeneration.java
deleted file mode 100644
index 07ab976..0000000
--- a/cloud-server-other/src/main/java/com/dsh/other/util/CodeGeneration.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package com.dsh.other.util;
-
-import com.baomidou.mybatisplus.enums.IdType;
-import com.baomidou.mybatisplus.generator.AutoGenerator;
-import com.baomidou.mybatisplus.generator.config.*;
-import com.baomidou.mybatisplus.generator.config.rules.DbType;
-import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
-
-public class CodeGeneration {
-
- public static void gen(String tableName){
-
- //C:\Users\linla\Desktop\project02\guns-admin
- //项目目录
- //
- String projectPath = "/Users/java/IdeaProjects/PlayPai_demo/cloud-server-other/src/main/java/"; //System.getProperty("user.dir");
- //String projectPath =System.getProperty("user.dir");
- AutoGenerator mpg = new AutoGenerator();
- //全局配置
- GlobalConfig gc = new GlobalConfig();
- gc.setOutputDir(projectPath );
- gc.setFileOverride(true);
- gc.setActiveRecord(true);//不需要ActiveRecord特性的请改为false
- gc.setEnableCache(false);//XML二级缓存
- gc.setBaseResultMap(true);//XML ResultMap
- gc.setBaseColumnList(false);//XML columList
- gc.setIdType(IdType.UUID);
- gc.setAuthor("administrator");//作者
- gc.setOpen(false);//生成完成不打开文件夹
-
- //自定义文件命名,注意%s 会自动填充表实体属性
- gc.setServiceName("%sService");
- gc.setServiceImplName("%sServiceImpl");
- gc.setMapperName("%sMapper");
- gc.setXmlName("%sMapper");
- gc.setControllerName("%sController");
- mpg.setGlobalConfig(gc);
-
- //数据源配置
- DataSourceConfig dsc = new DataSourceConfig();
- dsc.setDbType(DbType.MYSQL);
-// dsc.setUrl("jdbc:mysql://192.168.110.80:3306/playpai_account?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8");
- dsc.setUrl("jdbc:mysql://127.0.0.1:3306/playpai_other?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8");
- dsc.setDriverName("com.mysql.cj.jdbc.Driver");
- dsc.setUsername("root");
- dsc.setPassword("earl9096");
- mpg.setDataSource(dsc);
-
- //数据库表配置
- StrategyConfig strategy = new StrategyConfig();
- strategy.setTablePrefix(new String[]{});//此处可以修改您的表前缀
- strategy.setNaming(NamingStrategy.underline_to_camel);//表名生成策略
- strategy.setInclude(new String[]{tableName});//需要生成的表
- strategy.setRestControllerStyle(true);
- strategy.setEntityLombokModel(true);
- strategy.setSuperServiceClass(null);
- strategy.setSuperServiceImplClass(null);
- strategy.setSuperMapperClass(null);
- mpg.setStrategy(strategy);
-
- //模板配置
- TemplateConfig template=new TemplateConfig();
- //不生成controller
- template.setController(null);
- //不生成xml文件
- //template.setXml(null);
- mpg.setTemplate(template);
- //包配置
- PackageConfig pc = new PackageConfig();
- pc.setParent("com.dsh.app");
- pc.setEntity("entity");
- pc.setService("service");
- pc.setServiceImpl("service.impl");
- pc.setMapper("mapper");
-
- pc.setXml("mapper.xml");
-
-// pc.setController("controller.member");
- mpg.setPackageInfo(pc);
-
- //执行生成
- mpg.execute();
- }
-
- public static void main(String[] args) {
- gen("t_img_config");
- }
-}
diff --git a/cloud-server-other/src/main/resources/mapper/ProtocolMapper.xml b/cloud-server-other/src/main/resources/mapper/ProtocolMapper.xml
new file mode 100644
index 0000000..ed16439
--- /dev/null
+++ b/cloud-server-other/src/main/resources/mapper/ProtocolMapper.xml
@@ -0,0 +1,13 @@
+<?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.dsh.other.mapper.ProtocolMapper">
+
+ <!-- 通用查询映射结果 -->
+ <resultMap id="BaseResultMap" type="com.dsh.other.entity.Protocol">
+ <id column="id" property="id" />
+ <result column="type" property="type" />
+ <result column="content" property="content" />
+ <result column="insertTime" property="insertTime" />
+ </resultMap>
+
+</mapper>
--
Gitblit v1.7.1