Compare commits
2 Commits
d1952a5754
...
a860d1ada1
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a860d1ada1 | ||
![]() |
d13ce8a6d3 |
@ -9,7 +9,6 @@ import cn.iocoder.yudao.module.property.entity.Property;
|
|||||||
import cn.iocoder.yudao.module.property.service.PropertyService;
|
import cn.iocoder.yudao.module.property.service.PropertyService;
|
||||||
import cn.iocoder.yudao.module.property.vo.PropertyReqVO;
|
import cn.iocoder.yudao.module.property.vo.PropertyReqVO;
|
||||||
import cn.iocoder.yudao.module.property.vo.PropertyRespVO;
|
import cn.iocoder.yudao.module.property.vo.PropertyRespVO;
|
||||||
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@ -21,7 +20,6 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -1,30 +1,29 @@
|
|||||||
package cn.iocoder.yudao.module.property.controller.admin;
|
package cn.iocoder.yudao.module.property.controller.admin;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
||||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
||||||
import cn.iocoder.yudao.module.property.entity.PropertyKeep;
|
import cn.iocoder.yudao.module.property.entity.PropertyKeep;
|
||||||
import cn.iocoder.yudao.module.property.service.PropertyKeepService;
|
import cn.iocoder.yudao.module.property.service.PropertyKeepService;
|
||||||
import cn.iocoder.yudao.module.property.vo.PropertyKeepReqVO;
|
import cn.iocoder.yudao.module.property.vo.PropertyKeepReqVO;
|
||||||
import cn.iocoder.yudao.module.property.vo.PropertyKeepRespVO;
|
import cn.iocoder.yudao.module.property.vo.PropertyKeepRespVO;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资产维修/保养记录 控制层
|
||||||
|
*
|
||||||
|
* @author 小李
|
||||||
|
* @date 11:23 2024/8/16
|
||||||
|
**/
|
||||||
@Tag(name = "管理后台 - 资产维修/保养记录")
|
@Tag(name = "管理后台 - 资产维修/保养记录")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/company/property-keep")
|
@RequestMapping("/company/property-keep")
|
||||||
@ -34,57 +33,36 @@ public class PropertyKeepController {
|
|||||||
@Resource
|
@Resource
|
||||||
private PropertyKeepService propertyKeepService;
|
private PropertyKeepService propertyKeepService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建资产维修/保养记录
|
||||||
|
*
|
||||||
|
* @param keepRespVO 资产维修/保养记录对象
|
||||||
|
* @author 小李
|
||||||
|
* @date 11:26 2024/8/16
|
||||||
|
**/
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建资产维修/保养记录")
|
@Operation(summary = "创建资产维修/保养记录")
|
||||||
@PreAuthorize("@ss.hasPermission('company:property-keep:create')")
|
@PreAuthorize("@ss.hasPermission('company:property-keep:create')")
|
||||||
public CommonResult<String> createPropertyKeep(@RequestBody PropertyKeepReqVO createReqVO) {
|
public CommonResult createPropertyKeep(@RequestBody PropertyKeepRespVO keepRespVO) {
|
||||||
return success(propertyKeepService.createPropertyKeep(createReqVO));
|
propertyKeepService.createPropertyKeep(keepRespVO);
|
||||||
}
|
return CommonResult.ok();
|
||||||
|
|
||||||
@PutMapping("/update")
|
|
||||||
@Operation(summary = "更新资产维修/保养记录")
|
|
||||||
@PreAuthorize("@ss.hasPermission('company:property-keep:update')")
|
|
||||||
public CommonResult<Boolean> updatePropertyKeep(@RequestBody PropertyKeepReqVO updateReqVO) {
|
|
||||||
propertyKeepService.updatePropertyKeep(updateReqVO);
|
|
||||||
return success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@DeleteMapping("/delete")
|
|
||||||
@Operation(summary = "删除资产维修/保养记录")
|
|
||||||
@Parameter(name = "id", description = "编号", required = true)
|
|
||||||
@PreAuthorize("@ss.hasPermission('company:property-keep:delete')")
|
|
||||||
public CommonResult<Boolean> deletePropertyKeep(@RequestParam("id") String id) {
|
|
||||||
propertyKeepService.deletePropertyKeep(id);
|
|
||||||
return success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/get")
|
|
||||||
@Operation(summary = "获得资产维修/保养记录")
|
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
||||||
@PreAuthorize("@ss.hasPermission('company:property-keep:query')")
|
|
||||||
public CommonResult<PropertyKeepRespVO> getPropertyKeep(@RequestParam("id") String id) {
|
|
||||||
PropertyKeep propertyKeep = propertyKeepService.getPropertyKeep(id);
|
|
||||||
return success(BeanUtils.toBean(propertyKeep, PropertyKeepRespVO.class));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资产维修/保养记录 分页
|
||||||
|
* @author 小李
|
||||||
|
* @date 15:42 2024/8/16
|
||||||
|
* @param pageReqVO 查询对象
|
||||||
|
* @param pageNo 页码
|
||||||
|
* @param pageSize 条数
|
||||||
|
**/
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得资产维修/保养记录分页")
|
@Operation(summary = "获得资产维修/保养记录分页")
|
||||||
@PreAuthorize("@ss.hasPermission('company:property-keep:query')")
|
@PreAuthorize("@ss.hasPermission('company:property-keep:query')")
|
||||||
public CommonResult<IPage<PropertyKeepRespVO>> getPropertyKeepPage(PropertyKeepReqVO pageReqVO) {
|
public CommonResult<IPage<?>> getPropertyKeepPage(PropertyKeepReqVO pageReqVO,
|
||||||
IPage<PropertyKeepRespVO> pageResult = propertyKeepService.getPropertyKeepPage(pageReqVO);
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
return success(pageResult);
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||||
|
Page<PropertyKeep> page = new Page<>(pageNo, pageSize);
|
||||||
|
return success(propertyKeepService.getPropertyKeepPage(pageReqVO, page));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
|
||||||
@Operation(summary = "导出资产维修/保养记录 Excel")
|
|
||||||
@PreAuthorize("@ss.hasPermission('company:property-keep:export')")
|
|
||||||
@ApiAccessLog(operateType = EXPORT)
|
|
||||||
public void exportPropertyKeepExcel(PropertyKeepReqVO pageReqVO,
|
|
||||||
HttpServletResponse response) throws IOException {
|
|
||||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
||||||
List<PropertyKeepRespVO> list = propertyKeepService.getPropertyKeepPage(pageReqVO).getRecords();
|
|
||||||
// 导出 Excel
|
|
||||||
ExcelUtils.write(response, "资产维修/保养记录.xls", "数据", PropertyKeepRespVO.class, list);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -146,7 +146,7 @@ public class Property extends TenantBaseDO {
|
|||||||
private Date lastKeepDate;
|
private Date lastKeepDate;
|
||||||
|
|
||||||
/** 下次维修/保养日期 */
|
/** 下次维修/保养日期 */
|
||||||
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
|
@JsonFormat(pattern="yyyy-MM-dd", timezone="GMT+8")
|
||||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
@ExcelProperty("下次维修/保养日期")
|
@ExcelProperty("下次维修/保养日期")
|
||||||
private Date nextKeepDate;
|
private Date nextKeepDate;
|
||||||
|
@ -5,45 +5,38 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资产维修/保养记录 DO
|
* 资产维修/保养记录
|
||||||
*
|
* @author 小李
|
||||||
* @author 后台管理员
|
* @date 11:19 2024/8/16
|
||||||
*/
|
**/
|
||||||
@TableName("company_property_keep")
|
@TableName("company_property_keep")
|
||||||
@KeySequence("company_property_keep_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@ToString(callSuper = true)
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class PropertyKeep extends TenantBaseDO {
|
public class PropertyKeep extends TenantBaseDO {
|
||||||
|
|
||||||
/**
|
/** 主键标识 */
|
||||||
* 主键标识
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
*/
|
|
||||||
@TableId(type = IdType.ASSIGN_UUID)
|
|
||||||
private String id;
|
private String id;
|
||||||
/**
|
|
||||||
* 资产id
|
|
||||||
*/
|
|
||||||
private String propertyId;
|
|
||||||
/**
|
|
||||||
* 维修/保养日期
|
|
||||||
*/
|
|
||||||
private LocalDate keepDate;
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
private String remark;
|
|
||||||
/**
|
|
||||||
* 附件urls
|
|
||||||
*/
|
|
||||||
private String fileUrls;
|
|
||||||
|
|
||||||
|
/** 资产id */
|
||||||
|
private String propertyId;
|
||||||
|
|
||||||
|
/** 维修/保养日期 */
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
private Date keepDate;
|
||||||
|
|
||||||
|
/** 备注 */
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/** 附件urls(infra_file表中的url,多个英文逗号拼接) */
|
||||||
|
private String fileUrls;
|
||||||
}
|
}
|
@ -5,18 +5,17 @@ import cn.iocoder.yudao.module.property.vo.PropertyKeepReqVO;
|
|||||||
import cn.iocoder.yudao.module.property.vo.PropertyKeepRespVO;
|
import cn.iocoder.yudao.module.property.vo.PropertyKeepRespVO;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资产维修/保养记录 Mapper
|
* 资产维修/保养记录 Mapper
|
||||||
*
|
* @author 小李
|
||||||
* @author 后台管理员
|
* @date 11:21 2024/8/16
|
||||||
*/
|
**/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface PropertyKeepMapper extends BaseMapper<PropertyKeep> {
|
public interface PropertyKeepMapper extends BaseMapper<PropertyKeep> {
|
||||||
|
|
||||||
default IPage<PropertyKeepRespVO> selectPage(PropertyKeepReqVO reqVO) {
|
IPage<PropertyKeep> getPropertyKeepPage(@Param("map") PropertyKeepReqVO pageReqVO, Page<PropertyKeep> page);
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -4,51 +4,29 @@ import cn.iocoder.yudao.module.property.entity.PropertyKeep;
|
|||||||
import cn.iocoder.yudao.module.property.vo.PropertyKeepReqVO;
|
import cn.iocoder.yudao.module.property.vo.PropertyKeepReqVO;
|
||||||
import cn.iocoder.yudao.module.property.vo.PropertyKeepRespVO;
|
import cn.iocoder.yudao.module.property.vo.PropertyKeepRespVO;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资产维修/保养记录 Service 接口
|
* 资产维修/保养记录 接口
|
||||||
*
|
* @author 小李
|
||||||
* @author 后台管理员
|
* @date 11:22 2024/8/16
|
||||||
*/
|
**/
|
||||||
public interface PropertyKeepService extends IService<PropertyKeep> {
|
public interface PropertyKeepService extends IService<PropertyKeep> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建资产维修/保养记录
|
* 创建资产维修/保养记录
|
||||||
*
|
* @author 小李
|
||||||
* @param createReqVO 创建信息
|
* @date 11:26 2024/8/16
|
||||||
* @return 编号
|
* @param keepRespVO 资产维修/保养记录对象
|
||||||
*/
|
**/
|
||||||
String createPropertyKeep(PropertyKeepReqVO createReqVO);
|
void createPropertyKeep(PropertyKeepRespVO keepRespVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新资产维修/保养记录
|
* 资产维修/保养记录 分页
|
||||||
*
|
* @author 小李
|
||||||
* @param updateReqVO 更新信息
|
* @date 15:42 2024/8/16
|
||||||
*/
|
* @param pageReqVO 查询对象
|
||||||
void updatePropertyKeep(PropertyKeepReqVO updateReqVO);
|
**/
|
||||||
|
IPage<PropertyKeep> getPropertyKeepPage(PropertyKeepReqVO pageReqVO, Page<PropertyKeep> page);
|
||||||
/**
|
|
||||||
* 删除资产维修/保养记录
|
|
||||||
*
|
|
||||||
* @param id 编号
|
|
||||||
*/
|
|
||||||
void deletePropertyKeep(String id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得资产维修/保养记录
|
|
||||||
*
|
|
||||||
* @param id 编号
|
|
||||||
* @return 资产维修/保养记录
|
|
||||||
*/
|
|
||||||
PropertyKeep getPropertyKeep(String id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得资产维修/保养记录分页
|
|
||||||
*
|
|
||||||
* @param pageReqVO 分页查询
|
|
||||||
* @return 资产维修/保养记录分页
|
|
||||||
*/
|
|
||||||
IPage<PropertyKeepRespVO> getPropertyKeepPage(PropertyKeepReqVO pageReqVO);
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,56 +1,60 @@
|
|||||||
package cn.iocoder.yudao.module.property.service.impl;
|
package cn.iocoder.yudao.module.property.service.impl;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.module.property.entity.Property;
|
||||||
import cn.iocoder.yudao.module.property.entity.PropertyKeep;
|
import cn.iocoder.yudao.module.property.entity.PropertyKeep;
|
||||||
import cn.iocoder.yudao.module.property.mapper.PropertyKeepMapper;
|
import cn.iocoder.yudao.module.property.mapper.PropertyKeepMapper;
|
||||||
import cn.iocoder.yudao.module.property.service.PropertyKeepService;
|
import cn.iocoder.yudao.module.property.service.PropertyKeepService;
|
||||||
|
import cn.iocoder.yudao.module.property.service.PropertyService;
|
||||||
import cn.iocoder.yudao.module.property.vo.PropertyKeepReqVO;
|
import cn.iocoder.yudao.module.property.vo.PropertyKeepReqVO;
|
||||||
import cn.iocoder.yudao.module.property.vo.PropertyKeepRespVO;
|
import cn.iocoder.yudao.module.property.vo.PropertyKeepRespVO;
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资产维修/保养记录 Service 实现类
|
* 资产维修/保养记录 接口实现类
|
||||||
*
|
* @author 小李
|
||||||
* @author 后台管理员
|
* @date 11:23 2024/8/16
|
||||||
*/
|
**/
|
||||||
@Service
|
@Service
|
||||||
@Validated
|
@Validated
|
||||||
public class PropertyKeepServiceImpl extends ServiceImpl<PropertyKeepMapper, PropertyKeep> implements PropertyKeepService {
|
public class PropertyKeepServiceImpl extends ServiceImpl<PropertyKeepMapper, PropertyKeep> implements PropertyKeepService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PropertyService propertyService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建资产维修/保养记录
|
||||||
|
* @author 小李
|
||||||
|
* @date 11:26 2024/8/16
|
||||||
|
* @param keepRespVO 资产维修/保养记录对象
|
||||||
|
**/
|
||||||
@Override
|
@Override
|
||||||
public String createPropertyKeep(PropertyKeepReqVO createReqVO) {
|
@DSTransactional
|
||||||
// 插入
|
public void createPropertyKeep(PropertyKeepRespVO keepRespVO){
|
||||||
PropertyKeep propertyKeep = BeanUtils.toBean(createReqVO, PropertyKeep.class);
|
// 更新资产的保养时间和下次保养时间
|
||||||
baseMapper.insert(propertyKeep);
|
Property property = keepRespVO.getProperty();
|
||||||
// 返回
|
property.setLastKeepDate(keepRespVO.getKeepDate());
|
||||||
return propertyKeep.getId();
|
propertyService.updateById(property);
|
||||||
|
|
||||||
|
// 接入资产维修\保养记录
|
||||||
|
keepRespVO.setPropertyId(keepRespVO.getProperty().getId());
|
||||||
|
baseMapper.insert(keepRespVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资产维修/保养记录 分页
|
||||||
|
* @author 小李
|
||||||
|
* @date 15:42 2024/8/16
|
||||||
|
* @param pageReqVO 查询对象
|
||||||
|
**/
|
||||||
@Override
|
@Override
|
||||||
public void updatePropertyKeep(PropertyKeepReqVO updateReqVO) {
|
public IPage<PropertyKeep> getPropertyKeepPage(PropertyKeepReqVO pageReqVO, Page<PropertyKeep> page){
|
||||||
// 更新
|
return baseMapper.getPropertyKeepPage(pageReqVO, page);
|
||||||
PropertyKeep updateObj = BeanUtils.toBean(updateReqVO, PropertyKeep.class);
|
|
||||||
baseMapper.updateById(updateObj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deletePropertyKeep(String id) {
|
|
||||||
// 删除
|
|
||||||
baseMapper.deleteById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PropertyKeep getPropertyKeep(String id) {
|
|
||||||
return baseMapper.selectById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IPage<PropertyKeepRespVO> getPropertyKeepPage(PropertyKeepReqVO pageReqVO) {
|
|
||||||
return baseMapper.selectPage(pageReqVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,41 +1,23 @@
|
|||||||
package cn.iocoder.yudao.module.property.vo;
|
package cn.iocoder.yudao.module.property.vo;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
import cn.iocoder.yudao.module.property.entity.PropertyKeep;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.ToString;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.util.Date;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 资产维修/保养记录分页 Request VO")
|
/**
|
||||||
|
* 资产维修/保养记录 VO
|
||||||
|
* @author 小李
|
||||||
|
* @date 11:20 2024/8/16
|
||||||
|
**/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
public class PropertyKeepReqVO extends PropertyKeep {
|
||||||
@ToString(callSuper = true)
|
|
||||||
public class PropertyKeepReqVO extends PageParam {
|
|
||||||
|
|
||||||
@Schema(description = "主键标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "22729")
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
@Schema(description = "资产id", example = "20917")
|
|
||||||
private String propertyId;
|
|
||||||
|
|
||||||
@Schema(description = "维修/保养日期")
|
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
|
||||||
private LocalDate keepDate;
|
|
||||||
|
|
||||||
@Schema(description = "备注", example = "你说的对")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
@Schema(description = "附件urls")
|
|
||||||
private String fileUrls;
|
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
|
@Schema(description = "维修\\保养日期查询范围")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private Date[] keepDateArray;
|
||||||
}
|
}
|
@ -1,20 +1,25 @@
|
|||||||
package cn.iocoder.yudao.module.property.vo;
|
package cn.iocoder.yudao.module.property.vo;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.property.entity.Property;
|
import cn.iocoder.yudao.module.property.entity.Property;
|
||||||
|
import cn.iocoder.yudao.module.property.entity.PropertyKeep;
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 资产维修/保养记录 Response VO")
|
/**
|
||||||
|
* 资产维修/保养记录 提交\响应VO
|
||||||
|
* @author 小李
|
||||||
|
* @date 11:21 2024/8/16
|
||||||
|
**/
|
||||||
@Data
|
@Data
|
||||||
@ExcelIgnoreUnannotated
|
public class PropertyKeepRespVO extends PropertyKeep {
|
||||||
public class PropertyKeepRespVO extends Property {
|
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
|
||||||
@ExcelProperty("创建时间")
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
|
/** 资产的信息 */
|
||||||
|
private Property property;
|
||||||
}
|
}
|
@ -1,12 +1,37 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="cn.iocoder.yudao.module.company.dal.mysql.propertykeep.PropertyKeepMapper">
|
<mapper namespace="cn.iocoder.yudao.module.property.mapper.PropertyKeepMapper">
|
||||||
|
|
||||||
<!--
|
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.property.entity.PropertyKeep">
|
||||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
<result property="propertyId" column="property_id" jdbcType="VARCHAR"/>
|
||||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
<result property="keepDate" column="keep_date" jdbcType="DATE"/>
|
||||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||||
-->
|
<result property="fileUrls" column="file_urls" jdbcType="VARCHAR"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="Base_SQL">
|
||||||
|
select id,
|
||||||
|
property_id,
|
||||||
|
keep_date,
|
||||||
|
remark,
|
||||||
|
file_urls,
|
||||||
|
tenant_id,
|
||||||
|
deleted,
|
||||||
|
creator,
|
||||||
|
create_time,
|
||||||
|
updater,
|
||||||
|
update_time
|
||||||
|
from company_property_keep
|
||||||
|
where deleted = '0'
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="getPropertyKeepPage" resultMap="BaseResultMap">
|
||||||
|
<include refid="Base_SQL" />
|
||||||
|
AND (property_id = #{map.propertyId})
|
||||||
|
<if test="map.keepDateArray != null and map.keepDateArray.length > 0">
|
||||||
|
AND (keep_date BETWEEN #{map.keepDateArray[0]} AND #{map.keepDateArray[1]})
|
||||||
|
</if>
|
||||||
|
order by create_time desc
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -115,5 +115,6 @@
|
|||||||
<if test="map.openDateArray != null and map.openDateArray != ''">
|
<if test="map.openDateArray != null and map.openDateArray != ''">
|
||||||
AND (cp.open_date BETWEEN #{map.openDateArray[0]} AND #{map.openDateArray[1]})
|
AND (cp.open_date BETWEEN #{map.openDateArray[0]} AND #{map.openDateArray[1]})
|
||||||
</if>
|
</if>
|
||||||
|
order by cp.create_time desc
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue
Block a user