@@ -53,20 +53,20 @@ public abstract class AbstractSimpleMetheaController<E extends AbstractMetheaEnt
5353 protected String configViewName ;
5454
5555 private final DataTableUIService dataTableUIService ;
56- protected AbstractSimpleMetheaService metheaService ;
56+ protected AbstractSimpleMetheaService simpleMetheaService ;
5757 protected AbstractMetheaValidator validator ;
5858
5959 public AbstractSimpleMetheaController (DataTableUIService dataTableUIService ) {
6060 this .dataTableUIService = dataTableUIService ;
6161 }
6262
63- @ RequestMapping (value = StringUtils .EMPTY , method = RequestMethod . GET )
63+ @ GetMapping (value = StringUtils .EMPTY )
6464 public String viewAllWithFilter (Model model , B binder , F filter , Pagination pagination , HttpServletRequest request ) {
6565 dataTableAttributes (model , binder , filter , pagination , request );
6666 return templatePath ;
6767 }
6868
69- @ RequestMapping (value = SAVE_URL , method = RequestMethod . POST )
69+ @ PostMapping (value = SAVE_URL )
7070 public ModelAndView save (B binder , Model model , F filter , Pagination pagination , HttpServletRequest request ) {
7171 Map <String , String > errors = new HashMap <>();
7272 validator .validate (binder , errors );
@@ -77,11 +77,11 @@ public ModelAndView save(B binder, Model model, F filter, Pagination pagination,
7777 model .addAttribute ("hasErrors" , true );
7878 return new ModelAndView (templatePath );
7979 }
80- metheaService .saveEntity (getEntityFromBinder (binder ), binder );
80+ simpleMetheaService .saveEntity (getEntityFromBinder (binder ), binder );
8181 return new ModelAndView ("redirect:" + ROOT_URL .concat (MConstant .SLASH ).concat (entity ));
8282 }
8383
84- @ RequestMapping (value = MODIFY_URL , method = RequestMethod . POST )
84+ @ PostMapping (value = MODIFY_URL )
8585 public ModelAndView modify (B binder , Model model , F filter , Pagination pagination , HttpServletRequest request ) {
8686 Map <String , String > errors = new HashMap <>();
8787 errors .put ("validateType" , "EDIT" );
@@ -94,7 +94,7 @@ public ModelAndView modify(B binder, Model model, F filter, Pagination paginatio
9494 model .addAttribute ("errors" , errors );
9595 return new ModelAndView (templatePath );
9696 }
97- metheaService .modifyEntity (getEntityId (binder ), binder );
97+ simpleMetheaService .modifyEntity (getEntityId (binder ), binder );
9898 return new ModelAndView ("redirect:" + ROOT_URL .concat (MConstant .SLASH ).concat (entity ));
9999 }
100100
@@ -104,7 +104,7 @@ public ResponseEntity<Map<String, Object>> getById(@RequestParam String id) {
104104 Map <String , Object > map = new HashMap <>();
105105 map .put (MConstant .JSON_STATUS , 500 );
106106 map .put (MConstant .JSON_MESSAGE , String .format ("Failed to get %s" , entity ));
107- Object view = metheaService .getEntityViewById (id );
107+ Object view = simpleMetheaService .getEntityViewById (id );
108108 if (!ObjectUtils .isEmpty (view )) {
109109 map .put (MConstant .JSON_STATUS , 200 );
110110 map .put (MConstant .JSON_MESSAGE , String .format ("Get %s success!" , entity ));
@@ -119,7 +119,7 @@ public ResponseEntity<Map<String, Object>> getEntityById(@RequestParam String id
119119 Map <String , Object > map = new HashMap <>();
120120 map .put (MConstant .JSON_STATUS , 500 );
121121 map .put (MConstant .JSON_MESSAGE , String .format ("Failed to get %s" , entity ));
122- Optional <E > o = metheaService .getEntityById (id );
122+ Optional <E > o = simpleMetheaService .getEntityById (id );
123123 if (o .isPresent ()) {
124124 map .put (MConstant .JSON_STATUS , 200 );
125125 map .put (MConstant .JSON_MESSAGE , String .format ("Get %s success!" , entity ));
@@ -135,7 +135,7 @@ public ResponseEntity<Map<String, Object>> activateEntity(@RequestBody Map<Strin
135135 map .put (MConstant .JSON_STATUS , 500 );
136136 map .put (MConstant .JSON_MESSAGE , String .format ("Failed to activate %s" , entity ));
137137 try {
138- if (metheaService .activateEntity (payload .get ("id" ))) {
138+ if (simpleMetheaService .activateEntity (payload .get ("id" ))) {
139139 map .put (MConstant .JSON_STATUS , 200 );
140140 map .put (MConstant .JSON_MESSAGE , String .format ("Activate %s success!" , entity ));
141141 }
@@ -153,7 +153,7 @@ public ResponseEntity<Map<String, Object>> deactivateEntity(@RequestBody Map<Str
153153 map .put (MConstant .JSON_STATUS , 500 );
154154 map .put (MConstant .JSON_MESSAGE , String .format ("Failed to deactivate %s" , entity ));
155155 try {
156- if (metheaService .deactivateEntity (payload .get ("id" ))) {
156+ if (simpleMetheaService .deactivateEntity (payload .get ("id" ))) {
157157 map .put (MConstant .JSON_STATUS , 200 );
158158 map .put (MConstant .JSON_MESSAGE , String .format ("Deactivate %s success!" , entity ));
159159 }
@@ -170,7 +170,7 @@ protected void dataTableAttributes(Model model, B binder, F filter, Pagination p
170170 }
171171
172172 Map <String , List <?>> map = new HashMap <>();
173- map .put (MConstant .JSON_DATA , metheaService .getAllEntityViewByFilter (getFilterColumns (filter ), pagination ));
173+ map .put (MConstant .JSON_DATA , simpleMetheaService .getAllEntityViewByFilter (getFilterColumns (filter ), pagination ));
174174 model .addAttribute (MConstant .CONTEXT_PATH_KEY , SystemUtils .getBaseUrl (request ));
175175 model .addAttribute ("tableHead" , MCache .CACHE_META_DATA .get (configViewName .concat (MConstant .COLUMNS_LABEL )));
176176 model .addAttribute ("tableColumns" , MCache .CACHE_META_DATA .get (configViewName .concat (MConstant .COLUMNS_KEY )));
0 commit comments