service.xpcool.com/internal/dao/internal/house_preference.go
夏犀麟 4aca0c7f6f
Some checks failed
Build and Deploy (service.xpcool.com) / build-and-deploy (push) Failing after 5m7s
feat(house): 实现看房模块后端功能
- 新增 9 张房屋相关数据表(社区/楼宇/房源/价格快照/交易/设施/社区设施/学区/偏好)
- 添加菜单权限种子数据并绑定超级管理员角色
- 生成 DAO 层代码和实体对象
- 实现房屋模块 API 接口(社区/房源/看板)和控制器服务层
- 支持多平台软关联匹配、笋盘标记和低可信度标记功能
- 更新超级管理员账号为 xxcool/xxCool@2026
- 调整 RBAC 菜单结构,移除管理员管理功能,新增日志管理菜单
- 修复 RBAC 安全漏洞,确保禁用角色权限失效
- 重构认证模块,将登录相关接口迁移到统一包结构下
- 移除废弃的管理模块和工具类接口定义
- 为通用工具包添加中文注释和文档说明
2026-08-26 23:42:38 +08:00

108 lines
3.8 KiB
Go

// ==========================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// HousePreferenceDao is the data access object for the table house_preference.
type HousePreferenceDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns HousePreferenceColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// HousePreferenceColumns defines and stores column names for the table house_preference.
type HousePreferenceColumns struct {
Id string //
BudgetMin string // 预算下限(万元)
BudgetMax string // 预算上限(万元)
AreaMin string // 面积下限(平米)
AreaMax string // 面积上限(平米)
Layouts string // 户型偏好JSON
SubwayLines string // 地铁线路JSON
SchoolRequired string // 是否要求学区
CommuteTarget string // 通勤目标点
CommuteLimitMin string // 通勤上限(分钟)
RegionPrefer string // 区域偏好JSON
Weights string // 权重JSON
CreatedAt string //
UpdatedAt string //
DeletedAt string //
}
// housePreferenceColumns holds the columns for the table house_preference.
var housePreferenceColumns = HousePreferenceColumns{
Id: "id",
BudgetMin: "budget_min",
BudgetMax: "budget_max",
AreaMin: "area_min",
AreaMax: "area_max",
Layouts: "layouts",
SubwayLines: "subway_lines",
SchoolRequired: "school_required",
CommuteTarget: "commute_target",
CommuteLimitMin: "commute_limit_min",
RegionPrefer: "region_prefer",
Weights: "weights",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewHousePreferenceDao creates and returns a new DAO object for table data access.
func NewHousePreferenceDao(handlers ...gdb.ModelHandler) *HousePreferenceDao {
return &HousePreferenceDao{
group: "default",
table: "house_preference",
columns: housePreferenceColumns,
handlers: handlers,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *HousePreferenceDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *HousePreferenceDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *HousePreferenceDao) Columns() HousePreferenceColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *HousePreferenceDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *HousePreferenceDao) Ctx(ctx context.Context) *gdb.Model {
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// as it is automatically handled by this function.
func (dao *HousePreferenceDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}