初始化

develop
fujichuan 2024-07-23 17:14:36 +08:00
parent d76eb3c8f1
commit a11df77e04
14 changed files with 525 additions and 12 deletions

View File

@ -12,7 +12,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration @Configuration
@EnableTransactionManagement @EnableTransactionManagement
@MapperScan("com.hydrogen.examSystem.dao") @MapperScan("com.hydrogen.applet.dao")
public class MyBatisPlusConfig { public class MyBatisPlusConfig {
/** /**
* *

View File

@ -23,10 +23,10 @@ import java.util.Scanner;
*/ */
public class MybatisGenerator { public class MybatisGenerator {
private static final String MYSQL_URL ="jdbc:mysql://120.46.194.248:13306/jhqm_exam?useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true"; private static final String MYSQL_URL ="jdbc:mysql://120.46.194.248:13306/hydrogen?useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true";
private static final String MYSQL_DRIVE ="com.mysql.cj.jdbc.Driver"; private static final String MYSQL_DRIVE ="com.mysql.cj.jdbc.Driver";
private static final String MYSQL_U ="exam_user"; private static final String MYSQL_U ="hydrogen_user";
private static final String MYSQL_P ="7Js$A2LcTKy="; private static final String MYSQL_P ="sFgo)_%h4CD5";
/** /**
@ -56,8 +56,8 @@ public class MybatisGenerator {
// 全局配置 // 全局配置
GlobalConfig gc = new GlobalConfig(); GlobalConfig gc = new GlobalConfig();
final String projectPath = System.getProperty("user.dir"); final String projectPath = System.getProperty("user.dir");
gc.setOutputDir(projectPath + "/src/main/java"); gc.setOutputDir("D:/soft/src/main/java");
gc.setAuthor("linyx"); gc.setAuthor("fjc");
gc.setOpen(false); gc.setOpen(false);
gc.setServiceName("%sService");// service 命名方式 gc.setServiceName("%sService");// service 命名方式
gc.setServiceImplName("%sServiceImpl");// service impl 命名方式 gc.setServiceImplName("%sServiceImpl");// service impl 命名方式
@ -85,7 +85,7 @@ public class MybatisGenerator {
// 包配置 // 包配置
PackageConfig pc = new PackageConfig(); PackageConfig pc = new PackageConfig();
//pc.setModuleName(scanner("模块名")); //pc.setModuleName(scanner("模块名"));
pc.setParent("com.hydrogen.examSystem"); pc.setParent("com.hydrogen.mbg");
pc.setEntity("entity"); pc.setEntity("entity");
pc.setService("service"); pc.setService("service");
pc.setServiceImpl("service.impl"); pc.setServiceImpl("service.impl");
@ -109,7 +109,7 @@ public class MybatisGenerator {
@Override @Override
public String outputFile(TableInfo tableInfo) { public String outputFile(TableInfo tableInfo) {
// 自定义输出文件名 // 自定义输出文件名
return projectPath + "/src/main/resources/mapping/" return "D:/soft/src/main/resources/mapping/"
+ tableInfo.getEntityName() + "Dao" + StringPool.DOT_XML; + tableInfo.getEntityName() + "Dao" + StringPool.DOT_XML;
} }
}); });
@ -133,8 +133,8 @@ public class MybatisGenerator {
strategy.setInclude(scanner("表名")); strategy.setInclude(scanner("表名"));
strategy.setControllerMappingHyphenStyle(true); strategy.setControllerMappingHyphenStyle(true);
strategy.setEntityLombokModel(true); strategy.setEntityLombokModel(true);
strategy.setTablePrefix("t_exam_system_"); // strategy.setTablePrefix("t_exam_system_");
strategy.setFieldPrefix("f_"); // strategy.setFieldPrefix("f_");
mpg.setStrategy(strategy); mpg.setStrategy(strategy);
mpg.setTemplateEngine(new FreemarkerTemplateEngine()); mpg.setTemplateEngine(new FreemarkerTemplateEngine());
mpg.execute(); mpg.execute();

View File

@ -0,0 +1,39 @@
package com.hydrogen.applet.config;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
/**
* @author fjc
* @company jhqm
* @create 2024-07-23 15:57
*/
@Configuration
public class WeixinConfig {
@Value("${wx.miniapp.app-id}")
private String appId;
@Value("${wx.miniapp.app-secret}")
private String appSecret;
@Value("${wx.miniapp.mch-id}")
private String mchId;
@Value("${wx.miniapp.msgDataFormat}")
private String msgDataFormat;
@Bean
public WxMaService wxMaService() {
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
config.setAppid(appId);
config.setSecret(appSecret);
config.setMsgDataFormat(msgDataFormat);
// config.setToken(environment.getProperty("wx.miniapp.token"));
// config.setAesKey(environment.getProperty("wx.miniapp.aesKey"));
WxMaService service = new WxMaServiceImpl();
service.setWxMaConfig(config);
return service;
}
}

View File

@ -0,0 +1,28 @@
package com.hydrogen.applet.controller;
import cn.binarywang.wx.miniapp.api.WxMaService;
import com.hydrogen.mbg.dto.applet.LoginDTO;
import com.hydrogen.mbg.vo.DrhtResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@RestController
@RequestMapping("/applet/login")
@Api(tags = "小程序登录注册")
public class LoginController {
@PostMapping("/login")
@ApiOperation(value = "小程序登录注册")
public DrhtResult login(@RequestBody @Validated LoginDTO dto) {
return null;
}
}

View File

@ -0,0 +1,16 @@
package com.hydrogen.applet.dao;
import com.hydrogen.mbg.entity.Member;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper
* </p>
*
* @author fjc
* @since 2024-07-23
*/
public interface MemberDao extends BaseMapper<Member> {
}

View File

@ -0,0 +1,26 @@
package com.hydrogen.applet.service.Impl;
import cn.binarywang.wx.miniapp.api.WxMaService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hydrogen.applet.dao.MemberDao;
import com.hydrogen.applet.service.LoginService;
import com.hydrogen.mbg.entity.Member;
import com.hydrogen.mbg.entity.Paper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author fjc
* @company jhqm
* @create 2024-07-23 16:28
*/
@Service
public class LoginServiceImpl extends ServiceImpl<MemberDao, Member> implements LoginService {
private final WxMaService wxService;
@Autowired
public LoginServiceImpl(WxMaService wxService) {
this.wxService = wxService;
}
}

View File

@ -0,0 +1,16 @@
package com.hydrogen.applet.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hydrogen.mbg.entity.Member;
import com.hydrogen.mbg.entity.Paper;
/**
* @author fjc
* @company jhqm
* @create 2024-07-23 16:27
*/
public interface LoginService extends IService<Member> {
}

View File

@ -69,3 +69,19 @@ jwt:
secret: hydrogenUserSecret secret: hydrogenUserSecret
expiration: 604800 expiration: 604800
tokenHead: hydrogenBearer tokenHead: hydrogenBearer
wx:
miniapp:
app-id: wx660c9f833e43ce25 #微信小程序的appid
app-secret: 6160ae34e8617af8a8b7adcd468d898a #微信小程序的Secret # 小程序密钥
# 商户号
mch-id: 1668300858
# 证书序列号
mch-serial-no: 66381F5B62A3E8D1AF847A17386AEFD99DA7B8C7
# apiv3密钥
api-key:
# 回调接口地址
# notify-url: https://xxxx/a/biz/wxpay/payNotify
# 证书地址
key-path:
#消息格式
msgDataFormat: JSON

View File

@ -0,0 +1,52 @@
<?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.hydrogen.mbg.dao.MemberDao">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.hydrogen.mbg.entity.Member">
<id column="member_id" property="memberId" />
<result column="user_name" property="userName" />
<result column="nick_name" property="nickName" />
<result column="user_photo" property="userPhoto" />
<result column="user_sex" property="userSex" />
<result column="birthday" property="birthday" />
<result column="region_id" property="regionId" />
<result column="region_name" property="regionName" />
<result column="phone" property="phone" />
<result column="login_pws" property="loginPws" />
<result column="bank_account" property="bankAccount" />
<result column="pay_pws" property="payPws" />
<result column="total_recharge" property="totalRecharge" />
<result column="balance" property="balance" />
<result column="qingbao" property="qingbao" />
<result column="toatl_profit" property="toatlProfit" />
<result column="profit_balance" property="profitBalance" />
<result column="total_integral" property="totalIntegral" />
<result column="integral_balance" property="integralBalance" />
<result column="Column_35" property="column35" />
<result column="Column_36" property="column36" />
<result column="Column_37" property="column37" />
<result column="Column_38" property="column38" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="enabled" property="enabled" />
<result column="terminal" property="terminal" />
<result column="last_login" property="lastLogin" />
<result column="salt" property="salt" />
<result column="reg_canal" property="regCanal" />
<result column="parent_uid" property="parentUid" />
<result column="wx_uid" property="wxUid" />
<result column="wx_opid" property="wxOpid" />
<result column="xcx_opid" property="xcxOpid" />
<result column="tenant_id" property="tenantId" />
<result column="site_id" property="siteId" />
<result column="agent_id" property="agentId" />
<result column="shop_id" property="shopId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
member_id, user_name, nick_name, user_photo, user_sex, birthday, region_id, region_name, phone, login_pws, bank_account, pay_pws, total_recharge, balance, qingbao, toatl_profit, profit_balance, total_integral, integral_balance, Column_35, Column_36, Column_37, Column_38, create_time, update_time, enabled, terminal, last_login, salt, reg_canal, parent_uid, wx_uid, wx_opid, xcx_opid, tenant_id, site_id, agent_id, shop_id
</sql>
</mapper>

View File

@ -16,5 +16,20 @@
<maven.compiler.target>8</maven.compiler.target> <maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<dependencies>
<!-- MyBatis-Plus -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
<!-- MyBatis-Plus 自动代码生成器 -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</dependency>
</dependencies>
</project> </project>

View File

@ -0,0 +1,19 @@
package com.hydrogen.mbg.dto.applet;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Data
@ApiModel(value = "小程序登录DTO")
public class LoginDTO {
@ApiModelProperty(value = "登录凭证code",required = true)
@NotNull(message = "登录凭证code不能为空")
private String code;
@ApiModelProperty(value = "携带场景请求参数,格式为a=1#b=2")
private String scene;
}

View File

@ -0,0 +1,190 @@
package com.hydrogen.mbg.entity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.time.LocalDate;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
*
* </p>
*
* @author fjc
* @since 2024-07-23
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("member")
@ApiModel(value="Member对象", description="会员表")
public class Member extends Model<Member> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "会员编号")
@TableId(value = "member_id", type = IdType.AUTO)
private Integer memberId;
@ApiModelProperty(value = "真实姓名")
@TableField("user_name")
private String userName;
@ApiModelProperty(value = "会员昵称")
@TableField("nick_name")
private String nickName;
@ApiModelProperty(value = "会员头像")
@TableField("user_photo")
private String userPhoto;
@ApiModelProperty(value = "会员性别0保密1男2女")
@TableField("user_sex")
private Integer userSex;
@ApiModelProperty(value = "出生日期")
@TableField("birthday")
private LocalDate birthday;
@ApiModelProperty(value = "城市编码")
@TableField("region_id")
private Integer regionId;
@ApiModelProperty(value = "城市名称:如河北省 石家庄 裕华区 ")
@TableField("region_name")
private String regionName;
@ApiModelProperty(value = "手机号码")
@TableField("phone")
private String phone;
@ApiModelProperty(value = "登录密码")
@TableField("login_pws")
private String loginPws;
@ApiModelProperty(value = "银行账户{开户行,名称,账号}")
@TableField("bank_account")
private String bankAccount;
@ApiModelProperty(value = "支付密码")
@TableField("pay_pws")
private String payPws;
@ApiModelProperty(value = "累计充值")
@TableField("total_recharge")
private BigDecimal totalRecharge;
@ApiModelProperty(value = "钱包余额")
@TableField("balance")
private BigDecimal balance;
@ApiModelProperty(value = "氢宝余额")
@TableField("qingbao")
private BigDecimal qingbao;
@ApiModelProperty(value = "累计收益")
@TableField("toatl_profit")
private BigDecimal toatlProfit;
@ApiModelProperty(value = "收益余额")
@TableField("profit_balance")
private BigDecimal profitBalance;
@ApiModelProperty(value = "总积分数")
@TableField("total_integral")
private Integer totalIntegral;
@ApiModelProperty(value = "积分余额")
@TableField("integral_balance")
private Integer integralBalance;
@ApiModelProperty(value = "吸氢时长")
@TableField("Column_35")
private String column35;
@ApiModelProperty(value = "当前排名")
@TableField("Column_36")
private String column36;
@ApiModelProperty(value = "健康标签")
@TableField("Column_37")
private String column37;
@TableField("Column_38")
private String column38;
@ApiModelProperty(value = "注册时间")
@TableField("create_time")
private LocalDateTime createTime;
@ApiModelProperty(value = "修改时间")
@TableField("update_time")
private LocalDateTime updateTime;
@ApiModelProperty(value = "账号状态0禁用1开通")
@TableField("enabled")
private Boolean enabled;
@ApiModelProperty(value = "注册终端1安卓2苹果3H54小程序")
@TableField("terminal")
private Integer terminal;
@ApiModelProperty(value = "登录时间")
@TableField("last_login")
private LocalDateTime lastLogin;
@ApiModelProperty(value = "散列值号")
@TableField("salt")
private String salt;
@ApiModelProperty(value = "来源渠道1自由注册2终端店面3店内员工4会员分享5其他来源")
@TableField("reg_canal")
private Integer regCanal;
@ApiModelProperty(value = "推广人员编号")
@TableField("parent_uid")
private Integer parentUid;
@ApiModelProperty(value = "微信uid")
@TableField("wx_uid")
private String wxUid;
@ApiModelProperty(value = "微信openid")
@TableField("wx_opid")
private String wxOpid;
@ApiModelProperty(value = "小程序openid")
@TableField("xcx_opid")
private String xcxOpid;
@ApiModelProperty(value = "厂商编号")
@TableField("tenant_id")
private Integer tenantId;
@ApiModelProperty(value = "站点编号")
@TableField("site_id")
private Integer siteId;
@ApiModelProperty(value = "渠道编号")
@TableField("agent_id")
private Integer agentId;
@ApiModelProperty(value = "商户编号")
@TableField("shop_id")
private Integer shopId;
@Override
protected Serializable pkVal() {
return this.memberId;
}
}

View File

@ -0,0 +1,78 @@
package com.hydrogen.mbg.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 com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
*
* </p>
*
* @author zp
* @since 2024-06-05
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("t_exam_system_paper")
@ApiModel(value="Paper对象", description="考试表")
public class Paper extends Model<Paper> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "f_id")
@TableId(value = "f_id", type = IdType.ASSIGN_ID)
private Long id;
@ApiModelProperty(value = "考试名称")
@TableField("f_paper_name")
private String paperName;
@ApiModelProperty(value = "考试开始时间")
@TableField("f_start_time")
private LocalDateTime startTime;
@ApiModelProperty(value = "考试结束时间")
@TableField("f_end_time")
private LocalDateTime endTime;
@ApiModelProperty(value = "考试模式 1固定试题 2随机试题")
@TableField("f_exam_type")
private Integer examType;
@ApiModelProperty(value = "考试规则")
@TableField("f_exam_rule")
private String examRule;
@ApiModelProperty(value = "科目库id")
@TableField("f_subject_id")
private Long subjectId;
@ApiModelProperty(value = "发布状态 1未发布 2已发布")
@TableField("f_status")
private Integer status;
@ApiModelProperty(value = "组织id")
@TableField("f_org_id")
private Long orgId;
@ApiModelProperty(value = "插入时间")
@TableField("f_create_time")
private LocalDateTime createTime;
@Override
protected Serializable pkVal() {
return this.id;
}
}

View File

@ -0,0 +1,18 @@
package com.hydrogen.mbg.vo.applet;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Data
@ApiModel(value = "小程序登录返回VO")
public class LoginVO {
@ApiModelProperty(value = "登录凭证code")
private String code;
@ApiModelProperty(value = "携带场景请求参数,格式为a=1#b=2")
private String scene;
}