小程序页面
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
package com.czg.service.system.mapper;
|
||||
|
||||
import com.czg.system.entity.MiniAppPages;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
|
||||
/**
|
||||
* 小程序页面路径 映射层。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-02-12
|
||||
*/
|
||||
public interface MiniAppPagesMapper extends BaseMapper<MiniAppPages> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.czg.service.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.resp.CzgRespCode;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.system.dto.MiniAppPagesDTO;
|
||||
import com.czg.system.entity.MiniAppPages;
|
||||
import com.czg.system.service.MiniAppPageService;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.service.system.mapper.MiniAppPagesMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 小程序页面路径 服务层实现。
|
||||
*
|
||||
* @author mac
|
||||
* @since 2025-02-12
|
||||
*/
|
||||
@Service
|
||||
public class MiniAppPagesServiceImpl extends ServiceImpl<MiniAppPagesMapper, MiniAppPages> implements MiniAppPageService {
|
||||
|
||||
@Override
|
||||
public CzgResult<Long> insertMiniAppPage(MiniAppPagesDTO pagesDTO) {
|
||||
if (exists(new QueryWrapper().eq(MiniAppPages::getName, pagesDTO.getName()))) {
|
||||
return CzgResult.failure("页面名称已存在");
|
||||
}
|
||||
MiniAppPages pages = BeanUtil.toBean(pagesDTO, MiniAppPages.class);
|
||||
save(pages);
|
||||
return CzgResult.success(pages.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public CzgResult<Boolean> updateMiniAppPage(MiniAppPagesDTO pagesDTO) {
|
||||
if (exists(new QueryWrapper().eq(MiniAppPages::getName, pagesDTO.getName()).ne(MiniAppPages::getId, pagesDTO.getId()))) {
|
||||
return CzgResult.failure("页面名称已存在");
|
||||
}
|
||||
|
||||
MiniAppPages pages = getById(pagesDTO.getId());
|
||||
if (pages == null) {
|
||||
return CzgResult.failure(CzgRespCode.RECORD_NOT_EXIST);
|
||||
}
|
||||
|
||||
pages.setIcon(pagesDTO.getIcon());
|
||||
pages.setName(pagesDTO.getName());
|
||||
pages.setStatus(pagesDTO.getStatus());
|
||||
pages.setDescription(pagesDTO.getDescription());
|
||||
pages.setStatus(pagesDTO.getStatus());
|
||||
pages.setSort(pagesDTO.getSort());
|
||||
updateById(pages);
|
||||
|
||||
return CzgResult.success(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CzgResult<Boolean> deleteMiniAppPageById(Long id) {
|
||||
MiniAppPages pages = getById(id);
|
||||
if (pages == null) {
|
||||
return CzgResult.failure(CzgRespCode.RECORD_NOT_EXIST);
|
||||
}
|
||||
|
||||
removeById(id);
|
||||
return CzgResult.success(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CzgResult<Page<MiniAppPagesDTO>> getMiniAppPage(String name, String path, Integer status) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
if (StrUtil.isNotEmpty(name)) {
|
||||
queryWrapper.like(MiniAppPages::getName, name);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(path)) {
|
||||
queryWrapper.like(MiniAppPages::getPath, path);
|
||||
}
|
||||
if (status != null && status != -1) {
|
||||
queryWrapper.eq(MiniAppPages::getStatus, status);
|
||||
}
|
||||
queryWrapper.orderBy(MiniAppPages::getSort, true);
|
||||
Page<MiniAppPagesDTO> dtoPage = pageAs(PageUtil.buildPage(), queryWrapper, MiniAppPagesDTO.class);
|
||||
return CzgResult.success(dtoPage);
|
||||
}
|
||||
}
|
||||
@@ -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.system.mapper.MiniAppPagesMapper">
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user