简体   繁体   English

覆盖Play 1.2.4中的现有CRUD模块

[英]Overriding the existing CRUD module in Play 1.2.4

I am trying to implement CRUD module for managing the user roles in our application. 我正在尝试实现CRUD模块来管理应用程序中的用户角色。

I followed this link to implement and the basic functionality and template looks good. 我按照此链接进行实施,基本功能和模板看起来不错。 Now I need to customize it based on my requirement. 现在,我需要根据需要自定义它。

http://www.playframework.com/documentation/1.2.4/crud http://www.playframework.com/documentation/1.2.4/crud

The delete button click is deleting the record from the database but I don't want a permanent delete. 单击删除按钮正在从数据库中删除记录,但是我不希望永久删除。 We have a delId and delTS in the database. 我们在数据库中有一个delId和delTS。 On click of the delete button, I have to update these DB values (ie logical delete rather than physical delete). 单击删除按钮后,我必须更新这些数据库值(即逻辑删除而不是物理删除)。

My initial thought was to override the delete method present in the CRUD in my controller but I am not able to do so. 我最初的想法是重写控制器中CRUD中存在的delete方法,但我不能这样做。 I can see that all the methods present in the CRUD are made as static methods and the controller is extending the CRUD. 我可以看到CRUD中存在的所有方法都是静态方法,并且控制器正在扩展CRUD。 I wont be able to override the delete method present inside the CRUD.java since it is an static method. 我将无法覆盖CRUD.java内部存在的delete方法,因为它是静态方法。

Kindly let me know how to override a the delete button click functionality based on my requirement. 请让我知道如何根据我的要求覆盖删除按钮单击功能。

You can modify the routes files : 您可以修改路由文件:

 DELETE     /admin/roles/{id}   Roles.delete // assuming Roles extends CRUD

and define your own delete method in the Roles Controller. 并在“角色控制器”中定义自己的删除方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM