You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@streampark.apache.org by GitBox <gi...@apache.org> on 2022/11/01 15:06:39 UTC

[GitHub] [incubator-streampark] wuchunfu opened a new pull request, #1943: [Improve] Unified Mapper

wuchunfu opened a new pull request, #1943:
URL: https://github.com/apache/incubator-streampark/pull/1943

   <!--
   Thank you for contributing to StreamPark! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   ## Contribution Checklist
   
     - If this is your first time, please read our contributor guidelines: [Submit Code](https://streampark.apache.org/community/submit_guide/submit_code).
   
     - Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/streampark/issues).
   
     - Name the pull request in the form "[Feature] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
   
     - If the PR is unfinished, add `[WIP]` in your PR title, e.g., `[WIP][Feature] Title of the pull request`.
   
   -->
   
   ## What changes were proposed in this pull request
   
   Issue Number: #1771 <!-- REMOVE this line if no issue to close -->
   
   <!--(For example: This pull request proposed to add checkstyle plugin).-->
   
   ## Brief change log
   
   <!--*(for example:)*
   - *Add maven-checkstyle-plugin to root pom.xml*
   -->
   
   ## Verifying this change
   
   <!--*(Please pick either of the following options)*-->
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This change is already covered by existing tests, such as *(please describe tests)*.
   
   *(or)*
   
   This change added tests and can be verified as follows:
   
   <!--*(example:)*
   - *Added integration tests for end-to-end.*
   - *Added *Test to verify the change.*
   - *Manually verified the change by testing locally.* -->
   
   ## Does this pull request potentially affect one of the following parts
    - Dependencies (does it add or upgrade a dependency): (yes / no)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wolfboys commented on a diff in pull request #1943: [Improve] Unified Mapper

Posted by GitBox <gi...@apache.org>.
wolfboys commented on code in PR #1943:
URL: https://github.com/apache/incubator-streampark/pull/1943#discussion_r1011071795


##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MenuServiceImpl.java:
##########
@@ -133,7 +137,9 @@ public void updateMenu(Menu menu) throws Exception {
     public void deleteMenus(String[] menuIds) throws Exception {
         for (String menuId : menuIds) {
             // Find users associated with these menus/buttons
-            this.baseMapper.deleteRoleMenuByMenuId(Long.parseLong(menuId));
+            LambdaQueryWrapper<RoleMenu> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(StringUtils.isNotEmpty(menuId), RoleMenu::getMenuId, Long.parseLong(menuId));

Review Comment:
   Code could be more concise: ` queryWrapper.eq(RoleMenu::getMenuId, menuId);`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wuchunfu commented on pull request #1943: [Improve] Unified Mapper

Posted by GitBox <gi...@apache.org>.
wuchunfu commented on PR #1943:
URL: https://github.com/apache/incubator-streampark/pull/1943#issuecomment-1298751137

   @wolfboys PTAL, thanks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wuchunfu commented on a diff in pull request #1943: [Improve] Unified Mapper

Posted by GitBox <gi...@apache.org>.
wuchunfu commented on code in PR #1943:
URL: https://github.com/apache/incubator-streampark/pull/1943#discussion_r1011119426


##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MenuServiceImpl.java:
##########
@@ -133,7 +137,9 @@ public void updateMenu(Menu menu) throws Exception {
     public void deleteMenus(String[] menuIds) throws Exception {
         for (String menuId : menuIds) {
             // Find users associated with these menus/buttons
-            this.baseMapper.deleteRoleMenuByMenuId(Long.parseLong(menuId));
+            LambdaQueryWrapper<RoleMenu> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(RoleMenu::getMenuId, Long.parseLong(menuId));
+            this.roleMenuMapper.delete(queryWrapper);
             // Recursively delete these menus/buttons
             this.baseMapper.deleteById(menuId);

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wolfboys commented on pull request #1943: [Improve] Unified Mapper

Posted by GitBox <gi...@apache.org>.
wolfboys commented on PR #1943:
URL: https://github.com/apache/incubator-streampark/pull/1943#issuecomment-1299511931

   > > hi wuchunfu: thanks for your contribution, I see that you changed the parameterType and resultType to the full class name, good job, but many mapper.xml under the core module have not been changed, so can you modify them all together?
   > 
   > Yes, very willing to do this, but I plan to do this with another PR
   
   ok, looking forward to your next PR


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wolfboys commented on a diff in pull request #1943: [Improve] Unified Mapper

Posted by GitBox <gi...@apache.org>.
wolfboys commented on code in PR #1943:
URL: https://github.com/apache/incubator-streampark/pull/1943#discussion_r1011116687


##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MenuServiceImpl.java:
##########
@@ -133,7 +137,9 @@ public void updateMenu(Menu menu) throws Exception {
     public void deleteMenus(String[] menuIds) throws Exception {
         for (String menuId : menuIds) {
             // Find users associated with these menus/buttons
-            this.baseMapper.deleteRoleMenuByMenuId(Long.parseLong(menuId));
+            LambdaQueryWrapper<RoleMenu> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(RoleMenu::getMenuId, Long.parseLong(menuId));
+            this.roleMenuMapper.delete(queryWrapper);
             // Recursively delete these menus/buttons
             this.baseMapper.deleteById(menuId);

Review Comment:
   I recommend to use this method: `this.removeById(menuId);`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wuchunfu commented on pull request #1943: [Improve] Unified Mapper

Posted by GitBox <gi...@apache.org>.
wuchunfu commented on PR #1943:
URL: https://github.com/apache/incubator-streampark/pull/1943#issuecomment-1299504133

   > hi wuchunfu: thanks for your contribution, I see that you changed the parameterType and resultType to the full class name, good job, but many mapper.xml under the core module have not been changed, so can you modify them all together?
   
   Yes, very willing to do this, but I plan to do this with another PR


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wuchunfu commented on a diff in pull request #1943: [Improve] Unified Mapper

Posted by GitBox <gi...@apache.org>.
wuchunfu commented on code in PR #1943:
URL: https://github.com/apache/incubator-streampark/pull/1943#discussion_r1011068622


##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MenuServiceImpl.java:
##########
@@ -133,7 +133,9 @@ public void updateMenu(Menu menu) throws Exception {
     public void deleteMenus(String[] menuIds) throws Exception {
         for (String menuId : menuIds) {
             // Find users associated with these menus/buttons
-            this.baseMapper.deleteRoleMenuByMenuId(Long.parseLong(menuId));
+            LambdaQueryWrapper<Menu> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(StringUtils.isNotEmpty(menuId), Menu::getMenuId, Long.parseLong(menuId));
+            this.remove(queryWrapper);

Review Comment:
   I was careless, thanks for the reminder, I want to fix it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wolfboys commented on pull request #1943: [Improve] Unified Mapper

Posted by GitBox <gi...@apache.org>.
wolfboys commented on PR #1943:
URL: https://github.com/apache/incubator-streampark/pull/1943#issuecomment-1299499246

   hi wuchunfu:
   thanks for your contribution, I see that you changed the parameterType and resultType to the full class name, good job, but many mapper.xml under the core module have not been changed, so can you modify them all together?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wuchunfu commented on a diff in pull request #1943: [Improve] Unified Mapper

Posted by GitBox <gi...@apache.org>.
wuchunfu commented on code in PR #1943:
URL: https://github.com/apache/incubator-streampark/pull/1943#discussion_r1011080212


##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MenuServiceImpl.java:
##########
@@ -133,7 +137,9 @@ public void updateMenu(Menu menu) throws Exception {
     public void deleteMenus(String[] menuIds) throws Exception {
         for (String menuId : menuIds) {
             // Find users associated with these menus/buttons
-            this.baseMapper.deleteRoleMenuByMenuId(Long.parseLong(menuId));
+            LambdaQueryWrapper<RoleMenu> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(StringUtils.isNotEmpty(menuId), RoleMenu::getMenuId, Long.parseLong(menuId));

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wolfboys commented on a diff in pull request #1943: [Improve] Unified Mapper

Posted by GitBox <gi...@apache.org>.
wolfboys commented on code in PR #1943:
URL: https://github.com/apache/incubator-streampark/pull/1943#discussion_r1011054476


##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/MenuServiceImpl.java:
##########
@@ -133,7 +133,9 @@ public void updateMenu(Menu menu) throws Exception {
     public void deleteMenus(String[] menuIds) throws Exception {
         for (String menuId : menuIds) {
             // Find users associated with these menus/buttons
-            this.baseMapper.deleteRoleMenuByMenuId(Long.parseLong(menuId));
+            LambdaQueryWrapper<Menu> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(StringUtils.isNotEmpty(menuId), Menu::getMenuId, Long.parseLong(menuId));
+            this.remove(queryWrapper);

Review Comment:
   There is a bug here,It should be delete record in table `t_role_menu`, not  `t_menu`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-streampark] wolfboys merged pull request #1943: [Improve] Unified Mapper

Posted by GitBox <gi...@apache.org>.
wolfboys merged PR #1943:
URL: https://github.com/apache/incubator-streampark/pull/1943


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org