收音机页面路径配置

This commit is contained in:
张松
2025-04-02 14:22:52 +08:00
parent 3e3269e8bc
commit b976f041a3
14 changed files with 421 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
package com.czg.service.account.mapper;
import com.mybatisflex.core.BaseMapper;
import com.czg.account.entity.ShopPagePath;
/**
* 映射层。
*
* @author zs
* @since 2025-04-02
*/
public interface ShopPagePathMapper extends BaseMapper<ShopPagePath> {
}

View File

@@ -0,0 +1,14 @@
package com.czg.service.account.mapper;
import com.mybatisflex.core.BaseMapper;
import com.czg.account.entity.ShopStaffPagePermission;
/**
* 映射层。
*
* @author zs
* @since 2025-04-02
*/
public interface ShopStaffPagePermissionMapper extends BaseMapper<ShopStaffPagePermission> {
}

View File

@@ -0,0 +1,18 @@
package com.czg.service.account.service.impl;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.ShopPagePath;
import com.czg.account.service.ShopPagePathService;
import com.czg.service.account.mapper.ShopPagePathMapper;
import org.springframework.stereotype.Service;
/**
* 服务层实现。
*
* @author zs
* @since 2025-04-02
*/
@Service
public class ShopPagePathServiceImpl extends ServiceImpl<ShopPagePathMapper, ShopPagePath> implements ShopPagePathService{
}

View File

@@ -0,0 +1,54 @@
package com.czg.service.account.service.impl;
import com.czg.account.dto.pagepath.PagePathPermissionAddDTO;
import com.czg.account.entity.ShopPagePath;
import com.czg.account.entity.ShopStaff;
import com.czg.account.service.ShopPagePathService;
import com.czg.account.service.ShopStaffService;
import com.czg.exception.ApiNotPrintException;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.ShopStaffPagePermission;
import com.czg.account.service.ShopStaffPagePermissionService;
import com.czg.service.account.mapper.ShopStaffPagePermissionMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
/**
* 服务层实现。
*
* @author zs
* @since 2025-04-02
*/
@Service
public class ShopStaffPagePermissionServiceImpl extends ServiceImpl<ShopStaffPagePermissionMapper, ShopStaffPagePermission> implements ShopStaffPagePermissionService{
@Resource
private ShopPagePathService shopPagePathService;
@Resource
private ShopStaffService shopStaffService;
@Override
public Boolean add(Long shopId, PagePathPermissionAddDTO pagePathPermissionAddDTO) {
ShopStaff shopStaff = shopStaffService.getOne(new QueryWrapper().eq(ShopStaff::getId, pagePathPermissionAddDTO.getStaffId()).eq(ShopStaff::getShopId, shopId));
if (shopStaff == null) {
throw new ApiNotPrintException("员工不存在");
}
long count = shopPagePathService.count(new QueryWrapper().in(ShopPagePath::getId, pagePathPermissionAddDTO.getPagePathIdList()));
if (count != pagePathPermissionAddDTO.getPagePathIdList().size()) {
throw new ApiNotPrintException("存在错误id");
}
ArrayList<ShopStaffPagePermission> pagePermissions = new ArrayList<>();
pagePathPermissionAddDTO.getPagePathIdList().forEach(item -> {
ShopStaffPagePermission permission = new ShopStaffPagePermission();
permission.setShopId(shopId);
permission.setPagePathId(item);
permission.setStaffId(pagePathPermissionAddDTO.getStaffId());
pagePermissions.add(permission);
});
return saveBatch(pagePermissions);
}
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.czg.service.account.mapper.ShopPagePathMapper">
</mapper>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.czg.service.account.mapper.ShopStaffPagePermissionMapper">
</mapper>