diff --git a/luoo_user/pom.xml b/luoo_user/pom.xml index 49226ee..73faf45 100644 --- a/luoo_user/pom.xml +++ b/luoo_user/pom.xml @@ -134,6 +134,19 @@ core 3.5.1 + + + + com.baomidou + mybatis-plus-boot-starter + ${mybatis-plus.version} + + + com.baomidou + mybatis-plus-extension + ${mybatis-plus.version} + compile + app diff --git a/luoo_user/src/main/java/com/luoo/user/controller/TestController.java b/luoo_user/src/main/java/com/luoo/user/controller/TestController.java new file mode 100644 index 0000000..51182cc --- /dev/null +++ b/luoo_user/src/main/java/com/luoo/user/controller/TestController.java @@ -0,0 +1,49 @@ +package com.luoo.user.controller; + +import api.Result; +import com.luoo.user.pojo.WithdrawMybatis; +import com.luoo.user.service.WithdrawService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import util.IdWorker; + +import java.math.BigDecimal; +import java.util.List; + +/** + * @program: luoo_parent + * @description: test + * @author: yawei.huang + * @create: 2024-08-06 11:15 + **/ +@RestController +@CrossOrigin +@Slf4j +public class TestController { + + @Autowired + private WithdrawService withdrawService; + + @Autowired + private IdWorker idWorker; + + @GetMapping("/test") + public Result> test() { + return Result.success(withdrawService.list()); + } + + @GetMapping("/test2") + public Result test2() { + WithdrawMybatis build = WithdrawMybatis.builder() + .id(String.valueOf(idWorker.nextId())) + .state(1) + .userId("111") + .amount(BigDecimal.valueOf(10.0)) + .build(); + boolean save = withdrawService.save(build); + return Result.success(); + } +} diff --git a/luoo_user/src/main/java/com/luoo/user/mapper/WithdrawMapper.java b/luoo_user/src/main/java/com/luoo/user/mapper/WithdrawMapper.java new file mode 100644 index 0000000..2de9f55 --- /dev/null +++ b/luoo_user/src/main/java/com/luoo/user/mapper/WithdrawMapper.java @@ -0,0 +1,19 @@ +package com.luoo.user.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.luoo.user.pojo.WithdrawMybatis; +import org.mapstruct.Mapper; + +/** +* @author ASUS +* @description 针对表【tb_withdraw(提现记录表)】的数据库操作Mapper +* @createDate 2024-08-06 11:11:52 +* @Entity generator.domain.Withdraw +*/ +public interface WithdrawMapper extends BaseMapper { + +} + + + + diff --git a/luoo_user/src/main/java/com/luoo/user/pojo/WithdrawMybatis.java b/luoo_user/src/main/java/com/luoo/user/pojo/WithdrawMybatis.java new file mode 100644 index 0000000..0cc9cc0 --- /dev/null +++ b/luoo_user/src/main/java/com/luoo/user/pojo/WithdrawMybatis.java @@ -0,0 +1,120 @@ +package com.luoo.user.pojo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Builder; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 提现记录表 + * @TableName tb_withdraw + */ +@TableName(value ="tb_withdraw") +@Data +@Builder +public class WithdrawMybatis implements Serializable { + /** + * + */ + @TableId + private String id; + + /** + * 提现状态 1-已发起 2-已完成 3-提现失败 + */ + private Integer state; + + /** + * 提现金额 + */ + private BigDecimal amount; + + /** + * 用户id + */ + private String userId; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 修改时间 + */ + private Date updateTime; + + /** + * 创建人 + */ + private String createUser; + + /** + * 修改人 + */ + private String updateUser; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + Withdraw other = (Withdraw) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState())) + && (this.getAmount() == null ? other.getAmount() == null : this.getAmount().equals(other.getAmount())) + && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) + && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) + && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) + && (this.getCreateUser() == null ? other.getCreateUser() == null : this.getCreateUser().equals(other.getCreateUser())) + && (this.getUpdateUser() == null ? other.getUpdateUser() == null : this.getUpdateUser().equals(other.getUpdateUser())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getState() == null) ? 0 : getState().hashCode()); + result = prime * result + ((getAmount() == null) ? 0 : getAmount().hashCode()); + result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode()); + result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); + result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); + result = prime * result + ((getCreateUser() == null) ? 0 : getCreateUser().hashCode()); + result = prime * result + ((getUpdateUser() == null) ? 0 : getUpdateUser().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", state=").append(state); + sb.append(", amount=").append(amount); + sb.append(", userId=").append(userId); + sb.append(", createTime=").append(createTime); + sb.append(", updateTime=").append(updateTime); + sb.append(", createUser=").append(createUser); + sb.append(", updateUser=").append(updateUser); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/luoo_user/src/main/java/com/luoo/user/service/WithdrawService.java b/luoo_user/src/main/java/com/luoo/user/service/WithdrawService.java new file mode 100644 index 0000000..42ff29d --- /dev/null +++ b/luoo_user/src/main/java/com/luoo/user/service/WithdrawService.java @@ -0,0 +1,13 @@ +package com.luoo.user.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.luoo.user.pojo.WithdrawMybatis; + +/** +* @author ASUS +* @description 针对表【tb_withdraw(提现记录表)】的数据库操作Service +* @createDate 2024-08-06 11:11:52 +*/ +public interface WithdrawService extends IService { + +} diff --git a/luoo_user/src/main/java/com/luoo/user/service/impl/WithdrawServiceImpl.java b/luoo_user/src/main/java/com/luoo/user/service/impl/WithdrawServiceImpl.java new file mode 100644 index 0000000..4aaaf3d --- /dev/null +++ b/luoo_user/src/main/java/com/luoo/user/service/impl/WithdrawServiceImpl.java @@ -0,0 +1,22 @@ +package com.luoo.user.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.luoo.user.mapper.WithdrawMapper; +import com.luoo.user.pojo.WithdrawMybatis; +import com.luoo.user.service.WithdrawService; +import org.springframework.stereotype.Service; + +/** +* @author ASUS +* @description 针对表【tb_withdraw(提现记录表)】的数据库操作Service实现 +* @createDate 2024-08-06 11:11:52 +*/ +@Service +public class WithdrawServiceImpl extends ServiceImpl + implements WithdrawService { + +} + + + + diff --git a/luoo_user/src/main/resources/bootstrap.yml b/luoo_user/src/main/resources/bootstrap.yml index 378cc89..07bcb4e 100644 --- a/luoo_user/src/main/resources/bootstrap.yml +++ b/luoo_user/src/main/resources/bootstrap.yml @@ -14,4 +14,31 @@ oauth2: appid: wxae6fb76efa147314 secret: 741727f12d1b262ac855b905bf2e60e2 appidShare: wx667f580d1605650b - secretShare: 4bb42de98cb422d733ac7d50e7cade3b \ No newline at end of file + secretShare: 4bb42de98cb422d733ac7d50e7cade3b +#mybatis-plus +mybatis-plus: + ## 这个可以不用配置,因其默认就是这个路径 + mapper-locations: classpath:/mapper/*Mapper.xml + #实体扫描,多个package用逗号或者分号分隔 + typeAliasesPackage: com.luoo.user.pojo + global-config: + # 数据库相关配置 + db-config: + #主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID",ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID"; + id-type: ASSIGN_ID + #字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断" + field-strategy: not_empty + #驼峰下划线转换 + column-underline: true + #数据库大写下划线转换 + #capital-mode: true + #逻辑删除配置 + logic-delete-value: 2 + logic-not-delete-value: 0 + db-type: h2 + #刷新mapper 调试神器 + refresh: true + # 原生配置 + configuration: + map-underscore-to-camel-case: true + cache-enabled: false \ No newline at end of file diff --git a/luoo_user/src/main/resources/mapper/WithdrawMapper.xml b/luoo_user/src/main/resources/mapper/WithdrawMapper.xml new file mode 100644 index 0000000..9172115 --- /dev/null +++ b/luoo_user/src/main/resources/mapper/WithdrawMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + id,state,amount, + user_id,create_time,update_time, + create_user,update_user + + diff --git a/pom.xml b/pom.xml index 0057d60..372caa6 100644 --- a/pom.xml +++ b/pom.xml @@ -41,6 +41,7 @@ 1.9.3 4.1.2 2.13.0 + 3.5.3.1