CREATE TABLE merchant_purchase_stat_time ( id bigint unsigned NOT NULL AUTO_INCREMENT, stat_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '统计时间', PRIMARY KEY (id) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='店铺采购统计时间';根据表结构生成java的实体类,持久层,业务层
时间: 2024-02-24 07:59:17 浏览: 177
好的,根据表结构,以下是对应的Java实体类、持久层、业务层代码:
1. Java实体类代码:
```
import java.util.Date;
public class MerchantPurchaseStatTime {
private Long id;
private Date statTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Date getStatTime() {
return statTime;
}
public void setStatTime(Date statTime) {
this.statTime = statTime;
}
}
```
2. 持久层代码:
```
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface MerchantPurchaseStatTimeMapper {
@Insert("INSERT INTO merchant_purchase_stat_time (stat_time) VALUES (#{statTime})")
int insert(MerchantPurchaseStatTime merchantPurchaseStatTime);
}
```
3. 业务层代码:
```
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class MerchantPurchaseStatTimeService {
@Autowired
private MerchantPurchaseStatTimeMapper merchantPurchaseStatTimeMapper;
public void save(MerchantPurchaseStatTime merchantPurchaseStatTime) {
merchantPurchaseStatTimeMapper.insert(merchantPurchaseStatTime);
}
}
```
阅读全文