top-think / top-think/think-orm

远程一对多根据关联条件查询问题

Open
#265 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
437
Forks
188
PR merge metrics
No merged PRs in 30d

Description

这个地方驼峰为什么转下划线 生成的SQL有问题
一对一关联 一对多关联hasWhere()方法都没有转下划线
image

SELECT
	`UserOrder`.*,
	`user_order`.* 
FROM
	`tb_user_order` `UserOrder`
	INNER JOIN `tb_order_status` `OrderStatus` ON `UserOrder`.`ID` = `OrderStatus`.`ID`
	INNER JOIN `tb_place_order_assign_manager` ON `tb_place_order_assign_manager`.`ORDER_ID` = `user_order`.`ID`
	JOIN `tb_manager_user` ON `tb_manager_user`.`ID` = `tb_place_order_assign_manager`.`MANAGER_ID` 
WHERE
	`tb_manager_user`.`username` LIKE '%测试%' 
GROUP BY
	`tb_manager_user`.`ID`

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the hasWhere() handling for one-to-one and one-to-many relations and reproduce the SQL shown in the issue. No files or tests are named; done means the generated SQL uses the intended identifier naming consistently and the relevant relation-query behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.