电池基本信息管理
This commit is contained in:
parent
ed48b01e33
commit
591f23867c
@ -0,0 +1,89 @@
|
|||||||
|
package com.cdzy.operations.controller;
|
||||||
|
|
||||||
|
import com.cdzy.operations.model.entity.EbikeBatteryInfo;
|
||||||
|
import com.cdzy.operations.service.EbikeBatteryInfoService;
|
||||||
|
import com.mybatisflex.core.paginate.Page;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池基本信息 控制层。
|
||||||
|
*
|
||||||
|
* @author attiya
|
||||||
|
* @since 2025-09-15
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/ebikeBatteryInfo")
|
||||||
|
public class EbikeBatteryInfoController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private EbikeBatteryInfoService ebikeBatteryInfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加电池基本信息。
|
||||||
|
*
|
||||||
|
* @param ebikeBatteryInfo 电池基本信息
|
||||||
|
* @return {@code true} 添加成功,{@code false} 添加失败
|
||||||
|
*/
|
||||||
|
@PostMapping("save")
|
||||||
|
public boolean save(@RequestBody EbikeBatteryInfo ebikeBatteryInfo) {
|
||||||
|
return ebikeBatteryInfoService.save(ebikeBatteryInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据主键删除电池基本信息。
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return {@code true} 删除成功,{@code false} 删除失败
|
||||||
|
*/
|
||||||
|
@DeleteMapping("remove/{id}")
|
||||||
|
public boolean remove(@PathVariable Long id) {
|
||||||
|
return ebikeBatteryInfoService.removeById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据主键更新电池基本信息。
|
||||||
|
*
|
||||||
|
* @param ebikeBatteryInfo 电池基本信息
|
||||||
|
* @return {@code true} 更新成功,{@code false} 更新失败
|
||||||
|
*/
|
||||||
|
@PutMapping("update")
|
||||||
|
public boolean update(@RequestBody EbikeBatteryInfo ebikeBatteryInfo) {
|
||||||
|
return ebikeBatteryInfoService.updateById(ebikeBatteryInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有电池基本信息。
|
||||||
|
*
|
||||||
|
* @return 所有数据
|
||||||
|
*/
|
||||||
|
@GetMapping("list")
|
||||||
|
public List<EbikeBatteryInfo> list() {
|
||||||
|
return ebikeBatteryInfoService.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据电池基本信息主键获取详细信息。
|
||||||
|
*
|
||||||
|
* @param id 电池基本信息主键
|
||||||
|
* @return 电池基本信息详情
|
||||||
|
*/
|
||||||
|
@GetMapping("getInfo/{id}")
|
||||||
|
public EbikeBatteryInfo getInfo(@PathVariable Long id) {
|
||||||
|
return ebikeBatteryInfoService.getById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询电池基本信息。
|
||||||
|
*
|
||||||
|
* @param page 分页对象
|
||||||
|
* @return 分页对象
|
||||||
|
*/
|
||||||
|
@GetMapping("page")
|
||||||
|
public Page<EbikeBatteryInfo> page(Page<EbikeBatteryInfo> page) {
|
||||||
|
return ebikeBatteryInfoService.page(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.cdzy.operations.mapper;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.cdzy.operations.model.entity.EbikeBatteryInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池基本信息 映射层。
|
||||||
|
*
|
||||||
|
* @author attiya
|
||||||
|
* @since 2025-09-15
|
||||||
|
*/
|
||||||
|
public interface EbikeBatteryInfoMapper extends BaseMapper<EbikeBatteryInfo> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,67 @@
|
|||||||
|
package com.cdzy.operations.model.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池基本信息 实体类。
|
||||||
|
*
|
||||||
|
* @author attiya
|
||||||
|
* @since 2025-09-15
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table("ebike_battery_info")
|
||||||
|
public class EbikeBatteryInfo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池ID
|
||||||
|
*/
|
||||||
|
@Id
|
||||||
|
private Long batteryId;
|
||||||
|
|
||||||
|
@Column(tenantId = true)
|
||||||
|
private Long operatorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池编号
|
||||||
|
*/
|
||||||
|
private String batteryCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@Column(onInsertValue = "now()")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
private Long createdBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@Column(onUpdateValue = "now()")
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
private Long updatedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除状态(true表示已删除)
|
||||||
|
*/
|
||||||
|
@Column(isLogicDelete = true)
|
||||||
|
private Boolean isDeleted;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.cdzy.operations.service;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
import com.cdzy.operations.model.entity.EbikeBatteryInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池基本信息 服务层。
|
||||||
|
*
|
||||||
|
* @author attiya
|
||||||
|
* @since 2025-09-15
|
||||||
|
*/
|
||||||
|
public interface EbikeBatteryInfoService extends IService<EbikeBatteryInfo> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.cdzy.operations.service.impl;
|
||||||
|
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import com.cdzy.operations.model.entity.EbikeBatteryInfo;
|
||||||
|
import com.cdzy.operations.mapper.EbikeBatteryInfoMapper;
|
||||||
|
import com.cdzy.operations.service.EbikeBatteryInfoService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池基本信息 服务层实现。
|
||||||
|
*
|
||||||
|
* @author attiya
|
||||||
|
* @since 2025-09-15
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class EbikeBatteryInfoServiceImpl extends ServiceImpl<EbikeBatteryInfoMapper, EbikeBatteryInfo> implements EbikeBatteryInfoService{
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user