Some checks failed
Build and Deploy (service.xpcool.com) / build-and-deploy (push) Failing after 5m7s
- 新增 9 张房屋相关数据表(社区/楼宇/房源/价格快照/交易/设施/社区设施/学区/偏好) - 添加菜单权限种子数据并绑定超级管理员角色 - 生成 DAO 层代码和实体对象 - 实现房屋模块 API 接口(社区/房源/看板)和控制器服务层 - 支持多平台软关联匹配、笋盘标记和低可信度标记功能 - 更新超级管理员账号为 xxcool/xxCool@2026 - 调整 RBAC 菜单结构,移除管理员管理功能,新增日志管理菜单 - 修复 RBAC 安全漏洞,确保禁用角色权限失效 - 重构认证模块,将登录相关接口迁移到统一包结构下 - 移除废弃的管理模块和工具类接口定义 - 为通用工具包添加中文注释和文档说明
65 lines
2.7 KiB
Go
65 lines
2.7 KiB
Go
package house
|
|
|
|
import (
|
|
"context"
|
|
|
|
communityv1 "service.xpcool.com/api/house/community"
|
|
"service.xpcool.com/internal/model/dto"
|
|
community "service.xpcool.com/internal/service/house/community"
|
|
)
|
|
|
|
// CommunityList 分页查询小区。
|
|
func (c *Controller) CommunityList(ctx context.Context, req *communityv1.CommunityListReq) (res *communityv1.CommunityListRes, err error) {
|
|
list, total, err := community.Community().List(ctx, req.Page, req.Size, req.Keyword, req.Region)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
out := make([]*communityv1.CommunityItem, 0, len(list))
|
|
for i := range list {
|
|
e := &list[i]
|
|
out = append(out, &communityv1.CommunityItem{
|
|
Id: e.Id, Name: e.Name, Region: e.Region, BusinessDistrict: e.BusinessDistrict,
|
|
Address: e.Address, Lng: e.Lng, Lat: e.Lat, BuildYear: e.BuildYear,
|
|
Households: e.Households, PlotRatio: e.PlotRatio, GreenRate: e.GreenRate,
|
|
PropertyCompany: e.PropertyCompany, PropertyFee: e.PropertyFee, Developer: e.Developer, Source: e.Source,
|
|
})
|
|
}
|
|
return &communityv1.CommunityListRes{List: out, Total: total}, nil
|
|
}
|
|
|
|
// CommunityCreate 新增小区。
|
|
func (c *Controller) CommunityCreate(ctx context.Context, req *communityv1.CommunityCreateReq) (res *communityv1.CommunityCreateRes, err error) {
|
|
id, err := community.Community().Create(ctx, dto.HouseCommunityInput{
|
|
Name: req.Name, Region: req.Region, BusinessDistrict: req.BusinessDistrict,
|
|
Address: req.Address, Lng: req.Lng, Lat: req.Lat, BuildYear: req.BuildYear,
|
|
Households: req.Households, PlotRatio: req.PlotRatio, GreenRate: req.GreenRate,
|
|
PropertyCompany: req.PropertyCompany, PropertyFee: req.PropertyFee, Developer: req.Developer, Source: req.Source,
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &communityv1.CommunityCreateRes{Id: id}, nil
|
|
}
|
|
|
|
// CommunityUpdate 更新小区。
|
|
func (c *Controller) CommunityUpdate(ctx context.Context, req *communityv1.CommunityUpdateReq) (res *communityv1.CommunityUpdateRes, err error) {
|
|
err = community.Community().Update(ctx, dto.HouseCommunityInput{
|
|
Id: req.Id, Name: req.Name, Region: req.Region, BusinessDistrict: req.BusinessDistrict,
|
|
Address: req.Address, Lng: req.Lng, Lat: req.Lat, BuildYear: req.BuildYear,
|
|
Households: req.Households, PlotRatio: req.PlotRatio, GreenRate: req.GreenRate,
|
|
PropertyCompany: req.PropertyCompany, PropertyFee: req.PropertyFee, Developer: req.Developer,
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &communityv1.CommunityUpdateRes{}, nil
|
|
}
|
|
|
|
// CommunityDelete 删除小区。
|
|
func (c *Controller) CommunityDelete(ctx context.Context, req *communityv1.CommunityDeleteReq) (res *communityv1.CommunityDeleteRes, err error) {
|
|
if err = community.Community().Delete(ctx, req.Id); err != nil {
|
|
return nil, err
|
|
}
|
|
return &communityv1.CommunityDeleteRes{}, nil
|
|
}
|