批量插入
This commit is contained in:
@@ -1,24 +1,19 @@
|
||||
package com.czg.service.account.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.account.dto.PageDTO;
|
||||
import com.czg.account.dto.register.MerchantRegisterDTO;
|
||||
import com.czg.account.entity.MerchantRegister;
|
||||
import com.czg.account.service.MerchantRegisterService;
|
||||
import com.czg.account.vo.MerchantRegisterVO;
|
||||
import com.czg.service.account.mapper.MerchantRegisterMapper;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 激活码 服务层实现。
|
||||
@@ -27,7 +22,7 @@ import java.util.List;
|
||||
* @since 2025-02-11
|
||||
*/
|
||||
@Service
|
||||
public class MerchantRegisterServiceImpl extends ServiceImpl<MerchantRegisterMapper, MerchantRegister> implements MerchantRegisterService {
|
||||
public class MerchantRegisterServiceImpl extends ServiceImpl<MerchantRegisterMapper, MerchantRegister> implements MerchantRegisterService {
|
||||
|
||||
@Override
|
||||
public Page<MerchantRegister> get(PageDTO pageDTO, Integer state, String startTime, String endTime) {
|
||||
@@ -46,6 +41,7 @@ public class MerchantRegisterServiceImpl extends ServiceImpl<MerchantRegisterMap
|
||||
tbMerchantRegister.setPeriodMonth(merchantRegisterDTO.periodMonth());
|
||||
registers.add(tbMerchantRegister);
|
||||
}
|
||||
return saveBatch(registers);
|
||||
int i = mapper.insertBatchSelective(registers, 50);
|
||||
return i > 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class ShopExtendServiceImpl extends ServiceImpl<ShopExtendMapper, ShopExt
|
||||
newRecord.initAutoKey(key, shopId);
|
||||
newRecords.add(newRecord);
|
||||
}
|
||||
saveBatch(newRecords);
|
||||
mapper.insertBatchSelective(newRecords,50);
|
||||
return newRecords;
|
||||
} else {
|
||||
for (ShopExtend shopExtend : shopExtendList) {
|
||||
@@ -97,7 +97,7 @@ public class ShopExtendServiceImpl extends ServiceImpl<ShopExtendMapper, ShopExt
|
||||
newRecords.add(newRecord);
|
||||
}
|
||||
|
||||
saveBatch(newRecords);
|
||||
mapper.insertBatchSelective(newRecords,50);
|
||||
|
||||
shopExtendList.addAll(newRecords);
|
||||
return shopExtendList;
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ShopTableServiceImpl extends ServiceImpl<ShopTableMapper, ShopTable
|
||||
tableArrayList.add(shopTable);
|
||||
}
|
||||
|
||||
saveBatch(tableArrayList);
|
||||
mapper.insertBatchSelective(tableArrayList, 50);
|
||||
if (StrUtil.isNotBlank(msg.toString())) {
|
||||
msg.append("台桌名已存在,未添加");
|
||||
throw new CzgException(msg.toString());
|
||||
|
||||
@@ -36,7 +36,7 @@ import static com.mybatisflex.core.query.QueryMethods.column;
|
||||
* @since 2025-02-08
|
||||
*/
|
||||
@Service
|
||||
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements SysRoleService {
|
||||
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements SysRoleService {
|
||||
@Resource
|
||||
private SysMenuService sysMenuService;
|
||||
@Resource
|
||||
@@ -87,7 +87,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> imp
|
||||
}
|
||||
|
||||
return apiInfoItemDTOS.stream()
|
||||
.map(pattern -> StrUtil.format("({} LIKE '{}' ESCAPE '\\\\' and method = '{}')" , columnName, toSqlLikePattern(pattern.getUrl()), pattern.getMethod()))
|
||||
.map(pattern -> StrUtil.format("({} LIKE '{}' ESCAPE '\\\\' and method = '{}')", columnName, toSqlLikePattern(pattern.getUrl()), pattern.getMethod()))
|
||||
.collect(Collectors.joining(" OR "));
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> imp
|
||||
public Page<SysRole> getList(Long shopId, PageDTO pageDTO, String key, String startTime, String endTime) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
// if (!StpKit.USER.isAdmin()) {
|
||||
queryWrapper.eq(SysRole::getCreateUserId, StpKit.USER.getLoginIdAsLong());
|
||||
queryWrapper.eq(SysRole::getCreateUserId, StpKit.USER.getLoginIdAsLong());
|
||||
// }
|
||||
|
||||
if (StrUtil.isNotBlank(key)) {
|
||||
@@ -180,11 +180,10 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> imp
|
||||
|
||||
|
||||
// Step 4: 批量保存(如有数据)
|
||||
return rolesMenus.isEmpty() || sysRolesMenusService.saveBatch(rolesMenus);
|
||||
return rolesMenus.isEmpty() || sysRolesMenusService.getMapper().insertBatchSelective(rolesMenus, 50) > 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean editPermission(long userId, RolePermissionDTO rolePermissionDTO) {
|
||||
|
||||
Reference in New Issue
Block a user