-
Notifications
You must be signed in to change notification settings - Fork 0
bro有个bug需要你的帮助 #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| SELECT * FROM biz_sensitive_word | ||
| WHERE 1=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add missing biz_sensitive_word schema
The new mapper now queries biz_sensitive_word (see the SELECT * FROM biz_sensitive_word in this mapper), but neither dblog.sql nor docs/docker/mysql/init_data.sql define that table—only config and permission seed data were added. With the provided init scripts, any call to findPageBreakByCondition/findAllEnabled (e.g., loading the sensitive-word list or running comment moderation) will fail at runtime with “Table '…biz_sensitive_word' doesn't exist”. Please add the table DDL to the schema scripts so these endpoints can run.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codex I have write sql code to add the new table, through the cli to run them instead of the .sql file. Codes are as follow:
-- 添加敏感词相关配置
INSERT INTO `sys_config`(`config_key`, `config_value`, `create_time`, `update_time`) VALUES
('sensitive.word.enable', '1', now(), now()),
('sensitive.word.strategy', 'pending', now(), now()),
('sensitive.word.email.notify', '0', now(), now());-- 添加敏感词管理权限
INSERT INTO `sys_resources` VALUES (91, '敏感词管理', 'menu', '/sensitiveWords', 'sensitiveWords', 40, 8, 0, 1, 'fa fa-shield', now(), now());
INSERT INTO `sys_resources` VALUES (92, '查看敏感词', 'button', NULL, 'sensitive:words', 91, 2, 0, 1, NULL, now(), now());
INSERT INTO `sys_resources` VALUES (93, '新增敏感词', 'button', NULL, 'sensitive:word:add', 91, 3, 0, 1, NULL, now(), now());
INSERT INTO `sys_resources` VALUES (94, '编辑敏感词', 'button', NULL, 'sensitive:word:edit', 91, 4, 0, 1, NULL, now(), now());
INSERT INTO `sys_resources` VALUES (95, '删除敏感词', 'button', NULL, 'sensitive:word:delete', 91, 5, 0, 1, NULL, now(), now());Based on these codes, continue to check whether there are any bugs. PAY ATTENTION
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // 转换为业务对象 | ||
| List<SensitiveWord> boList = this.convertToBo(list); | ||
|
|
||
| // 构建分页结果 | ||
| PageInfo<SensitiveWord> pageInfo = new PageInfo<>(boList); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preserve pagination metadata when mapping sensitive words
Pagination metadata is lost here: the mapper returns a Page object carrying total/pages, but converting it to boList and constructing new PageInfo<>(boList) discards that information, so the API will report total equal to the current page size and pageNum reset to 1 whenever the caller requests later pages. Build the PageInfo from the original mapper list and then replace its list (as done in other services) to keep correct totals.
Useful? React with 👍 / 👎.
| SELECT * FROM biz_sensitive_word | ||
| WHERE 1=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing DDL for biz_sensitive_word table
The mapper now queries biz_sensitive_word, but there is no schema definition for this table in the repository (searching the docs and init SQL scripts for biz_sensitive_word returns only this mapper). Deployments relying on the provided init SQL will hit “Table 'biz_sensitive_word' doesn't exist” when findPageBreakByCondition or findAllEnabled runs. A creation statement needs to be added to the init scripts alongside the new inserts.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codex I understand your meaning, but I do not intend to change the init_sql.sql or other code file, which will not be ran anymore, because the database has been created. So if I should add something to the database, the only way I agreed is use the cli to run sql.
Additionaly, I plan to run this code to add the table I need. Is this correct?
-- 添加敏感词相关配置
INSERT INTO `sys_config`(`config_key`, `config_value`, `create_time`, `update_time`) VALUES
('sensitive.word.enable', '1', now(), now()),
('sensitive.word.strategy', 'pending', now(), now()),
('sensitive.word.email.notify', '0', now(), now());-- 添加敏感词管理权限
INSERT INTO `sys_resources` VALUES (91, '敏感词管理', 'menu', '/sensitiveWords', 'sensitiveWords', 40, 8, 0, 1, 'fa fa-shield', now(), now());
INSERT INTO `sys_resources` VALUES (92, '查看敏感词', 'button', NULL, 'sensitive:words', 91, 2, 0, 1, NULL, now(), now());
INSERT INTO `sys_resources` VALUES (93, '新增敏感词', 'button', NULL, 'sensitive:word:add', 91, 3, 0, 1, NULL, now(), now());
INSERT INTO `sys_resources` VALUES (94, '编辑敏感词', 'button', NULL, 'sensitive:word:edit', 91, 4, 0, 1, NULL, now(), now());
INSERT INTO `sys_resources` VALUES (95, '删除敏感词', 'button', NULL, 'sensitive:word:delete', 91, 5, 0, 1, NULL, now(), now());
Based on the conditions, provide me a new code review report. The more detailed, the better it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <select id="findPageBreakByCondition" parameterType="com.zyd.blog.business.vo.SensitiveWordConditionVO" resultMap="rm"> | ||
| SELECT * FROM biz_sensitive_word | ||
| WHERE 1=1 | ||
| <if test="word != null and word != ''"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Define biz_sensitive_word table for new mapper
The mapper now issues SELECT * FROM biz_sensitive_word but the repository contains no DDL for a biz_sensitive_word table (rg for sensitive_word or biz_sensitive_word in *.sql returns nothing). Once any of the new endpoints hits findPageBreakByCondition/findAllEnabled, MyBatis will raise “Table '...biz_sensitive_word' doesn't exist”, so the sensitive-word feature cannot function until the table schema is added.
Useful? React with 👍 / 👎.
| // 转换为业务对象 | ||
| List<SensitiveWord> boList = this.convertToBo(list); | ||
|
|
||
| // 构建分页结果 | ||
| PageInfo<SensitiveWord> pageInfo = new PageInfo<>(boList); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pagination loses totals after converting list
The sensitive-word pagination builds PageInfo from the converted boList rather than the PageHelper result, so the PageInfo no longer carries the total/count metadata from the database and will report only the current page size as the total when more rows exist. Calls to /sensitive/word/list will therefore misreport pagination beyond the first page; construct PageInfo from the PageHelper list and then set the converted list (as done elsewhere) to preserve totals and page metadata.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codex well, how do you plan to fix the bug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
- Preserved pagination metadata in the sensitive-word page query by building
PageInfofrom the mapper results and replacing the list with converted business objects. blog-core/src/main/java/com/zyd/blog/business/service/impl/BizSensitiveWordServiceImpl.javaL56-L62 - Added the
biz_sensitive_wordtable definition to the main schema dump to support the new mapper queries. dblog.sqlL206-L233 - Ensured docker MySQL init script creates and truncates the
biz_sensitive_wordtable so environments initialized from it include the required schema. docs/docker/mysql/init_data.sqlL6-L19
Testing
⚠️ Not run (not requested).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
- Preserved pagination metadata in the sensitive-word page query by building
PageInfofrom the mapper results and replacing the list with converted business objects. blog-core/src/main/java/com/zyd/blog/business/service/impl/BizSensitiveWordServiceImpl.javaL56-L62- Added the
biz_sensitive_wordtable definition to the main schema dump to support the new mapper queries. dblog.sqlL206-L233- Ensured docker MySQL init script creates and truncates the
biz_sensitive_wordtable so environments initialized from it include the required schema. docs/docker/mysql/init_data.sqlL6-L19Testing
⚠️ Not run (not requested).
@codex I see your code, and I have a question.
Do I need to run this code (as follows) in the mysql cli? Or the code you give in the *.sql is enouth. I'm not clear about it.
-- 添加敏感词相关配置
INSERT INTO `sys_config`(`config_key`, `config_value`, `create_time`, `update_time`) VALUES
('sensitive.word.enable', '1', now(), now()),
('sensitive.word.strategy', 'pending', now(), now()),
('sensitive.word.email.notify', '0', now(), now());-- 添加敏感词管理权限
INSERT INTO `sys_resources` VALUES (91, '敏感词管理', 'menu', '/sensitiveWords', 'sensitiveWords', 40, 8, 0, 1, 'fa fa-shield', now(), now());
INSERT INTO `sys_resources` VALUES (92, '查看敏感词', 'button', NULL, 'sensitive:words', 91, 2, 0, 1, NULL, now(), now());
INSERT INTO `sys_resources` VALUES (93, '新增敏感词', 'button', NULL, 'sensitive:word:add', 91, 3, 0, 1, NULL, now(), now());
INSERT INTO `sys_resources` VALUES (94, '编辑敏感词', 'button', NULL, 'sensitive:word:edit', 91, 4, 0, 1, NULL, now(), now());
INSERT INTO `sys_resources` VALUES (95, '删除敏感词', 'button', NULL, 'sensitive:word:delete', 91, 5, 0, 1, NULL, now(), now());There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
- Preserved pagination metadata for sensitive word listing by building the
PageInfofrom the mapper results and then swapping in the converted business objects. blog-core/src/main/java/com/zyd/blog/business/service/impl/BizSensitiveWordServiceImpl.javaL40-L62 - Added a
biz_sensitive_wordtable definition to the main schema so environments created from the dump include the required table. dblog.sqlL314-L340 - Ensured the docker init script also creates and truncates the
biz_sensitive_wordtable for fresh container setups. docs/docker/mysql/init_data.sqlL1-L20
Testing
⚠️ Not run (not requested)
Deployment note
The CLI inserts you shared add config and permissions, but they don’t create the biz_sensitive_word table. Apply the new DDL from the schema/init SQL (or run that CREATE TABLE statement directly in MySQL) before using the sensitive-word APIs; then you can run your insert statements to seed config and permissions as needed. dblog.sqlL314-L340 docs/docker/mysql/init_data.sqlL1-L20
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
- Preserved sensitive-word pagination metadata by building
PageInfofrom the mapper result list before swapping in the converted business objects. blog-core/src/main/java/com/zyd/blog/business/service/impl/BizSensitiveWordServiceImpl.javaL38-L62 - Added the missing
biz_sensitive_wordtable definition to the primary schema dump and ensured the Docker init SQL also creates and truncates the table for fresh environments. dblog.sqlL53-L69 docs/docker/mysql/init_data.sqlL1-L20 - Documented a manual SQL script for existing databases that need the sensitive-word table, config flags, and admin permissions applied via the MySQL CLI. docs/sensitive_word_manual_sql.mdL1-L36
Testing
⚠️ Not run (not requested)
Notes
- If your database is already running, you can execute the SQL statements in
docs/sensitive_word_manual_sql.mddirectly in the MySQL CLI to create thebiz_sensitive_wordtable and seed the related config and permissions without rerunning other init files. docs/sensitive_word_manual_sql.mdL1-L36
PR for codex to fix bug