Get the App
SLTechnology News&Howtos  ›  Development  › 

What if the space-time field modified by MybatisPlus cannot be modified?

Shulou Source: shulou.com Published: 2022-06-03 20:03:41 10月02日 Update

This article mainly introduces how to modify the space-time field of MybatisPlus. What is introduced in this article is very detailed and has certain reference value. Friends who are interested must finish reading it.

MybatisPlus empty field cannot be modified

Click to modify

When the data is empty, click OK, but the data in the list is still the original data.

Look at the printout in the background and find that these two fields are not updated.

At this point, add to the entity class

The comment on this line means

When the property is modified, a value is automatically populated (the default is null), which means that the field is changed to empty rather than left unmodified.

Mybatis-Plus modifies the core code of the specified field / * change the password (you can only change your own password) * * @ author zhangxuewei * @ param userID * @ param password * @ param session * @ return * / @ ResponseBody @ RequestMapping (value = "/ updateUserPWD" Method = RequestMethod.POST) public ResultCode updateUserPWD (@ RequestParam (value = "password_old") String password, @ RequestParam (value = "password_new") String newpassword, HttpSession session) {logger.info ("updateUserPWD.") User user1 = (User) session.getAttribute ("sessionUser"); ResultCode res = new ResultCode (); EntityWrapper ew = new EntityWrapper (); ew.eq ("user_name", user1.getUserName ()); User user2= userService.selectOne (ew) If (user2.getPassWord (). Equals (AIAppUtils.encrypt (password) {if (StringUtils.isNotBlank (password) & & StringUtils.isNotBlank (newpassword)) {String setSql = "pass_word =" + "" + AIAppUtils.encrypt (newpassword) + "'; EntityWrapper ew1 = new EntityWrapper () Ew1.eq ("user_id", user1.getUserID ()); try {userService.updateForSet (setSql, ew1); session.removeAttribute ("sessionUser") Res.setCode (0);} catch (Exception e) {/ / TODO: handle exception res.setCode (1) }} else {/ / parameter cannot be empty res.setCode (1); res.setMsg ("parameter cannot be empty") }} else {res.setCode (1); res.setMsg ("original password is incorrect!") ;} return res;} these are all the contents of the article "what to do if the spatio-temporal field cannot be modified by MybatisPlus". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Fields passwords data how to do time and space content parameters articles original code value interest background entity guy partner attribute meaning time is in Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei macOS MySQL OPPO Reno Shulou Technology