CREATE TABLE `order_cancel_freight_record` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT, `created_at` datetime(3) DEFAULT NULL, `order_id` bigint unsigned NOT NULL COMMENT '订单号', `freight_amount` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '订单运费', `operation` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '操作人', `approval_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '审批单号', `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注', PRIMARY KEY (`id`) USING BTREE, KEY `order_id` (`order_id`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=276 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='订单免除运费记录';根据表结构生成java的实体类,持久层,业务层,并添加注释
时间: 2024-03-31 10:34:21 浏览: 166
create table
5星 · 资源好评率100%
好的,我可以帮您生成相应的代码,以下是生成的代码,其中注释仅供参考:
实体类:
```java
import java.math.BigDecimal;
import java.util.Date;
/**
* 订单免除运费记录实体类
*/
public class OrderCancelFreightRecord {
/** 自增主键 */
private Long id;
/** 创建时间 */
private Date createdAt;
/** 订单号 */
private Long orderId;
/** 订单运费 */
private BigDecimal freightAmount;
/** 操作人 */
private String operation;
/** 审批单号 */
private String approvalNo;
/** 备注 */
private String remark;
// getter 和 setter 方法
}
```
持久层:
```java
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 订单免除运费记录持久层接口
*/
@Mapper
public interface OrderCancelFreightRecordMapper {
/**
* 新增订单免除运费记录
* @param record 订单免除运费记录
*/
void insert(OrderCancelFreightRecord record);
/**
* 根据订单号查询订单免除运费记录
* @param orderId 订单号
* @return 订单免除运费记录
*/
OrderCancelFreightRecord selectByOrderId(@Param("orderId") Long orderId);
// 其他常用的持久层方法
}
```
业务层:
```java
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* 订单免除运费记录业务层实现类
*/
@Service
public class OrderCancelFreightRecordServiceImpl implements OrderCancelFreightRecordService {
@Autowired
private OrderCancelFreightRecordMapper orderCancelFreightRecordMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public void insert(OrderCancelFreightRecord record) {
orderCancelFreightRecordMapper.insert(record);
}
@Override
public OrderCancelFreightRecord selectByOrderId(Long orderId) {
return orderCancelFreightRecordMapper.selectByOrderId(orderId);
}
// 其他常用的业务层方法
}
```
希望这份代码可以帮助到您!
阅读全文