pc前端
This commit is contained in:
parent
f5b7e2d081
commit
922c822746
@ -0,0 +1,29 @@
|
||||
package com.zbkj.pc.controlller;
|
||||
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.pc.entity.PcHomeBannerVo;
|
||||
import com.zbkj.pc.service.PcService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController("BannerController")
|
||||
@RequestMapping("api/pc/bannner")
|
||||
@Api(tags = "轮播图pc管理")
|
||||
public class BannerController {
|
||||
@Autowired
|
||||
PcService pcService;
|
||||
@ApiOperation(value = "获取首页banner")
|
||||
@RequestMapping(value = "/get/banner", method = RequestMethod.GET)
|
||||
public CommonResult<List<PcHomeBannerVo>> getHomeBanner() {
|
||||
return CommonResult.success(pcService.getHomeBanner());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.zbkj.pc.controlller;
|
||||
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.pc.entity.PcHomeBannerVo;
|
||||
import com.zbkj.pc.service.PcService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController("PcController")
|
||||
@RequestMapping("api/pc")
|
||||
@Api(tags = "商品")
|
||||
public class PcController {
|
||||
@Autowired
|
||||
PcService pcService;
|
||||
@ApiOperation(value = "获取首页banner")
|
||||
@RequestMapping(value = "/get/banner", method = RequestMethod.GET)
|
||||
public CommonResult<List<PcHomeBannerVo>> getHomeBanner() {
|
||||
return CommonResult.success(pcService.getHomeBanner());
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.zbkj.pc.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zbkj.pc.entity.GroupConfig;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
/**
|
||||
* 组合配置表 Mapper 接口
|
||||
*/
|
||||
@Mapper
|
||||
public interface GroupConfigDao extends BaseMapper<GroupConfig> {
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package com.zbkj.pc.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 组合配置表
|
||||
* </p>
|
||||
*
|
||||
* @author HZW
|
||||
* @since 2023-09-25
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("eb_group_config")
|
||||
@ApiModel(value = "GroupConfig对象", description = "组合配置表")
|
||||
public class GroupConfig implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "标签:1-首页banner,2-首页推荐,3-经营理念,4-友情链接, 5-快捷入口,6-商户PC店铺Banner,7-商户PC店铺商品推荐,8-首页底部二维码,9-首页广告,10-首页导航,11-付费会员权益,12-积分区间,13-开屏广告")
|
||||
private Integer tag;
|
||||
|
||||
@ApiModelProperty(value = "商户id,0-平台")
|
||||
private Integer merId;
|
||||
|
||||
@ApiModelProperty(value = "名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "链接地址")
|
||||
private String linkUrl;
|
||||
|
||||
@ApiModelProperty(value = "图片地址")
|
||||
private String imageUrl;
|
||||
|
||||
@ApiModelProperty(value = "值")
|
||||
private String value;
|
||||
|
||||
@ApiModelProperty(value = "描述")
|
||||
private String message;
|
||||
|
||||
@ApiModelProperty(value = "状态:是否显示")
|
||||
private Boolean status;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty(value = "是否删除")
|
||||
private Boolean isDel;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "拓展字段")
|
||||
private String expand;
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.zbkj.pc.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* PC首页bannerVo对象
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "PcHomeBannerVo", description = "PC首页bannerVo对象")
|
||||
public class PcHomeBannerVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -3097800453211866415L;
|
||||
|
||||
@ApiModelProperty(value = "bannerID")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "图片地址", required = true)
|
||||
@NotBlank(message = "请选择图片")
|
||||
private String imageUrl;
|
||||
|
||||
@ApiModelProperty(value = "banner标题", required = true)
|
||||
@NotBlank(message = "请填写标题")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "banner链接")
|
||||
private String linkUrl;
|
||||
|
||||
@ApiModelProperty(value = "显示状态", required = true)
|
||||
@NotNull(message = "请选择显示状态")
|
||||
private Boolean status;
|
||||
|
||||
@ApiModelProperty(value = "排序", required = true)
|
||||
@NotNull(message = "排序不能为空")
|
||||
private Integer sort;
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package com.zbkj.pc.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.json.JSON;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.google.gson.Gson;
|
||||
import com.zbkj.common.model.system.SystemFormTemp;
|
||||
import com.zbkj.common.model.system.SystemGroupData;
|
||||
import com.zbkj.pc.dao.GroupConfigDao;
|
||||
import com.zbkj.pc.entity.GroupConfig;
|
||||
import com.zbkj.pc.entity.PcHomeBannerVo;
|
||||
import com.zbkj.service.service.SystemGroupDataService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@Service
|
||||
public class PcService {
|
||||
@Autowired
|
||||
SystemGroupDataService systemGroupDataService;
|
||||
@Autowired
|
||||
private GroupConfigDao groupConfigDao;
|
||||
public List<PcHomeBannerVo> getHomeBanner() {
|
||||
LambdaQueryWrapper<SystemGroupData> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemGroupData::getStatus,"1");
|
||||
wrapper.eq(SystemGroupData::getGid,"74");
|
||||
wrapper.orderByAsc(SystemGroupData::getSort);
|
||||
List<SystemGroupData> list = systemGroupDataService.list(wrapper);
|
||||
|
||||
// LambdaQueryWrapper<GroupConfig> lqw = Wrappers.lambdaQuery();
|
||||
// lqw.eq(GroupConfig::getTag, 1);
|
||||
// lqw.eq(GroupConfig::getIsDel, 0);
|
||||
// lqw.eq(GroupConfig::getStatus, 0);
|
||||
//// if (StrUtil.isBlank(sortRule) || sortRule.equals(Constants.SORT_ASC)) {
|
||||
// lqw.orderByAsc(GroupConfig::getSort);
|
||||
//// }
|
||||
//// else {
|
||||
//// lqw.orderByDesc(GroupConfig::getSort);
|
||||
//// }
|
||||
// List<GroupConfig> configList = groupConfigDao.selectList(lqw);
|
||||
// lqw.orderByDesc(GroupConfig::getId);
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
Iterator<SystemGroupData> iterator = list.iterator();
|
||||
List<PcHomeBannerVo> voList = new ArrayList<>();
|
||||
while (iterator.hasNext()) {
|
||||
SystemGroupData config = iterator.next();
|
||||
String value = config.getValue();
|
||||
JSONObject jsonObject = new JSONObject(value);
|
||||
PcHomeBannerVo vo = new PcHomeBannerVo();
|
||||
vo.setId(config.getId());
|
||||
JSONArray array= (JSONArray) jsonObject.get("fields");
|
||||
jsonObject= (JSONObject) array.get(0);
|
||||
// vo.setImageUrl(jsonObject.get(""));
|
||||
// vo.setName(config.getName());
|
||||
// vo.setLinkUrl(config.getLinkUrl());
|
||||
vo.setSort(config.getSort());
|
||||
vo.setImageUrl(jsonObject.get("value").toString());
|
||||
voList.add(vo);
|
||||
}
|
||||
return voList;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String s = new String("{\"fields\":[{\"name\":\"pic\",\"title\":\"pic\",\"value\":\"crmebimage/public/maintain/2021/12/25/88cea6884f5e4ae48b8e407266fc03dbnqk5y6cdcv.jpg\"}],\"id\":75,\"sort\":1,\"status\":true}");
|
||||
JSONObject jsonObject = new JSONObject(s);
|
||||
// JSONObject jsonObject1 = new JSONObject(jsonObject.get("fields").toString());
|
||||
JSONArray array= (JSONArray) jsonObject.get("fields");
|
||||
JSONObject js= (JSONObject) array.get(0);
|
||||
System.out.println(js.get("value"));
|
||||
}
|
||||
}
|
BIN
~$MEB 开源商城系统(Java版)安装必读.docx
Normal file
BIN
~$MEB 开源商城系统(Java版)安装必读.docx
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user