ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TContractController.java
@@ -1,9 +1,21 @@ package com.ruoyi.web.controller.api; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.basic.PageInfo; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.system.dto.THouseDTO; import com.ruoyi.system.model.THouse; import com.ruoyi.system.query.THouseQuery; import com.ruoyi.system.query.TUserHistoryQuery; import com.ruoyi.system.service.TContractService; import com.ruoyi.system.service.THouseService; import com.ruoyi.system.vo.HouseVO; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; /** * <p> @@ -16,6 +28,41 @@ @RestController @RequestMapping("/t-contract") public class TContractController { @Autowired private TContractService contractService; // @Log(title = "房屋基础信息管理-新增房屋", businessType = BusinessType.INSERT) // @ApiOperation(value = "新增房屋") // @PostMapping(value = "/addHouse") // public AjaxResult<Boolean> addHouse(@Validated @RequestBody THouseDTO dto) { // return AjaxResult.success(contractService.save(dto)); // } // @Log(title = "房屋基础信息管理-编辑房屋", businessType = BusinessType.UPDATE) // @ApiOperation(value = "编辑房屋") // @PostMapping(value = "/updateHouse") // public AjaxResult<Boolean> updateHouse(@Validated @RequestBody THouseDTO dto) { // return AjaxResult.success(contractService.updateById(dto)); // } // @Log(title = "房屋基础信息管理-查询房屋信息", businessType = BusinessType.DELETE) // @ApiOperation(value = "查询房屋信息") // @GetMapping(value = "/getHouseById") // public AjaxResult<THouse> getHouseById(@RequestParam Long id) { // return AjaxResult.success(contractService.getById(id)); // } // @Log(title = "房屋基础信息管理-删除房屋", businessType = BusinessType.DELETE) // @ApiOperation(value = "删除房屋") // @DeleteMapping(value = "/deleteHouseById") // public AjaxResult<Boolean> deleteHouseById(@RequestParam Long id) { // return AjaxResult.success(contractService.removeById(id)); // } // @ApiOperation(value = "获取房屋分页列表") // @PostMapping(value = "/houseList") // public AjaxResult<PageInfo<THouse>> houseList(@RequestBody THouseQuery query) { // return AjaxResult.success(contractService.houseList(query)); // } // @ApiOperation(value = "历史租户列表") // @PostMapping(value = "/userHistoryList") // public AjaxResult<PageInfo<HouseVO>> userHistoryList(@RequestBody TUserHistoryQuery query) { // return AjaxResult.success(contractService.userHistoryList(query)); // } } ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/THouseController.java
@@ -1,9 +1,23 @@ package com.ruoyi.web.controller.api; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.basic.PageInfo; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.system.dto.THouseDTO; import com.ruoyi.system.dto.TTenantDTO; import com.ruoyi.system.model.THouse; import com.ruoyi.system.model.TTenant; import com.ruoyi.system.query.THouseQuery; import com.ruoyi.system.query.TTenantQuery; import com.ruoyi.system.query.TUserHistoryQuery; import com.ruoyi.system.service.THouseService; import com.ruoyi.system.vo.HouseVO; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; /** * <p> @@ -16,6 +30,42 @@ @RestController @RequestMapping("/t-house") public class THouseController { @Autowired private THouseService tHouseService; @Log(title = "房屋基础信息管理-新增房屋", businessType = BusinessType.INSERT) @ApiOperation(value = "新增房屋") @PostMapping(value = "/addHouse") public AjaxResult<Boolean> addHouse(@Validated @RequestBody THouseDTO dto) { return AjaxResult.success(tHouseService.save(dto)); } @Log(title = "房屋基础信息管理-编辑房屋", businessType = BusinessType.UPDATE) @ApiOperation(value = "编辑房屋") @PostMapping(value = "/updateHouse") public AjaxResult<Boolean> updateHouse(@Validated @RequestBody THouseDTO dto) { return AjaxResult.success(tHouseService.updateById(dto)); } @Log(title = "房屋基础信息管理-查询房屋信息", businessType = BusinessType.DELETE) @ApiOperation(value = "查询房屋信息") @GetMapping(value = "/getHouseById") public AjaxResult<THouse> getHouseById(@RequestParam Long id) { return AjaxResult.success(tHouseService.getById(id)); } @Log(title = "房屋基础信息管理-删除房屋", businessType = BusinessType.DELETE) @ApiOperation(value = "删除房屋") @DeleteMapping(value = "/deleteHouseById") public AjaxResult<Boolean> deleteHouseById(@RequestParam Long id) { return AjaxResult.success(tHouseService.removeById(id)); } @ApiOperation(value = "获取房屋分页列表") @PostMapping(value = "/houseList") public AjaxResult<PageInfo<THouse>> houseList(@RequestBody THouseQuery query) { return AjaxResult.success(tHouseService.houseList(query)); } @ApiOperation(value = "历史租户列表") @PostMapping(value = "/userHistoryList") public AjaxResult<PageInfo<HouseVO>> userHistoryList(@RequestBody TUserHistoryQuery query) { return AjaxResult.success(tHouseService.userHistoryList(query)); } } ruoyi-system/src/main/java/com/ruoyi/system/dto/THouseDTO.java
New file @@ -0,0 +1,11 @@ package com.ruoyi.system.dto; import com.ruoyi.system.model.THouse; import com.ruoyi.system.model.TTenant; import io.swagger.annotations.ApiModel; import lombok.Data; @Data @ApiModel(value = "房屋DTO") public class THouseDTO extends THouse { } ruoyi-system/src/main/java/com/ruoyi/system/mapper/THouseMapper.java
@@ -1,7 +1,14 @@ package com.ruoyi.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.common.basic.PageInfo; import com.ruoyi.system.model.THouse; import com.ruoyi.system.query.THouseQuery; import com.ruoyi.system.query.TUserHistoryQuery; import com.ruoyi.system.vo.HouseVO; import org.apache.ibatis.annotations.Param; import java.util.List; /** * <p> @@ -13,4 +20,8 @@ */ public interface THouseMapper extends BaseMapper<THouse> { List<THouse> houseList(@Param("req") THouseQuery query, @Param("pageInfo") PageInfo<THouse> pageInfo); List<HouseVO> userHistoryList(@Param("req")TUserHistoryQuery query, @Param("pageInfo")PageInfo<HouseVO> pageInfo); } ruoyi-system/src/main/java/com/ruoyi/system/model/THouse.java
@@ -81,5 +81,11 @@ @ApiModelProperty(value = "租赁状态 1=待出租 2=已出租 3=维修中") @TableField("lease_status") private Integer leaseStatus; @ApiModelProperty(value = "楼栋") @TableField("building") private String building; @ApiModelProperty(value = "房号") @TableField("room_number") private String roomNumber; } ruoyi-system/src/main/java/com/ruoyi/system/query/THouseQuery.java
New file @@ -0,0 +1,21 @@ package com.ruoyi.system.query; import com.ruoyi.common.core.domain.BasePage; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data @ApiModel(value = "房屋分页列表查询Query") public class THouseQuery extends BasePage { @ApiModelProperty(value = "房间名称") private String houseName; @ApiModelProperty(value = "产权人") private String propertyRightPerson; @ApiModelProperty(value = "租赁状态 1=待出租 2=已出租 3=维修中") private Integer leaseStatus; } ruoyi-system/src/main/java/com/ruoyi/system/query/TUserHistoryQuery.java
New file @@ -0,0 +1,14 @@ package com.ruoyi.system.query; import com.ruoyi.common.core.domain.BasePage; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data @ApiModel(value = "历史租户分页列表查询Query") public class TUserHistoryQuery extends BasePage { @ApiModelProperty(value = "房屋id") private String id; } ruoyi-system/src/main/java/com/ruoyi/system/service/THouseService.java
@@ -1,7 +1,11 @@ package com.ruoyi.system.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.common.basic.PageInfo; import com.ruoyi.system.model.THouse; import com.ruoyi.system.query.THouseQuery; import com.ruoyi.system.query.TUserHistoryQuery; import com.ruoyi.system.vo.HouseVO; /** * <p> @@ -13,4 +17,7 @@ */ public interface THouseService extends IService<THouse> { PageInfo<THouse> houseList(THouseQuery query); PageInfo<HouseVO> userHistoryList(TUserHistoryQuery query); } ruoyi-system/src/main/java/com/ruoyi/system/service/impl/THouseServiceImpl.java
@@ -1,10 +1,16 @@ package com.ruoyi.system.service.impl; import com.ruoyi.common.basic.PageInfo; import com.ruoyi.system.mapper.THouseMapper; import com.ruoyi.system.model.THouse; import com.ruoyi.system.query.THouseQuery; import com.ruoyi.system.query.TUserHistoryQuery; import com.ruoyi.system.service.THouseService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.system.vo.HouseVO; import org.springframework.stereotype.Service; import java.util.List; /** * <p> @@ -17,4 +23,19 @@ @Service public class THouseServiceImpl extends ServiceImpl<THouseMapper, THouse> implements THouseService { @Override public PageInfo<THouse> houseList(THouseQuery query) { PageInfo<THouse> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); List<THouse> list = this.baseMapper.houseList(query,pageInfo); pageInfo.setRecords(list); return pageInfo; } @Override public PageInfo<HouseVO> userHistoryList(TUserHistoryQuery query) { PageInfo<HouseVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); List<HouseVO> list = this.baseMapper.userHistoryList(query,pageInfo); pageInfo.setRecords(list); return pageInfo; } } ruoyi-system/src/main/java/com/ruoyi/system/vo/HouseVO.java
New file @@ -0,0 +1,48 @@ package com.ruoyi.system.vo; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; @Data @ApiModel(value = "历史租户列表VO") public class HouseVO { @ApiModelProperty(value = "房屋id") private String houseId; @ApiModelProperty(value = "租户姓名") private String residentName; @ApiModelProperty(value = "联系电话") private String phone; @ApiModelProperty(value = "属性") private String businessAttributes; @ApiModelProperty(value = "类型") private String productType; @ApiModelProperty(value = "入住日期") @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") private LocalDateTime startTime; @ApiModelProperty(value = "楼栋") private String building; @ApiModelProperty(value = "房号") private String roomNumber; @ApiModelProperty(value = "建筑面积") private String houseArea; @ApiModelProperty(value = "登录账号") private String loginAccount; @ApiModelProperty(value = "证件号码") private String idCard; @ApiModelProperty(value = "银行转账专号") private String bankNumber; @ApiModelProperty(value = "通讯地址") private String mailAddress; } ruoyi-system/src/main/resources/mapper/system/THouseMapper.xml
@@ -28,5 +28,39 @@ <sql id="Base_Column_List"> id, house_picture, house_name, house_address, house_area, house_type, business_attributes, product_type, property_right_person, property_right_number, property_right_start_time, property_right_duration, lease_status, create_time, update_time, create_by, update_by, disabled </sql> <select id="houseList" resultType="com.ruoyi.system.model.THouse"> select t1.* from t_house t1 <where> <if test="req.houseName != null and req.houseName != ''"> and t1.house_name like concat('%', #{req.houseName}, '%') </if> <if test="req.propertyRightPerson != null and req.propertyRightPerson != ''"> and t1.property_right_person like concat('%', #{req.propertyRightPerson}, '%') </if> <if test="req.leaseStatus != null"> and t1.lease_status = #{req.leaseStatus} </if> </where> </select> <select id="userHistoryList" resultType="com.ruoyi.system.vo.HouseVO"> select t2.resident_name as residentName, t2.phone as phone, t3.business_attributes as businessAttributes, t3.product_type as productType, t1.start_time as startTime, t3.building as building, t3.room_number as roomNumber, t3.house_area as houseArea, t2.phone as loginAccount, t2.id_card as idCard, t2.bank_number as bankNumber, t2.mail_address as mailAddress, from t_contract t1 left join t_tenant t2 on t1.tenant_id = t2.id LEFT JOIN t_house t3 on t3.id = t1.house_id where t1.house_id = #{req.id} </select> </mapper>