新增小程序页面管理模块
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
package com.gxwebsoft.cms.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.cms.service.MpPagesService;
|
||||
import com.gxwebsoft.cms.entity.MpPages;
|
||||
import com.gxwebsoft.cms.param.MpPagesParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 小程序页面控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-07-20 19:49:55
|
||||
*/
|
||||
@Api(tags = "小程序页面管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/cms/mp-pages")
|
||||
public class MpPagesController extends BaseController {
|
||||
@Resource
|
||||
private MpPagesService mpPagesService;
|
||||
|
||||
@ApiOperation("分页查询小程序页面")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<MpPages>> page(MpPagesParam param) {
|
||||
// 使用关联查询
|
||||
return success(mpPagesService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部小程序页面")
|
||||
@GetMapping()
|
||||
public ApiResult<List<MpPages>> list(MpPagesParam param) {
|
||||
// 使用关联查询
|
||||
return success(mpPagesService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:mpPages:list')")
|
||||
@ApiOperation("根据id查询小程序页面")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<MpPages> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(mpPagesService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加小程序页面")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody MpPages mpPages) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
mpPages.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (mpPagesService.save(mpPages)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改小程序页面")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody MpPages mpPages) {
|
||||
if (mpPagesService.updateById(mpPages)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除小程序页面")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (mpPagesService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加小程序页面")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<MpPages> list) {
|
||||
if (mpPagesService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改小程序页面")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<MpPages> batchParam) {
|
||||
if (batchParam.update(mpPagesService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除小程序页面")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (mpPagesService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +1,31 @@
|
||||
package com.gxwebsoft.cms.controller;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.gxwebsoft.cms.entity.*;
|
||||
import com.gxwebsoft.cms.param.*;
|
||||
import com.gxwebsoft.cms.param.MpMenuParam;
|
||||
import com.gxwebsoft.cms.param.NavigationParam;
|
||||
import com.gxwebsoft.cms.param.WebsiteParam;
|
||||
import com.gxwebsoft.cms.service.*;
|
||||
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||
import com.gxwebsoft.common.core.utils.CommonUtil;
|
||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||
import com.gxwebsoft.common.core.web.*;
|
||||
import com.gxwebsoft.common.system.entity.Menu;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.Dict;
|
||||
import com.gxwebsoft.common.system.entity.DictData;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.service.UserService;
|
||||
import com.gxwebsoft.common.system.service.DictDataService;
|
||||
import com.gxwebsoft.common.system.service.DictService;
|
||||
import com.gxwebsoft.oa.entity.Company;
|
||||
import com.gxwebsoft.oa.param.LinkParam;
|
||||
import com.gxwebsoft.oa.service.LinkService;
|
||||
import com.gxwebsoft.shop.entity.Merchant;
|
||||
import com.gxwebsoft.shop.entity.MerchantAccount;
|
||||
import com.gxwebsoft.shop.entity.Order;
|
||||
import com.gxwebsoft.shop.service.MerchantAccountService;
|
||||
import com.gxwebsoft.shop.service.MerchantService;
|
||||
import com.gxwebsoft.shop.service.OrderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -35,15 +36,10 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import static com.gxwebsoft.common.core.utils.CommonUtil.toTreeData;
|
||||
|
||||
@@ -79,6 +75,10 @@ public class WebsiteController extends BaseController {
|
||||
private MpMenuService mpMenuService;
|
||||
@Resource
|
||||
private OrderService orderService;
|
||||
@Resource
|
||||
private DictService dictService;
|
||||
@Resource
|
||||
private DictDataService dictDataService;
|
||||
|
||||
@ApiOperation("获取网站信息")
|
||||
@GetMapping("/getSiteInfo")
|
||||
@@ -215,6 +215,30 @@ public class WebsiteController extends BaseController {
|
||||
navigation.setType(1);
|
||||
navigation.setPosition(1);
|
||||
navigationService.save(navigation);
|
||||
// 添加字典
|
||||
final Dict dict = new Dict();
|
||||
dict.setDictName("路由方式");
|
||||
dict.setDictCode("navType");
|
||||
dict.setSortNumber(100);
|
||||
final boolean save = dictService.save(dict);
|
||||
final Integer dictId = dict.getDictId();
|
||||
final DictData dictData = new DictData();
|
||||
dictData.setDictDataName("uni.navigateTo");
|
||||
dictData.setDictDataCode("uni.navigateTo");
|
||||
dictData.setComments("保留当前页面,跳转到应用内的某个页面,使用uni.navigateBack可以返回到原页面");
|
||||
dictDataService.save(dictData);
|
||||
dictData.setDictDataName("uni.redirectTo");
|
||||
dictData.setDictDataCode("uni.redirectTo");
|
||||
dictData.setComments("关闭当前页面,跳转到应用内的某个页面");
|
||||
dictDataService.save(dictData);
|
||||
dictData.setDictDataName("uni.reLaunch");
|
||||
dictData.setDictDataCode("uni.reLaunch");
|
||||
dictData.setComments("关闭所有页面,打开到应用内的某个页面");
|
||||
dictDataService.save(dictData);
|
||||
dictData.setDictDataName("uni.switchTab");
|
||||
dictData.setDictDataCode("uni.switchTab");
|
||||
dictData.setComments("跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面");
|
||||
dictDataService.save(dictData);
|
||||
// 网站配置参数
|
||||
List<WebsiteField> fields = new ArrayList<>();
|
||||
WebsiteField field = new WebsiteField();
|
||||
@@ -222,36 +246,35 @@ public class WebsiteController extends BaseController {
|
||||
field.setName("siteLogo");
|
||||
field.setValue(company.getCompanyLogo());
|
||||
field.setComments("网站LOGO");
|
||||
fields.add(field);
|
||||
websiteFieldService.save(field);
|
||||
field.setName("siteName");
|
||||
field.setValue(company.getShortName());
|
||||
field.setComments("网站名称");
|
||||
fields.add(field);
|
||||
websiteFieldService.save(field);
|
||||
field.setName("icpNo");
|
||||
field.setValue("-");
|
||||
field.setComments("备案号");
|
||||
fields.add(field);
|
||||
websiteFieldService.save(field);
|
||||
field.setName("qrcode");
|
||||
field.setValue("");
|
||||
field.setComments("公众号二维码");
|
||||
fields.add(field);
|
||||
websiteFieldService.save(field);
|
||||
field.setName("bottomBg");
|
||||
field.setValue("https://oss.wsdns.cn/20240717/13165035c35e4f25a6c9fbd3636c6292.png");
|
||||
field.setComments("网站底部背景图");
|
||||
fields.add(field);
|
||||
websiteFieldService.save(field);
|
||||
field.setName("address");
|
||||
field.setValue(company.getAddress());
|
||||
field.setComments("办公地址");
|
||||
fields.add(field);
|
||||
websiteFieldService.save(field);
|
||||
field.setName("tel");
|
||||
field.setValue(company.getTel());
|
||||
field.setComments("公司电话");
|
||||
fields.add(field);
|
||||
websiteFieldService.save(field);
|
||||
field.setName("domain");
|
||||
field.setValue(company.getDomain());
|
||||
field.setComments("网站域名");
|
||||
fields.add(field);
|
||||
websiteFieldService.saveBatch(fields);
|
||||
websiteFieldService.save(field);
|
||||
}
|
||||
|
||||
// 获取站点信息
|
||||
@@ -286,11 +309,7 @@ public class WebsiteController extends BaseController {
|
||||
final List<Ad> list = adService.list(new LambdaQueryWrapper<Ad>().eq(Ad::getAdType,"幻灯片"));
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
final Ad ad = list.get(0);
|
||||
final String images = ad.getImages();
|
||||
System.out.println("images = " + images);
|
||||
final JSONObject jsonObject = JSONObject.parseObject(images);
|
||||
System.out.println("jsonObject = " + jsonObject);
|
||||
// website.setSlide(jsonObject);
|
||||
website.setSlide(ad);
|
||||
}
|
||||
|
||||
// 首页布局
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.gxwebsoft.cms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 小程序页面
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-07-20 19:49:55
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "MpPages对象", description = "小程序页面")
|
||||
@TableName("cms_mp_pages")
|
||||
public class MpPages implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "上级id, 0是顶级")
|
||||
private Integer parentId;
|
||||
|
||||
@ApiModelProperty(value = "页面名称")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "页面路径")
|
||||
private String path;
|
||||
|
||||
@ApiModelProperty(value = "设为首页")
|
||||
private Integer home;
|
||||
|
||||
@ApiModelProperty(value = "分包")
|
||||
private String subpackage;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "注册时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -1,23 +1,16 @@
|
||||
package com.gxwebsoft.cms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.gxwebsoft.common.system.entity.Menu;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.entity.UserInfo;
|
||||
import com.gxwebsoft.oa.entity.Link;
|
||||
import com.gxwebsoft.shop.entity.Merchant;
|
||||
import com.gxwebsoft.shop.entity.MerchantAccount;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 网站信息记录表
|
||||
@@ -159,7 +152,7 @@ public class Website implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "幻灯片广告")
|
||||
@TableField(exist = false)
|
||||
private List<String> slide;
|
||||
private Ad slide;
|
||||
|
||||
@ApiModelProperty(value = "站点广告")
|
||||
@TableField(exist = false)
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.cms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.cms.entity.MpPages;
|
||||
import com.gxwebsoft.cms.param.MpPagesParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 小程序页面Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-07-20 19:49:55
|
||||
*/
|
||||
public interface MpPagesMapper extends BaseMapper<MpPages> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<MpPages>
|
||||
*/
|
||||
List<MpPages> selectPageRel(@Param("page") IPage<MpPages> page,
|
||||
@Param("param") MpPagesParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<MpPages> selectListRel(@Param("param") MpPagesParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?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.gxwebsoft.cms.mapper.MpPagesMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
FROM cms_mp_pages a
|
||||
<where>
|
||||
<if test="param.id != null">
|
||||
AND a.id = #{param.id}
|
||||
</if>
|
||||
<if test="param.parentId != null">
|
||||
AND a.parent_id = #{param.parentId}
|
||||
</if>
|
||||
<if test="param.title != null">
|
||||
AND a.title LIKE CONCAT('%', #{param.title}, '%')
|
||||
</if>
|
||||
<if test="param.path != null">
|
||||
AND a.path LIKE CONCAT('%', #{param.path}, '%')
|
||||
</if>
|
||||
<if test="param.home != null">
|
||||
AND a.home = #{param.home}
|
||||
</if>
|
||||
<if test="param.subpackage != null">
|
||||
AND a.subpackage LIKE CONCAT('%', #{param.subpackage}, '%')
|
||||
</if>
|
||||
<if test="param.sortNumber != null">
|
||||
AND a.sort_number = #{param.sortNumber}
|
||||
</if>
|
||||
<if test="param.comments != null">
|
||||
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.status != null">
|
||||
AND a.status = #{param.status}
|
||||
</if>
|
||||
<if test="param.deleted != null">
|
||||
AND a.deleted = #{param.deleted}
|
||||
</if>
|
||||
<if test="param.deleted == null">
|
||||
AND a.deleted = 0
|
||||
</if>
|
||||
<if test="param.createTimeStart != null">
|
||||
AND a.create_time >= #{param.createTimeStart}
|
||||
</if>
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
<if test="param.keywords != null">
|
||||
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.cms.entity.MpPages">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.cms.entity.MpPages">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.gxwebsoft.cms.param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||
import com.gxwebsoft.common.core.web.BaseParam;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 小程序页面查询参数
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-07-20 19:49:55
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(value = "MpPagesParam对象", description = "小程序页面查询参数")
|
||||
public class MpPagesParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "上级id, 0是顶级")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer parentId;
|
||||
|
||||
@ApiModelProperty(value = "页面名称")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "页面路径")
|
||||
private String path;
|
||||
|
||||
@ApiModelProperty(value = "设为首页")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer home;
|
||||
|
||||
@ApiModelProperty(value = "分包")
|
||||
private String subpackage;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer deleted;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.gxwebsoft.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.cms.entity.MpPages;
|
||||
import com.gxwebsoft.cms.param.MpPagesParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 小程序页面Service
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-07-20 19:49:55
|
||||
*/
|
||||
public interface MpPagesService extends IService<MpPages> {
|
||||
|
||||
/**
|
||||
* 分页关联查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return PageResult<MpPages>
|
||||
*/
|
||||
PageResult<MpPages> pageRel(MpPagesParam param);
|
||||
|
||||
/**
|
||||
* 关联查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<MpPages>
|
||||
*/
|
||||
List<MpPages> listRel(MpPagesParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param id ID
|
||||
* @return MpPages
|
||||
*/
|
||||
MpPages getByIdRel(Integer id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.gxwebsoft.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.cms.mapper.MpPagesMapper;
|
||||
import com.gxwebsoft.cms.service.MpPagesService;
|
||||
import com.gxwebsoft.cms.entity.MpPages;
|
||||
import com.gxwebsoft.cms.param.MpPagesParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 小程序页面Service实现
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-07-20 19:49:55
|
||||
*/
|
||||
@Service
|
||||
public class MpPagesServiceImpl extends ServiceImpl<MpPagesMapper, MpPages> implements MpPagesService {
|
||||
|
||||
@Override
|
||||
public PageResult<MpPages> pageRel(MpPagesParam param) {
|
||||
PageParam<MpPages, MpPagesParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, create_time asc");
|
||||
List<MpPages> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MpPages> listRel(MpPagesParam param) {
|
||||
List<MpPages> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<MpPages, MpPagesParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("sort_number asc, create_time asc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MpPages getByIdRel(Integer id) {
|
||||
MpPagesParam param = new MpPagesParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user