新增MpAd模块

This commit is contained in:
2024-07-23 22:27:39 +08:00
parent e36606b585
commit b141d95161
9 changed files with 92 additions and 11 deletions
@@ -76,6 +76,7 @@ public class MpController extends BaseController {
// 获取小程序信息
final Mp mp = mpService.getOne(new LambdaQueryWrapper<Mp>().eq(Mp::getTenantId, tenantId).last("limit 1"));
mp.setAppSecret(null);
map.put("mp", mp);
// 原生导航条
@@ -203,6 +204,20 @@ public class MpController extends BaseController {
mpFieldService.save(field);
}
@PreAuthorize("hasAuthority('cms:mp:remove')")
@ApiOperation("清除缓存")
@DeleteMapping("/clearSiteInfo/{key}")
public ApiResult<?> clearSiteInfo(@PathVariable("key") String key) {
final String siteInfo = redisUtil.get(key);
if(StrUtil.isNotBlank(siteInfo)){
redisUtil.delete(key);
// 选择支付方式
redisUtil.delete("SelectPayment:".concat(getTenantId().toString()));
return success("清除成功");
}
return success("清除失败");
}
@ApiOperation("分页查询小程序信息")
@GetMapping("/page")
public ApiResult<PageResult<Mp>> page(MpParam param) {
@@ -427,7 +427,10 @@ public class WebsiteController extends BaseController {
public ApiResult<?> clearSiteInfo(@PathVariable("key") String key) {
final String siteInfo = redisUtil.get(key);
if(StrUtil.isNotBlank(siteInfo)){
// 清除指定key
redisUtil.delete(key);
// 清除小程序缓存
redisUtil.delete("MpInfo:".concat(getTenantId().toString()));
// 选择支付方式
redisUtil.delete("SelectPayment:".concat(getTenantId().toString()));
return success("清除成功");
@@ -1,11 +1,11 @@
package com.gxwebsoft.cms.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.*;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableLogic;
import java.io.Serializable;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -40,6 +40,13 @@ public class MpField implements Serializable {
@ApiModelProperty(value = "名称")
private String value;
@ApiModelProperty(value = "页面ID")
private Integer pageId;
@ApiModelProperty(value = "页面名称")
@TableField(exist = false)
private String pageName;
@ApiModelProperty(value = "排序(数字越小越靠前)")
private Integer sortNumber;
@@ -50,7 +57,7 @@ public class MpField implements Serializable {
@ApiModelProperty(value = "租户id")
private Integer tenantId;
@ApiModelProperty(value = "注册时间")
private LocalDateTime createTime;
@ApiModelProperty(value = "创建时间")
private Date createTime;
}
@@ -61,6 +61,9 @@ public class MpMenu implements Serializable {
@ApiModelProperty(value = "图标颜色")
private String color;
@ApiModelProperty(value = "上传图标")
private String avatar;
@ApiModelProperty(value = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)")
private Integer hide;
@@ -48,6 +48,12 @@ public class MpPages implements Serializable {
@ApiModelProperty(value = "图标")
private String icon;
@ApiModelProperty(value = "未选中")
private String iconPath;
@ApiModelProperty(value = "已选中")
private String selectedIconPath;
@ApiModelProperty(value = "排序(数字越小越靠前)")
private Integer sortNumber;
@@ -4,8 +4,9 @@
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
SELECT a.*,b.title as pageName
FROM cms_mp_field a
LEFT JOIN cms_mp_pages b ON a.page_id = b.id
<where>
<if test="param.id != null">
AND a.id = #{param.id}
@@ -39,6 +40,8 @@
</if>
<if test="param.keywords != null">
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
OR a.name LIKE CONCAT('%', #{param.keywords}, '%'
OR a.value LIKE CONCAT('%', #{param.keywords}, '%'
)
</if>
</where>
@@ -301,4 +301,18 @@ public class AppController extends BaseController {
return success("应用信息",appInfo);
}
@ApiOperation("查询我的项目信息")
@GetMapping("/getMyApp")
public ApiResult<App> getMyApp() {
final User loginUser = getLoginUser();
// 未登录情况
if(loginUser == null){
return fail("请先登录",null);
}
appService.list();
// 使用关联查询
return success("查询成功",null);
}
}
@@ -1,19 +1,27 @@
package com.gxwebsoft.shop.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.User;
import com.gxwebsoft.shop.entity.Goods;
import com.gxwebsoft.shop.entity.GoodsCategory;
import com.gxwebsoft.shop.param.GoodsCategoryParam;
import com.gxwebsoft.shop.service.GoodsCategoryService;
import com.gxwebsoft.shop.service.GoodsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import static com.gxwebsoft.common.core.utils.CommonUtil.toTreeData;
/**
* 商品分类控制器
@@ -27,7 +35,22 @@ import java.util.List;
public class GoodsCategoryController extends BaseController {
@Resource
private GoodsCategoryService goodsCategoryService;
@Resource
private GoodsService goodsService;
@ApiOperation("查询全部商品分类(树型结构)")
@GetMapping("/getTree")
public ApiResult<List<GoodsCategory>> getTree(GoodsCategoryParam param) {
final List<GoodsCategory> list = goodsCategoryService.listRel(param);
final Set<Integer> categoryIds = list.stream().map(GoodsCategory::getCategoryId).collect(Collectors.toSet());
final List<Goods> goods = goodsService.list(new LambdaQueryWrapper<Goods>().in(Goods::getCategoryId, categoryIds).eq(Goods::getStatus,0).eq(Goods::getDeleted,0));
final Map<Integer, List<Goods>> collectGoods = goods.stream().collect(Collectors.groupingBy(Goods::getCategoryId));
list.forEach(d -> {
d.setName(d.getTitle());
d.setChildrens(collectGoods.get(d.getCategoryId()));
});
return success(list);
}
@ApiOperation("分页查询商品分类")
@GetMapping("/page")
public ApiResult<PageResult<GoodsCategory>> page(GoodsCategoryParam param) {
@@ -1,12 +1,11 @@
package com.gxwebsoft.shop.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.*;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableLogic;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -36,6 +35,10 @@ public class GoodsCategory implements Serializable {
@ApiModelProperty(value = "分类名称")
private String title;
@ApiModelProperty(value = "分类别名")
@TableField(exist = false)
private String name;
@ApiModelProperty(value = "类型 0列表 1单页 2外链")
private Integer type;
@@ -91,4 +94,8 @@ public class GoodsCategory implements Serializable {
@ApiModelProperty(value = "修改时间")
private Date updateTime;
@ApiModelProperty("商品列表")
@TableField(exist = false)
private List<Goods> childrens;
}