parent
476e5b8dd2
commit
710ae46e99
@ -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<List<WithdrawMybatis>> test() {
|
||||
return Result.success(withdrawService.list());
|
||||
}
|
||||
|
||||
@GetMapping("/test2")
|
||||
public Result<Void> 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();
|
||||
}
|
||||
}
|
@ -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<WithdrawMybatis> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -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<WithdrawMybatis> {
|
||||
|
||||
}
|
@ -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<WithdrawMapper, WithdrawMybatis>
|
||||
implements WithdrawService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,23 @@
|
||||
<?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.luoo.user.mapper.WithdrawMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.luoo.user.pojo.WithdrawMybatis">
|
||||
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="state" column="state" jdbcType="INTEGER"/>
|
||||
<result property="amount" column="amount" jdbcType="DECIMAL"/>
|
||||
<result property="userId" column="user_id" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="createUser" column="create_user" jdbcType="VARCHAR"/>
|
||||
<result property="updateUser" column="update_user" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,state,amount,
|
||||
user_id,create_time,update_time,
|
||||
create_user,update_user
|
||||
</sql>
|
||||
</mapper>
|
Loading…
Reference in new issue