最近项目到收尾,由于没有测试人员,只能自己去测试;在测试同事的代码时,发现无论怎么更新(逻辑删除操作),表种的时间不会自动更新;
最开始以为自己憋出来的数据有问题,但是每次结果显示都是success,然后去数据库直接操作,时间也是会更新的;
以下使用模拟数据和表;
一、数据结构如下
user表
里面有两条数据
同事代码:
1、UserServiceImpl
package com.liuzm.service.impl;
import com.liuzm.bean.User;
import com.liuzm.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class UserServiceImpl {
@Autowired
UserMapper userMapper;
public void DeleteUserById(String id){
User user = userMapper.selectById(id);
if(user != null ){
user.setIsDelete("0");
int i = userMapper.updateUser(user);
if(i