全局修改物理删除为逻辑删除,同时修改查询语句过滤删除标识

This commit is contained in:
qiankunpingtai
2019-04-01 17:07:13 +08:00
parent 7dc1cdaafc
commit 1f2cf8c313
85 changed files with 1632 additions and 224 deletions

View File

@@ -7,6 +7,7 @@ import com.jsh.erp.datasource.mappers.*;
import com.jsh.erp.datasource.vo.AccountVo4InOutList;
import com.jsh.erp.datasource.vo.AccountVo4List;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil;
import com.jsh.erp.utils.Tools;
import org.slf4j.Logger;
@@ -45,6 +46,8 @@ public class AccountService {
private AccountItemMapper accountItemMapper;
@Resource
private LogService logService;
@Resource
private UserService userService;
public Account getAccount(long id) {
return accountMapper.selectByPrimaryKey(id);
@@ -112,7 +115,8 @@ public class AccountService {
public int checkIsNameExist(Long id, String name) {
AccountExample example = new AccountExample();
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name);
example.createCriteria().andIdNotEqualTo(id).andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<Account> list = accountMapper.selectByExample(example);
return list.size();
}
@@ -317,5 +321,13 @@ public class AccountService {
example.createCriteria().andIdEqualTo(accountId);
return accountMapper.updateByExampleSelective(account, example);
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteAccountByIds(String ids) {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_ACCOUNT,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");
return accountMapperEx.batchDeleteAccountByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}
}