资产维修\保养
This commit is contained in:
parent
3783f054a2
commit
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.vo.PropertyReqVO;
|
||||
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.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -21,7 +20,6 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
@ -1,30 +1,29 @@
|
||||
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.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.service.PropertyKeepService;
|
||||
import cn.iocoder.yudao.module.property.vo.PropertyKeepReqVO;
|
||||
import cn.iocoder.yudao.module.property.vo.PropertyKeepRespVO;
|
||||
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.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 资产维修/保养记录 控制层
|
||||
*
|
||||
* @author 小李
|
||||
* @date 11:23 2024/8/16
|
||||
**/
|
||||
@Tag(name = "管理后台 - 资产维修/保养记录")
|
||||
@RestController
|
||||
@RequestMapping("/company/property-keep")
|
||||
@ -34,57 +33,36 @@ public class PropertyKeepController {
|
||||
@Resource
|
||||
private PropertyKeepService propertyKeepService;
|
||||
|
||||
/**
|
||||
* 创建资产维修/保养记录
|
||||
*
|
||||
* @param keepRespVO 资产维修/保养记录对象
|
||||
* @author 小李
|
||||
* @date 11:26 2024/8/16
|
||||
**/
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建资产维修/保养记录")
|
||||
@PreAuthorize("@ss.hasPermission('company:property-keep:create')")
|
||||
public CommonResult<String> createPropertyKeep(@RequestBody PropertyKeepReqVO createReqVO) {
|
||||
return success(propertyKeepService.createPropertyKeep(createReqVO));
|
||||
}
|
||||
|
||||
@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));
|
||||
public CommonResult createPropertyKeep(@RequestBody PropertyKeepRespVO keepRespVO) {
|
||||
propertyKeepService.createPropertyKeep(keepRespVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 资产维修/保养记录 分页
|
||||
* @author 小李
|
||||
* @date 15:42 2024/8/16
|
||||
* @param pageReqVO 查询对象
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 条数
|
||||
**/
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得资产维修/保养记录分页")
|
||||
@PreAuthorize("@ss.hasPermission('company:property-keep:query')")
|
||||
public CommonResult<IPage<PropertyKeepRespVO>> getPropertyKeepPage(PropertyKeepReqVO pageReqVO) {
|
||||
IPage<PropertyKeepRespVO> pageResult = propertyKeepService.getPropertyKeepPage(pageReqVO);
|
||||
return success(pageResult);
|
||||
public CommonResult<IPage<?>> getPropertyKeepPage(PropertyKeepReqVO pageReqVO,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@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;
|
||||
|
||||
/** 下次维修/保养日期 */
|
||||
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
|
||||
@JsonFormat(pattern="yyyy-MM-dd", timezone="GMT+8")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ExcelProperty("下次维修/保养日期")
|
||||
private Date nextKeepDate;
|
||||
|
@ -5,45 +5,38 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 资产维修/保养记录 DO
|
||||
*
|
||||
* @author 后台管理员
|
||||
*/
|
||||
* 资产维修/保养记录
|
||||
* @author 小李
|
||||
* @date 11:19 2024/8/16
|
||||
**/
|
||||
@TableName("company_property_keep")
|
||||
@KeySequence("company_property_keep_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PropertyKeep extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* 主键标识
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
/** 主键标识 */
|
||||
@TableId(type = IdType.ASSIGN_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 com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
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.Param;
|
||||
|
||||
/**
|
||||
* 资产维修/保养记录 Mapper
|
||||
*
|
||||
* @author 后台管理员
|
||||
*/
|
||||
* @author 小李
|
||||
* @date 11:21 2024/8/16
|
||||
**/
|
||||
@Mapper
|
||||
public interface PropertyKeepMapper extends BaseMapper<PropertyKeep> {
|
||||
|
||||
default IPage<PropertyKeepRespVO> selectPage(PropertyKeepReqVO reqVO) {
|
||||
return null;
|
||||
}
|
||||
|
||||
IPage<PropertyKeep> getPropertyKeepPage(@Param("map") PropertyKeepReqVO pageReqVO, Page<PropertyKeep> page);
|
||||
}
|
@ -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.PropertyKeepRespVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 资产维修/保养记录 Service 接口
|
||||
*
|
||||
* @author 后台管理员
|
||||
*/
|
||||
* 资产维修/保养记录 接口
|
||||
* @author 小李
|
||||
* @date 11:22 2024/8/16
|
||||
**/
|
||||
public interface PropertyKeepService extends IService<PropertyKeep> {
|
||||
|
||||
/**
|
||||
* 创建资产维修/保养记录
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
String createPropertyKeep(PropertyKeepReqVO createReqVO);
|
||||
* @author 小李
|
||||
* @date 11:26 2024/8/16
|
||||
* @param keepRespVO 资产维修/保养记录对象
|
||||
**/
|
||||
void createPropertyKeep(PropertyKeepRespVO keepRespVO);
|
||||
|
||||
/**
|
||||
* 更新资产维修/保养记录
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updatePropertyKeep(PropertyKeepReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除资产维修/保养记录
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deletePropertyKeep(String id);
|
||||
|
||||
/**
|
||||
* 获得资产维修/保养记录
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 资产维修/保养记录
|
||||
*/
|
||||
PropertyKeep getPropertyKeep(String id);
|
||||
|
||||
/**
|
||||
* 获得资产维修/保养记录分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 资产维修/保养记录分页
|
||||
*/
|
||||
IPage<PropertyKeepRespVO> getPropertyKeepPage(PropertyKeepReqVO pageReqVO);
|
||||
|
||||
* 资产维修/保养记录 分页
|
||||
* @author 小李
|
||||
* @date 15:42 2024/8/16
|
||||
* @param pageReqVO 查询对象
|
||||
**/
|
||||
IPage<PropertyKeep> getPropertyKeepPage(PropertyKeepReqVO pageReqVO, Page<PropertyKeep> page);
|
||||
}
|
@ -1,56 +1,60 @@
|
||||
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.mapper.PropertyKeepMapper;
|
||||
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.PropertyKeepRespVO;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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 后台管理员
|
||||
*/
|
||||
* 资产维修/保养记录 接口实现类
|
||||
* @author 小李
|
||||
* @date 11:23 2024/8/16
|
||||
**/
|
||||
@Service
|
||||
@Validated
|
||||
public class PropertyKeepServiceImpl extends ServiceImpl<PropertyKeepMapper, PropertyKeep> implements PropertyKeepService {
|
||||
|
||||
@Resource
|
||||
private PropertyService propertyService;
|
||||
|
||||
/**
|
||||
* 创建资产维修/保养记录
|
||||
* @author 小李
|
||||
* @date 11:26 2024/8/16
|
||||
* @param keepRespVO 资产维修/保养记录对象
|
||||
**/
|
||||
@Override
|
||||
public String createPropertyKeep(PropertyKeepReqVO createReqVO) {
|
||||
// 插入
|
||||
PropertyKeep propertyKeep = BeanUtils.toBean(createReqVO, PropertyKeep.class);
|
||||
baseMapper.insert(propertyKeep);
|
||||
// 返回
|
||||
return propertyKeep.getId();
|
||||
@DSTransactional
|
||||
public void createPropertyKeep(PropertyKeepRespVO keepRespVO){
|
||||
// 更新资产的保养时间和下次保养时间
|
||||
Property property = keepRespVO.getProperty();
|
||||
property.setLastKeepDate(keepRespVO.getKeepDate());
|
||||
propertyService.updateById(property);
|
||||
|
||||
// 接入资产维修\保养记录
|
||||
keepRespVO.setPropertyId(keepRespVO.getProperty().getId());
|
||||
baseMapper.insert(keepRespVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 资产维修/保养记录 分页
|
||||
* @author 小李
|
||||
* @date 15:42 2024/8/16
|
||||
* @param pageReqVO 查询对象
|
||||
**/
|
||||
@Override
|
||||
public void updatePropertyKeep(PropertyKeepReqVO updateReqVO) {
|
||||
// 更新
|
||||
PropertyKeep updateObj = BeanUtils.toBean(updateReqVO, PropertyKeep.class);
|
||||
baseMapper.updateById(updateObj);
|
||||
public IPage<PropertyKeep> getPropertyKeepPage(PropertyKeepReqVO pageReqVO, Page<PropertyKeep> page){
|
||||
return baseMapper.getPropertyKeepPage(pageReqVO, page);
|
||||
}
|
||||
|
||||
@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;
|
||||
|
||||
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 lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
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
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@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;
|
||||
public class PropertyKeepReqVO extends PropertyKeep {
|
||||
|
||||
@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;
|
||||
|
||||
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.ExcelProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
@Schema(description = "管理后台 - 资产维修/保养记录 Response VO")
|
||||
/**
|
||||
* 资产维修/保养记录 提交\响应VO
|
||||
* @author 小李
|
||||
* @date 11:21 2024/8/16
|
||||
**/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class PropertyKeepRespVO extends Property {
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
public class PropertyKeepRespVO extends PropertyKeep {
|
||||
|
||||
/** 资产的信息 */
|
||||
private Property property;
|
||||
}
|
@ -1,12 +1,37 @@
|
||||
<?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.company.dal.mysql.propertykeep.PropertyKeepMapper">
|
||||
<mapper namespace="cn.iocoder.yudao.module.property.mapper.PropertyKeepMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.property.entity.PropertyKeep">
|
||||
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="propertyId" column="property_id" jdbcType="VARCHAR"/>
|
||||
<result property="keepDate" column="keep_date" jdbcType="DATE"/>
|
||||
<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>
|
@ -115,5 +115,6 @@
|
||||
<if test="map.openDateArray != null and map.openDateArray != ''">
|
||||
AND (cp.open_date BETWEEN #{map.openDateArray[0]} AND #{map.openDateArray[1]})
|
||||
</if>
|
||||
order by cp.create_time desc
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user