update[litemall-db]: 基于mybatis generator的逻辑删除插件来进行删除操作。
This commit is contained in:
@@ -57,12 +57,7 @@ public class LitemallAdService {
|
||||
}
|
||||
|
||||
public void deleteById(Integer id) {
|
||||
LitemallAd ad = adMapper.selectByPrimaryKey(id);
|
||||
if(ad == null){
|
||||
return;
|
||||
}
|
||||
ad.setDeleted(true);
|
||||
adMapper.updateByPrimaryKey(ad);
|
||||
adMapper.logicalDeleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void add(LitemallAd ad) {
|
||||
|
||||
@@ -34,12 +34,7 @@ public class LitemallAddressService {
|
||||
}
|
||||
|
||||
public void delete(Integer id) {
|
||||
LitemallAddress address = addressMapper.selectByPrimaryKey(id);
|
||||
if(address == null){
|
||||
return;
|
||||
}
|
||||
address.setDeleted(true);
|
||||
addressMapper.updateByPrimaryKey(address);
|
||||
addressMapper.logicalDeleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public LitemallAddress findDefault(Integer userId) {
|
||||
|
||||
@@ -53,12 +53,7 @@ public class LitemallAdminService {
|
||||
}
|
||||
|
||||
public void deleteById(Integer id) {
|
||||
LitemallAdmin admin = adminMapper.selectByPrimaryKey(id);
|
||||
if(admin == null){
|
||||
return;
|
||||
}
|
||||
admin.setDeleted(true);
|
||||
adminMapper.updateByPrimaryKey(admin);
|
||||
adminMapper.logicalDeleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void add(LitemallAdmin admin) {
|
||||
|
||||
@@ -75,12 +75,7 @@ public class LitemallBrandService {
|
||||
}
|
||||
|
||||
public void deleteById(Integer id) {
|
||||
LitemallBrand brand = brandMapper.selectByPrimaryKey(id);
|
||||
if(brand == null){
|
||||
return;
|
||||
}
|
||||
brand.setDeleted(true);
|
||||
brandMapper.updateByPrimaryKey(brand);
|
||||
brandMapper.logicalDeleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void add(LitemallBrand brand) {
|
||||
|
||||
@@ -50,9 +50,7 @@ public class LitemallCartService {
|
||||
public int delete(List<Integer> productIdList, int userId) {
|
||||
LitemallCartExample example = new LitemallCartExample();
|
||||
example.or().andUserIdEqualTo(userId).andProductIdIn(productIdList);
|
||||
LitemallCart cart = new LitemallCart();
|
||||
cart.setDeleted(true);
|
||||
return cartMapper.updateByExampleSelective(cart, example);
|
||||
return cartMapper.logicalDeleteByExample(example);
|
||||
}
|
||||
|
||||
public LitemallCart findById(Integer id) {
|
||||
@@ -107,11 +105,6 @@ public class LitemallCartService {
|
||||
}
|
||||
|
||||
public void deleteById(Integer id) {
|
||||
LitemallCart cart = cartMapper.selectByPrimaryKey(id);
|
||||
if(cart == null){
|
||||
return;
|
||||
}
|
||||
cart.setDeleted(true);
|
||||
cartMapper.updateByPrimaryKey(cart);
|
||||
cartMapper.logicalDeleteByPrimaryKey(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,12 +87,7 @@ public class LitemallCategoryService {
|
||||
}
|
||||
|
||||
public void deleteById(Integer id) {
|
||||
LitemallCategory category = categoryMapper.selectByPrimaryKey(id);
|
||||
if(category == null){
|
||||
return;
|
||||
}
|
||||
category.setDeleted(true);
|
||||
categoryMapper.updateByPrimaryKey(category);
|
||||
categoryMapper.logicalDeleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void add(LitemallCategory category) {
|
||||
|
||||
@@ -42,12 +42,7 @@ public class LitemallCollectService {
|
||||
}
|
||||
|
||||
public void deleteById(Integer id) {
|
||||
LitemallCollect collect = collectMapper.selectByPrimaryKey(id);
|
||||
if(collect == null){
|
||||
return;
|
||||
}
|
||||
collect.setDeleted(true);
|
||||
collectMapper.updateByPrimaryKey(collect);
|
||||
collectMapper.logicalDeleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public int add(LitemallCollect collect) {
|
||||
|
||||
@@ -107,12 +107,7 @@ public class LitemallCommentService {
|
||||
}
|
||||
|
||||
public void deleteById(Integer id) {
|
||||
LitemallComment comment = commentMapper.selectByPrimaryKey(id);
|
||||
if(comment == null){
|
||||
return;
|
||||
}
|
||||
comment.setDeleted(true);
|
||||
commentMapper.updateByPrimaryKey(comment);
|
||||
commentMapper.logicalDeleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void add(LitemallComment comment) {
|
||||
|
||||
@@ -34,12 +34,7 @@ public class LitemallFootprintService {
|
||||
}
|
||||
|
||||
public void deleteById(Integer id){
|
||||
LitemallFootprint footprint = footprintMapper.selectByPrimaryKey(id);
|
||||
if(footprint == null){
|
||||
return;
|
||||
}
|
||||
footprint.setDeleted(true);
|
||||
footprintMapper.updateByPrimaryKey(footprint);
|
||||
footprintMapper.logicalDeleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void add(LitemallFootprint footprint) {
|
||||
|
||||
@@ -50,12 +50,7 @@ public class LitemallGoodsAttributeService {
|
||||
}
|
||||
|
||||
public void deleteById(Integer id) {
|
||||
LitemallGoodsAttribute goodsAttribute = goodsAttributeMapper.selectByPrimaryKey(id);
|
||||
if(goodsAttribute == null){
|
||||
return;
|
||||
}
|
||||
goodsAttribute.setDeleted(true);
|
||||
goodsAttributeMapper.updateByPrimaryKey(goodsAttribute);
|
||||
goodsAttributeMapper.logicalDeleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void add(LitemallGoodsAttribute goodsAttribute) {
|
||||
|
||||
@@ -169,12 +169,7 @@ public class LitemallGoodsService {
|
||||
}
|
||||
|
||||
public void deleteById(Integer id) {
|
||||
LitemallGoods goods = goodsMapper.selectByPrimaryKey(id);
|
||||
if(goods == null){
|
||||
return;
|
||||
}
|
||||
goods.setDeleted(true);
|
||||
goodsMapper.updateByPrimaryKeySelective(goods);
|
||||
goodsMapper.logicalDeleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void add(LitemallGoods goods) {
|
||||
|
||||
@@ -57,12 +57,7 @@ public class LitemallGoodsSpecificationService {
|
||||
}
|
||||
|
||||
public void deleteById(Integer id) {
|
||||
LitemallGoodsSpecification goodsSpecification = goodsSpecificationMapper.selectByPrimaryKey(id);
|
||||
if(goodsSpecification == null){
|
||||
return;
|
||||
}
|
||||
goodsSpecification.setDeleted(true);
|
||||
goodsSpecificationMapper.updateByPrimaryKey(goodsSpecification);
|
||||
goodsSpecificationMapper.logicalDeleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void add(LitemallGoodsSpecification goodsSpecification) {
|
||||
|
||||
@@ -22,12 +22,7 @@ public class LitemallIssueService {
|
||||
}
|
||||
|
||||
public void deleteById(Integer id) {
|
||||
LitemallIssue issue = issueMapper.selectByPrimaryKey(id);
|
||||
if(issue == null){
|
||||
return;
|
||||
}
|
||||
issue.setDeleted(true);
|
||||
issueMapper.updateByPrimaryKey(issue);
|
||||
issueMapper.logicalDeleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void add(LitemallIssue issue) {
|
||||
|
||||
@@ -86,11 +86,6 @@ public class LitemallKeywordService {
|
||||
}
|
||||
|
||||
public void deleteById(Integer id) {
|
||||
LitemallKeyword keywords = keywordsMapper.selectByPrimaryKey(id);
|
||||
if(keywords == null){
|
||||
return;
|
||||
}
|
||||
keywords.setDeleted(true);
|
||||
keywordsMapper.updateByPrimaryKey(keywords);
|
||||
keywordsMapper.logicalDeleteByPrimaryKey(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,12 +136,7 @@ public class LitemallOrderService {
|
||||
}
|
||||
|
||||
public void deleteById(Integer id) {
|
||||
LitemallOrder order = orderMapper.selectByPrimaryKey(id);
|
||||
if(order == null){
|
||||
return;
|
||||
}
|
||||
order.setDeleted(true);
|
||||
orderMapper.updateByPrimaryKey(order);
|
||||
orderMapper.logicalDeleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public int count() {
|
||||
|
||||
@@ -54,12 +54,7 @@ public class LitemallProductService {
|
||||
}
|
||||
|
||||
public void deleteById(Integer id) {
|
||||
LitemallProduct product = productMapper.selectByPrimaryKey(id);
|
||||
if(product == null){
|
||||
return;
|
||||
}
|
||||
product.setDeleted(true);
|
||||
productMapper.updateByPrimaryKey(product);
|
||||
productMapper.logicalDeleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void add(LitemallProduct product) {
|
||||
|
||||
@@ -29,9 +29,7 @@ public class LitemallSearchHistoryService {
|
||||
public void deleteByUid(int uid) {
|
||||
LitemallSearchHistoryExample example = new LitemallSearchHistoryExample();
|
||||
example.or().andUserIdEqualTo(uid);
|
||||
LitemallSearchHistory searchHistory = new LitemallSearchHistory();
|
||||
searchHistory.setDeleted(true);
|
||||
searchHistoryMapper.updateByExampleSelective(searchHistory, example);
|
||||
searchHistoryMapper.logicalDeleteByExample(example);
|
||||
}
|
||||
|
||||
public void deleteById(Integer id) {
|
||||
@@ -40,7 +38,7 @@ public class LitemallSearchHistoryService {
|
||||
return;
|
||||
}
|
||||
searchHistory.setDeleted(true);
|
||||
searchHistoryMapper.updateByPrimaryKey(searchHistory);
|
||||
searchHistoryMapper.logicalDeleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void add(LitemallSearchHistory searchHistory) {
|
||||
|
||||
@@ -18,9 +18,7 @@ public class LitemallStorageService {
|
||||
public void deleteByKey(String key) {
|
||||
LitemallStorageExample example = new LitemallStorageExample();
|
||||
example.or().andKeyEqualTo(key);
|
||||
LitemallStorage storage = new LitemallStorage();
|
||||
storage.setDeleted(true);
|
||||
storageMapper.updateByExampleSelective(storage, example);
|
||||
storageMapper.logicalDeleteByExample(example);
|
||||
}
|
||||
|
||||
public void add(LitemallStorage storageInfo) {
|
||||
|
||||
@@ -92,12 +92,7 @@ public class LitemallTopicService {
|
||||
}
|
||||
|
||||
public void deleteById(Integer id) {
|
||||
LitemallTopic topic = topicMapper.selectByPrimaryKey(id);
|
||||
if(topic == null){
|
||||
return;
|
||||
}
|
||||
topic.setDeleted(true);
|
||||
topicMapper.updateByPrimaryKeySelective(topic);
|
||||
topicMapper.logicalDeleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void add(LitemallTopic topic) {
|
||||
|
||||
@@ -83,11 +83,6 @@ public class LitemallUserService {
|
||||
}
|
||||
|
||||
public void deleteById(Integer id) {
|
||||
LitemallUser user = userMapper.selectByPrimaryKey(id);
|
||||
if(user == null){
|
||||
return;
|
||||
}
|
||||
user.setDeleted(true);
|
||||
userMapper.updateByPrimaryKey(user);
|
||||
userMapper.logicalDeleteByPrimaryKey(id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user