1、租赁订单统计
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled

This commit is contained in:
dev_ljl 2025-07-02 17:58:52 +08:00
parent 84de853d7c
commit 9a8ccb1f57
28 changed files with 433 additions and 48 deletions

View File

@ -1,6 +1,8 @@
package org.dromara.property.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.RequiredArgsConstructor;
import jakarta.servlet.http.HttpServletResponse;
@ -103,4 +105,23 @@ public class PlantsRentalOrderController extends BaseController {
@PathVariable("ids") Long[] ids) {
return toAjax(plantsRentalOrderService.deleteWithValidByIds(List.of(ids), true));
}
/**
* 按时间统计订单数量
* @param timeUnit 1日 2周 3月
* @return
*/
@GetMapping("/statisticsByTime")
public R<Map> statisticsByTime(@RequestParam("timeUnit") Integer timeUnit){
return R.ok(plantsRentalOrderService.statisticsByTime(timeUnit));
}
/**
*按用户类型统计
* @return
*/
@GetMapping("/countByCusType")
public R<Map> countByCusType(){
return R.ok(plantsRentalOrderService.countByCusType());
}
}

View File

@ -40,7 +40,7 @@ public class PlantsProduct extends BaseEntity {
/**
* 产品分类
*/
private Long plantType;
private String plantType;
/**
* 产品图片
@ -65,7 +65,7 @@ public class PlantsProduct extends BaseEntity {
/**
* 状态0下架 1上架
*/
private Long state;
private String state;
/**
* 备注

View File

@ -42,12 +42,12 @@ public class PlantsRentalOrder extends BaseEntity {
/**
* 客户类型
*/
private Long customerType;
private String customerType;
/**
* 租赁周期
*/
private Long rentalPeriod;
private String rentalPeriod;
/**
* 租赁开始时间
@ -67,7 +67,7 @@ public class PlantsRentalOrder extends BaseEntity {
/**
* 租赁方式
*/
private Long rentalType;
private String rentalType;
/**
* 租赁方案id
@ -87,17 +87,22 @@ public class PlantsRentalOrder extends BaseEntity {
/**
* 支付状态
*/
private Long paymentStatus;
private String paymentStatus;
/**
* 是否续租
*/
private Long isRelet;
private String isRelet;
/**
* 合同状态
*/
private Long contractStatus;
private String contractStatus;
/**
* 合同编号
*/
private String contractCode;
/**
* 签署时间

View File

@ -50,7 +50,7 @@ public class PlantsRentalPlan extends BaseEntity {
/**
* 状态
*/
private Long state;
private String state;
/**
* 备注

View File

@ -42,7 +42,7 @@ public class PlantsProductBo extends BaseEntity {
* 产品分类
*/
@NotNull(message = "产品分类不能为空", groups = { AddGroup.class, EditGroup.class })
private Long plantType;
private String plantType;
/**
* 产品图片
@ -71,7 +71,7 @@ public class PlantsProductBo extends BaseEntity {
* 状态0下架 1上架
*/
@NotNull(message = "状态0下架 1上架 )不能为空", groups = { AddGroup.class, EditGroup.class })
private Long state;
private String state;
/**
* 备注

View File

@ -30,7 +30,6 @@ public class PlantsRentalOrderBo extends BaseEntity {
/**
* 订单号
*/
@NotBlank(message = "订单号不能为空", groups = { AddGroup.class, EditGroup.class })
private String orderNo;
/**
@ -43,13 +42,13 @@ public class PlantsRentalOrderBo extends BaseEntity {
* 客户类型
*/
@NotNull(message = "客户类型不能为空", groups = { AddGroup.class, EditGroup.class })
private Long customerType;
private String customerType;
/**
* 租赁周期
*/
@NotNull(message = "租赁周期不能为空", groups = { AddGroup.class, EditGroup.class })
private Long rentalPeriod;
private String rentalPeriod;
/**
* 租赁开始时间
@ -73,7 +72,7 @@ public class PlantsRentalOrderBo extends BaseEntity {
* 租赁方式
*/
@NotNull(message = "租赁方式不能为空", groups = { AddGroup.class, EditGroup.class })
private Long rentalType;
private String rentalType;
/**
* 租赁方案id
@ -93,18 +92,22 @@ public class PlantsRentalOrderBo extends BaseEntity {
/**
* 支付状态
*/
@NotNull(message = "支付状态不能为空", groups = { AddGroup.class, EditGroup.class })
private Long paymentStatus;
private String paymentStatus;
/**
* 是否续租
*/
private Long isRelet;
private String isRelet;
/**
* 合同编号
*/
private String contractCode;
/**
* 合同状态
*/
private Long contractStatus;
private String contractStatus;
/**
* 签署时间
@ -112,4 +115,6 @@ public class PlantsRentalOrderBo extends BaseEntity {
private Date signTime;
}

View File

@ -9,6 +9,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import java.util.List;
/**
* 绿植租赁-租赁方案业务对象 plants_rental_plan
*
@ -53,12 +55,18 @@ public class PlantsRentalPlanBo extends BaseEntity {
* 状态
*/
@NotNull(message = "状态不能为空", groups = { AddGroup.class, EditGroup.class })
private Long state;
private String state;
/**
* 备注
*/
private String remarks;
/**
* 产品id
*/
@NotNull(message = "绿植产品不能为空", groups = { AddGroup.class, EditGroup.class })
private List<Long> productIds;
}

View File

@ -52,5 +52,8 @@ public class PlantsPlanProductVo implements Serializable {
@ExcelProperty(value = "创建时间")
private Date createTime;
/**
* 产品信息
*/
private PlantsProductVo product;
}

View File

@ -50,7 +50,7 @@ public class PlantsProductVo implements Serializable {
* 产品分类
*/
@ExcelProperty(value = "产品分类")
private Long plantType;
private String plantType;
/**
* 产品图片
@ -81,7 +81,7 @@ public class PlantsProductVo implements Serializable {
*/
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "product_management_status")
private Long state;
private String state;
/**
* 备注

View File

@ -53,14 +53,14 @@ public class PlantsRentalOrderVo implements Serializable {
*/
@ExcelProperty(value = "客户类型", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "wy_khlx")
private Long customerType;
private String customerType;
/**
* 租赁周期
*/
@ExcelProperty(value = "租赁周期", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "wy_time_unit")
private Long rentalPeriod;
private String rentalPeriod;
/**
* 租赁开始时间
@ -84,7 +84,7 @@ public class PlantsRentalOrderVo implements Serializable {
* 租赁方式
*/
@ExcelProperty(value = "租赁方式")
private Long rentalType;
private String rentalType;
/**
* 租赁方案id
@ -108,19 +108,24 @@ public class PlantsRentalOrderVo implements Serializable {
* 支付状态
*/
@ExcelProperty(value = "支付状态")
private Long paymentStatus;
private String paymentStatus;
/**
* 是否续租
*/
@ExcelProperty(value = "是否续租")
private Long isRelet;
private String isRelet;
/**
* 合同状态
*/
@ExcelProperty(value = "合同状态")
private Long contractStatus;
private String contractStatus;
/**
* 合同编号
*/
private String contractCode;
/**
* 签署时间

View File

@ -11,7 +11,7 @@ import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
@ -63,7 +63,7 @@ public class PlantsRentalPlanVo implements Serializable {
*/
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "wy_kg")
private Long state;
private String state;
/**
* 备注
@ -77,4 +77,6 @@ public class PlantsRentalPlanVo implements Serializable {
@ExcelProperty(value = "创建时间")
private Date createTime;
private List<PlantsPlanProductVo> productList;
}

View File

@ -69,9 +69,14 @@ public class ResidentUnitVo implements Serializable {
/**
* 入驻位置
*/
@ExcelProperty(value = "入驻位置")
private String location;
/**
* 入驻位置
*/
@ExcelProperty(value = "入驻位置")
private String locationDetail;
/**
* 入驻时间
*/

View File

@ -4,6 +4,8 @@ import org.dromara.property.domain.PlantsPlanProduct;
import org.dromara.property.domain.vo.PlantsPlanProductVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import java.util.List;
/**
* 绿植租赁-租赁方案-绿植Mapper接口
*
@ -12,4 +14,7 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
*/
public interface PlantsPlanProductMapper extends BaseMapperPlus<PlantsPlanProduct, PlantsPlanProductVo> {
void deleteByPlanId(Long planId);
List<PlantsPlanProductVo> queryProductsInfo(Long planId);
}

View File

@ -1,9 +1,13 @@
package org.dromara.property.mapper;
import org.apache.ibatis.annotations.Select;
import org.dromara.property.domain.PlantsRentalOrder;
import org.dromara.property.domain.vo.PlantsRentalOrderVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import java.util.List;
import java.util.Map;
/**
* 绿植租赁-订单管理Mapper接口
*
@ -12,4 +16,28 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
*/
public interface PlantsRentalOrderMapper extends BaseMapperPlus<PlantsRentalOrder, PlantsRentalOrderVo> {
@Select("SELECT HOUR(create_time) AS hour, COUNT(*) AS count " +
"FROM plants_rental_order " +
"WHERE create_time >= CURDATE() AND create_time < DATE_ADD(CURDATE(), INTERVAL 1 DAY) " +
"GROUP BY HOUR(create_time)")
List<Map<String, Object>> countByDay();
@Select("SELECT " +
"CASE DAYOFWEEK(create_time) AS week," +
"COUNT(*) AS count" +
"FROM plants_rental_order " +
"WHERE create_time >= DATE_SUB(CURDATE(), INTERVAL WEEKDAY(CURDATE()) DAY) " +
"AND create_time < DATE_ADD(DATE_SUB(CURDATE(), INTERVAL WEEKDAY(CURDATE()) DAY), INTERVAL 7 DAY) " +
"GROUP BY DATE(create_time) " +
"ORDER BY day")
List<Map<String, Object>> countByWeek();
@Select("SELECT DAY(create_time) AS day, COUNT(*) AS count " +
"FROM plants_rental_order " +
"WHERE create_time >= DATE_FORMAT(CURDATE(), '%Y-%m-01') " +
"AND create_time < DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 1 MONTH), '%Y-%m-01') " +
"GROUP BY DAY(create_time) " +
"ORDER BY day")
List<Map<String, Object>> countByMonth();
}

View File

@ -12,4 +12,6 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
*/
public interface TbRoomMapper extends BaseMapperPlus<TbRoom, TbRoomVo> {
//查询房间名称
String queryRoomName(Long roomId);
}

View File

@ -66,4 +66,29 @@ public interface IPlantsPlanProductService {
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* 批量保存租赁方案植物
*
* @param list
* @return
*/
Boolean saveBatch(List<PlantsPlanProduct> list);
/**
* 修改租赁方案植物
*
* @param list
* @param planId
* @return
*/
Boolean updateByPlanId(List<PlantsPlanProduct> list, Long planId);
/**
* 查询租赁方案植物数据
*
* @param planId
* @return
*/
List<PlantsPlanProductVo> queryPlanProductsInfo(Long planId);
}

View File

@ -8,6 +8,7 @@ import org.dromara.common.mybatis.core.page.PageQuery;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* 绿植租赁-订单管理Service接口
@ -66,4 +67,17 @@ public interface IPlantsRentalOrderService {
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* 按时间统计订单数量
* @param timeUnit 1日 2周 3月
* @return
*/
Map<String,List> statisticsByTime(Integer timeUnit);
/**
* 按客户类型统计订单数量
* @return
*/
Map<String,List> countByCusType();
}

View File

@ -66,4 +66,11 @@ public interface IResidentPersonService {
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* 获取单位人员数量
* @param unitId
* @return
*/
Long queryPersonCount(Long unitId);
}

View File

@ -70,4 +70,11 @@ public interface ITbRoomService {
List<TbRoomVo> queryAll();
/**
* 获取详细房间名称
* @param roomId 房间id
* @return 房间名称
*/
String queryRoomName(Long roomId);
}

View File

@ -130,4 +130,38 @@ public class PlantsPlanProductServiceImpl implements IPlantsPlanProductService {
}
return baseMapper.deleteByIds(ids) > 0;
}
/**
* 批量保存租赁方案植物
*
* @param list
* @return
*/
@Override
public Boolean saveBatch(List<PlantsPlanProduct> list) {
return baseMapper.insertBatch(list);
}
/**
* 修改租赁方案植物
*
* @param list
* @param planId
* @return
*/
@Override
public Boolean updateByPlanId(List<PlantsPlanProduct> list, Long planId) {
baseMapper.deleteByPlanId(planId);
return baseMapper.insertBatch(list);
}
/**
* 查询租赁方案植物数据
* @param planId
* @return
*/
@Override
public List<PlantsPlanProductVo> queryPlanProductsInfo(Long planId) {
return baseMapper.queryProductsInfo(planId);
}
}

View File

@ -80,8 +80,8 @@ public class PlantsProductServiceImpl implements IPlantsProductService {
lqw.eq(StringUtils.isNotBlank(bo.getImgPath()), PlantsProduct::getImgPath, bo.getImgPath());
lqw.eq(StringUtils.isNotBlank(bo.getSpecification()), PlantsProduct::getSpecification, bo.getSpecification());
lqw.eq(bo.getRent() != null, PlantsProduct::getRent, bo.getRent());
lqw.eq(bo.getInventory() != null, PlantsProduct::getInventory, bo.getInventory());
lqw.eq(bo.getState() != null, PlantsProduct::getState, bo.getState());
lqw.gt(bo.getInventory()!=null,PlantsProduct::getInventory, bo.getInventory());
return lqw;
}
@ -98,6 +98,8 @@ public class PlantsProductServiceImpl implements IPlantsProductService {
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
add.setPlantCode("LZ"+add.getId());
baseMapper.updateById(add);
}
return flag;
}

View File

@ -1,5 +1,6 @@
package org.dromara.property.service.impl;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@ -16,9 +17,8 @@ import org.dromara.property.domain.PlantsRentalOrder;
import org.dromara.property.mapper.PlantsRentalOrderMapper;
import org.dromara.property.service.IPlantsRentalOrderService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.time.YearMonth;
import java.util.*;
/**
* 绿植租赁-订单管理Service业务层处理
@ -105,6 +105,8 @@ public class PlantsRentalOrderServiceImpl implements IPlantsRentalOrderService {
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
add.setOrderNo("ZL" + add.getId().toString());
baseMapper.updateById(add);
}
return flag;
}
@ -143,4 +145,102 @@ public class PlantsRentalOrderServiceImpl implements IPlantsRentalOrderService {
}
return baseMapper.deleteByIds(ids) > 0;
}
/**
* 按时间统计订单数量
*
* @param timeUnit 1日 2周 3月
* @return
*/
@Override
public Map<String, List> statisticsByTime(Integer timeUnit) {
if (timeUnit == 1) {
return countByDay();
} else if (timeUnit == 2) {
return countByWeek();
} else {
return countByMonth();
}
}
/**
* 统计日订单数
*
* @return
*/
public Map<String, List> countByDay() {
List<Map<String, Object>> maps = baseMapper.countByDay();
List<Integer> time = new ArrayList<>();
for (int i = 0; i < 24; i++) {
time.add(i);
}
List<Integer> counts = new ArrayList<>(Collections.nCopies(24, 0));
maps.forEach(item -> {
int hour = Integer.valueOf(item.get("hour").toString());
int count = Integer.valueOf(item.get("count").toString());
if (hour >= 0 && hour < 24) {
counts.set(hour, count);
}
});
Map<String, List> map = new HashMap<>();
map.put("time", time);
map.put("counts", counts);
return map;
}
/**
* 统计周订单数
*
* @return
*/
public Map<String, List> countByWeek() {
List<Map<String, Object>> maps = baseMapper.countByWeek();
String[] time = new String[]{"周一", "周二", "周三", "周四", "周五", "周六", "周日"};
List<Integer> counts = new ArrayList<>(Collections.nCopies(7, 0));
for (int i = 0; i < maps.size(); i++) {
if (i == 0) {
int count = Integer.valueOf(maps.get(i).get("count").toString());
counts.set(6, count);
} else if (i + 1 < maps.size()) {
int week = Integer.valueOf(maps.get(i + 1).get("week").toString());
int count = Integer.valueOf(maps.get(i + 1).get("count").toString());
counts.set(week, count);
}
}
Map<String, List> map = new HashMap<>();
map.put("time", Arrays.asList(time));
map.put("counts", counts);
return map;
}
/**
* 统计月订单数
* @return
*/
public Map<String, List> countByMonth() {
List<Map<String, Object>> maps = baseMapper.countByMonth();
int days = YearMonth.now().lengthOfMonth();
List<Integer> time = new ArrayList<>();
for (int i = 1; i <=days; i++) {
time.add(i);
}
List<Integer> counts = new ArrayList<>(Collections.nCopies(days, 0));
maps.forEach(item -> {
int day = Integer.valueOf(item.get("day").toString());
int count = Integer.valueOf(item.get("count").toString());
if (day >= 1 && day <= days) {
counts.set(day, count);
}
});
Map<String, List> map = new HashMap<>();
map.put("time", time);
map.put("counts", counts);
return map;
}
@Override
public Map<String, List> countByCusType() {
return Map.of();
}
}

View File

@ -1,5 +1,6 @@
package org.dromara.property.service.impl;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@ -9,6 +10,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.property.domain.PlantsPlanProduct;
import org.dromara.property.domain.vo.PlantsPlanProductVo;
import org.dromara.property.service.IPlantsPlanProductService;
import org.dromara.property.service.IPlantsProductService;
import org.springframework.stereotype.Service;
import org.dromara.property.domain.bo.PlantsRentalPlanBo;
import org.dromara.property.domain.vo.PlantsRentalPlanVo;
@ -16,9 +21,7 @@ import org.dromara.property.domain.PlantsRentalPlan;
import org.dromara.property.mapper.PlantsRentalPlanMapper;
import org.dromara.property.service.IPlantsRentalPlanService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.util.*;
/**
* 绿植租赁-租赁方案Service业务层处理
@ -33,6 +36,8 @@ public class PlantsRentalPlanServiceImpl implements IPlantsRentalPlanService {
private final PlantsRentalPlanMapper baseMapper;
private final IPlantsPlanProductService planProductService;
/**
* 查询绿植租赁-租赁方案
*
@ -41,7 +46,10 @@ public class PlantsRentalPlanServiceImpl implements IPlantsRentalPlanService {
*/
@Override
public PlantsRentalPlanVo queryById(Long id){
return baseMapper.selectVoById(id);
PlantsRentalPlanVo plantsRentalPlanVo = baseMapper.selectVoById(id);
List<PlantsPlanProductVo> list = planProductService.queryPlanProductsInfo(plantsRentalPlanVo.getId());
plantsRentalPlanVo.setProductList(list);
return plantsRentalPlanVo;
}
/**
@ -95,7 +103,18 @@ public class PlantsRentalPlanServiceImpl implements IPlantsRentalPlanService {
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
Long planId = add.getId();
bo.setId(planId);
if(CollectionUtils.isNotEmpty(bo.getProductIds())){
List<PlantsPlanProduct> list = new ArrayList<>();
for (Long productId : bo.getProductIds()) {
PlantsPlanProduct planProduct = new PlantsPlanProduct();
planProduct.setPlanId(planId);
planProduct.setProductId(productId);
list.add(planProduct);
}
planProductService.saveBatch(list);
}
}
return flag;
}
@ -110,6 +129,16 @@ public class PlantsRentalPlanServiceImpl implements IPlantsRentalPlanService {
public Boolean updateByBo(PlantsRentalPlanBo bo) {
PlantsRentalPlan update = MapstructUtils.convert(bo, PlantsRentalPlan.class);
validEntityBeforeSave(update);
if(CollectionUtils.isNotEmpty(bo.getProductIds())){
List<PlantsPlanProduct> list = new ArrayList<>();
for (Long productId : bo.getProductIds()) {
PlantsPlanProduct planProduct = new PlantsPlanProduct();
planProduct.setPlanId(update.getId());
planProduct.setProductId(productId);
list.add(planProduct);
}
planProductService.updateByPlanId(list,update.getId());
}
return baseMapper.updateById(update) > 0;
}

View File

@ -1,5 +1,6 @@
package org.dromara.property.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@ -139,4 +140,16 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
}
return baseMapper.deleteByIds(ids) > 0;
}
/**
* 获取单位人员数量
* @param unitId
* @return
*/
@Override
public Long queryPersonCount(Long unitId) {
LambdaQueryWrapper<ResidentPerson> lqw = Wrappers.lambdaQuery();
lqw.eq(unitId != null, ResidentPerson::getUnitId, unitId);
return baseMapper.selectCount(lqw);
}
}

View File

@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.property.service.IResidentPersonService;
import org.dromara.property.service.ITbRoomService;
import org.springframework.stereotype.Service;
import org.dromara.property.domain.bo.ResidentUnitBo;
import org.dromara.property.domain.vo.ResidentUnitVo;
@ -33,6 +35,10 @@ public class ResidentUnitServiceImpl implements IResidentUnitService {
private final ResidentUnitMapper baseMapper;
private final ITbRoomService roomService;
private final IResidentPersonService personService;
/**
* 查询入驻单位
*
@ -41,7 +47,15 @@ public class ResidentUnitServiceImpl implements IResidentUnitService {
*/
@Override
public ResidentUnitVo queryById(Long id){
return baseMapper.selectVoById(id);
ResidentUnitVo residentUnitVo = baseMapper.selectVoById(id);
//获取入驻位置详情
if(StringUtils.isNotBlank(residentUnitVo.getLocation())){
String roomName = roomService.queryRoomName(Long.valueOf(residentUnitVo.getLocation()));
residentUnitVo.setLocationDetail(roomName);
}
Long num = personService.queryPersonCount(residentUnitVo.getId());
residentUnitVo.setNumber(num);
return residentUnitVo;
}
/**

View File

@ -149,4 +149,14 @@ public class TbRoomServiceImpl implements ITbRoomService {
public List<TbRoomVo> queryAll() {
return baseMapper.selectVoList();
}
/**
* 获取房间名称
* @param roomId 房间id
* @return 房间名称
*/
@Override
public String queryRoomName(Long roomId) {
return baseMapper.queryRoomName(roomId);
}
}

View File

@ -3,5 +3,36 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.property.mapper.PlantsPlanProductMapper">
<resultMap id="planProductMap" type="org.dromara.property.domain.vo.PlantsPlanProductVo">
<result property="id" column="pid"/>
<result property="planId" column="plan_id"/>
<result property="productId" column="product_id"/>
<association property="product" javaType="org.dromara.property.domain.vo.PlantsProductVo">
<id property="id" column="id"/>
<result property="plantCode" column="plant_code"/>
<result property="plantName" column="plant_name"/>
<result property="plantType" column="plant_type"/>
<result property="imgPath" column="img_path"/>
<result property="specification" column="specification"/>
<result property="rent" column="rent"/>
<result property="inventory" column="inventory"/>
<result property="state" column="state"/>
<result property="remark" column="remark"/>
</association>
</resultMap>
<delete id="deleteByPlanId" parameterType="Long">
delete from plants_plan_product p where p.plan_id=#{planId}
</delete>
<select id="queryProductsInfo" resultMap="planProductMap">
select
c.id pid,
c.plan_id,
c.product_id,
p.*
from plants_plan_product c
left join plants_product p on c.product_id = p.id
where c.plan_id = #{planId}
</select>
</mapper>

View File

@ -4,4 +4,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.property.mapper.TbRoomMapper">
<select id="queryRoomName" resultType="java.lang.String">
select
concat(c.community_name,b.building_name,u.unit_name,f.floor_name,r.room_number)
from tb_room r
inner join tb_floor f on r.floor_id=f.id
inner join tb_unit u on r.unit_id=u.id
inner join tb_building b on r.building_id=b.id
inner join tb_community c on r.community_id=c.id
where r.id=#{roomId}
</select>
</mapper>