This commit is contained in:
PQZ 2024-10-10 19:42:48 +08:00
parent eebe5ef676
commit 3c3bef85b8
12 changed files with 135 additions and 144 deletions

View File

@ -1,21 +1,12 @@
package cn.iocoder.yudao.module.base.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
import cn.iocoder.yudao.module.base.vo.RepairRecordsPageReqVO;
import cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO;
import cn.iocoder.yudao.module.base.vo.RepairRecordsSaveReqVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
* 维修记录 管理 API
@ -30,43 +21,5 @@ public class RepairRecordsController {
@Resource
private RepairRecordsService repairRecordsService;
@PostMapping("/create")
@Operation(summary = "创建维修记录")
public CommonResult<String> createRepairRecords(@Valid @RequestBody RepairRecordsSaveReqVO createReqVO) {
return success(repairRecordsService.createRepairRecords(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新维修记录")
public CommonResult<Boolean> updateRepairRecords(@Valid @RequestBody RepairRecordsSaveReqVO updateReqVO) {
repairRecordsService.updateRepairRecords(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除维修记录")
@Parameter(name = "id", description = "编号", required = true)
public CommonResult<Boolean> deleteRepairRecords(@RequestParam("id") String id) {
repairRecordsService.deleteRepairRecords(id);
return success(true);
}
// @GetMapping("/get")
// @Operation(summary = "获得维修记录")
// @Parameter(name = "id", description = "编号", required = true, example = "1024")
// public CommonResult<RepairRecordsRespVO> getRecords(@RequestParam("id") String id) {
// RepairRecords records = repairRecordsService.getRepairRecords(id);
// return success(BeanUtils.toBean(records, RepairRecordsRespVO.class));
// }
/**
* 维修工查询维修记录
* @param pageReqVO
*
*/
@GetMapping("/page")
@Operation(summary = "获得维修记录分页")
public List<RepairRecordsRespVO> queryAllRepairRecords(@RequestBody RepairRecordsPageReqVO pageReqVO) {
return repairRecordsService.queryAllRepairRecords(pageReqVO);
}
}

View File

@ -23,7 +23,7 @@ public class RepairRecords extends TenantBaseDO {
/**
* 主键标识
*/
@TableId(type = IdType.INPUT)
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/**
* 工单id
@ -32,7 +32,7 @@ public class RepairRecords extends TenantBaseDO {
/**
* 工单子表id
*/
private String repairTitemId;
private String repairItemId;
/**
* 记录类型repair_records_type
*/

View File

@ -0,0 +1,52 @@
package cn.iocoder.yudao.module.base.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
/**
* 维修记录附件
* @author pqz
*/
@TableName("dl_repair_records_item")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RepairRecordsItem extends TenantBaseDO {
/**
* 主键标识
*/
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/**
* 记录id
*/
private String recordId;
/**
* 工单id
*/
private String ticketId;
/**
* 工单子表id
*/
private String repairItemId;
/**
* 记录描述
*/
private String remark;
/**
* 图片附件
*/
private String image;
/**
* 是否开放给用户0否1是
*/
private String isOpen;
}

View File

@ -0,0 +1,16 @@
package cn.iocoder.yudao.module.base.mapper;
import cn.iocoder.yudao.module.base.entity.RepairRecordsItem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 维修记录 Mapper
*
* @author pqz
*/
@Mapper
public interface RepairRecordsItemMapper extends BaseMapper<RepairRecordsItem> {
}

View File

@ -18,13 +18,5 @@ import java.util.List;
public interface RepairRecordsMapper extends BaseMapper<RepairRecords> {
/**
* 查询维修记录
* @author lzt
* @param entity 查询条件
* @return List<RepairRecordsRespVO>
* @date 2024年10月9日
*/
List<RepairRecordsRespVO> queryAllRepairRecords(@Param("entity") RepairRecordsPageReqVO entity);
}

View File

@ -0,0 +1,17 @@
package cn.iocoder.yudao.module.base.service;
import cn.iocoder.yudao.module.base.entity.RepairRecordsItem;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 维修记录 Service 接口
*
* @author pqz
*/
public interface RepairRecordsItemService extends IService<RepairRecordsItem> {
}

View File

@ -19,44 +19,7 @@ import java.util.List;
*/
public interface RepairRecordsService extends IService<RepairRecords> {
/**
* 创建维修记录
*
* @param createReqVO 创建信息
* @return 编号
*/
String createRepairRecords(@Valid RepairRecordsSaveReqVO createReqVO);
/**
* 更新维修记录
*
* @param updateReqVO 更新信息
*/
void updateRepairRecords(@Valid RepairRecordsSaveReqVO updateReqVO);
/**
* 删除维修记录
*
* @param id 编号
*/
void deleteRepairRecords(String id);
// /**
// * 获得维修记录
// *
// * @param id 编号
// * @return 维修记录
// */
// RepairRecords getRepairRecords(String id);
/**
* 获得维修记录
*
* @param pageReqVO 查询条件
* @return queryAllRepairRecords 所有维修记录
*/
List<RepairRecordsRespVO> queryAllRepairRecords(RepairRecordsPageReqVO pageReqVO);
void saveRepairRecord(RepairRecordsSaveReqVO saveReqVO);
}

View File

@ -0,0 +1,25 @@
package cn.iocoder.yudao.module.base.service.impl;
import cn.iocoder.yudao.module.base.entity.RepairRecordsItem;
import cn.iocoder.yudao.module.base.mapper.RepairRecordsItemMapper;
import cn.iocoder.yudao.module.base.service.RepairRecordsItemService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
/**
* 维修记录 Service 实现类
*
* @author pqz
*/
@Service
@Validated
public class RepairRecordsItemServiceImpl extends ServiceImpl<RepairRecordsItemMapper, RepairRecordsItem> implements RepairRecordsItemService {
@Resource
private RepairRecordsItemMapper itemMapper;
}

View File

@ -29,45 +29,9 @@ public class RepairRecordsServiceImpl extends ServiceImpl<RepairRecordsMapper, R
@Resource
private RepairRecordsMapper repairRecordsMapper;
@Override
public String createRepairRecords(RepairRecordsSaveReqVO createReqVO) {
// 插入
RepairRecords records = BeanUtils.toBean(createReqVO, RepairRecords.class);
repairRecordsMapper.insert(records);
// 返回
return records.getId();
}
@Override
public void updateRepairRecords(RepairRecordsSaveReqVO updateReqVO) {
// 更新
RepairRecords updateObj = BeanUtils.toBean(updateReqVO, RepairRecords.class);
repairRecordsMapper.updateById(updateObj);
}
@Override
public void deleteRepairRecords(String id) {
// 删除
repairRecordsMapper.deleteById(id);
}
// @Override
// public RepairRecords getRepairRecords(String id) {
// return repairRecordsMapper.selectById(id);
// }
/**
* 查询维修记录
* @apiNote lzt
* @param pageReqVO 查询条件
* @return queryAllRepairRecords 所有维修记录
* @date 2024年10月9日
*/
@Override
public List<RepairRecordsRespVO> queryAllRepairRecords(RepairRecordsPageReqVO pageReqVO) {
return repairRecordsMapper.queryAllRepairRecords(pageReqVO);
}
public void saveRepairRecord(RepairRecordsSaveReqVO saveReqVO) {
}
}

View File

@ -1,12 +1,18 @@
package cn.iocoder.yudao.module.base.vo;
import cn.iocoder.yudao.module.base.entity.RepairRecords;
import cn.iocoder.yudao.module.base.entity.RepairRecordsItem;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Schema(description = "管理后台 - 维修记录新增/修改 Request VO")
@Data
public class RepairRecordsSaveReqVO extends RepairRecords {
/**维修记录附件表*/
List<RepairRecordsItem> itemList;
}

View File

@ -0,0 +1,12 @@
<?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="cn.iocoder.yudao.module.base.mapper.RepairRecordsItemMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -9,15 +9,6 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="queryAllRepairRecords" resultType="cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO">
SELECT *
FROM dl_repair_records
<where>
<if test="entity.someField != null">
AND some_column = #{entity.someField}
</if>
</where>
</select>
</mapper>