新增小程序cms_mp表及模块
This commit is contained in:
@@ -0,0 +1,121 @@
|
|||||||
|
package com.gxwebsoft.cms.controller;
|
||||||
|
|
||||||
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.cms.service.MpService;
|
||||||
|
import com.gxwebsoft.cms.entity.Mp;
|
||||||
|
import com.gxwebsoft.cms.param.MpParam;
|
||||||
|
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-21 22:18:08
|
||||||
|
*/
|
||||||
|
@Api(tags = "小程序信息管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/cms/mp")
|
||||||
|
public class MpController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private MpService mpService;
|
||||||
|
|
||||||
|
@ApiOperation("分页查询小程序信息")
|
||||||
|
@GetMapping("/page")
|
||||||
|
public ApiResult<PageResult<Mp>> page(MpParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(mpService.pageRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询全部小程序信息")
|
||||||
|
@GetMapping()
|
||||||
|
public ApiResult<List<Mp>> list(MpParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(mpService.listRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('cms:mp:list')")
|
||||||
|
@ApiOperation("根据id查询小程序信息")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ApiResult<Mp> get(@PathVariable("id") Integer id) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(mpService.getByIdRel(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('cms:mp:save')")
|
||||||
|
@ApiOperation("添加小程序信息")
|
||||||
|
@PostMapping()
|
||||||
|
public ApiResult<?> save(@RequestBody Mp mp) {
|
||||||
|
// 记录当前登录用户id
|
||||||
|
User loginUser = getLoginUser();
|
||||||
|
if (loginUser != null) {
|
||||||
|
mp.setUserId(loginUser.getUserId());
|
||||||
|
}
|
||||||
|
if (mpService.save(mp)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('cms:mp:update')")
|
||||||
|
@ApiOperation("修改小程序信息")
|
||||||
|
@PutMapping()
|
||||||
|
public ApiResult<?> update(@RequestBody Mp mp) {
|
||||||
|
if (mpService.updateById(mp)) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('cms:mp:remove')")
|
||||||
|
@ApiOperation("删除小程序信息")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||||
|
if (mpService.removeById(id)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('cms:mp:save')")
|
||||||
|
@ApiOperation("批量添加小程序信息")
|
||||||
|
@PostMapping("/batch")
|
||||||
|
public ApiResult<?> saveBatch(@RequestBody List<Mp> list) {
|
||||||
|
if (mpService.saveBatch(list)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('cms:mp:update')")
|
||||||
|
@ApiOperation("批量修改小程序信息")
|
||||||
|
@PutMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<Mp> batchParam) {
|
||||||
|
if (batchParam.update(mpService, "mp_id")) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('cms:mp:remove')")
|
||||||
|
@ApiOperation("批量删除小程序信息")
|
||||||
|
@DeleteMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||||
|
if (mpService.removeByIds(ids)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -11,6 +11,7 @@ import com.gxwebsoft.cms.param.MpMenuParam;
|
|||||||
import com.gxwebsoft.cms.param.NavigationParam;
|
import com.gxwebsoft.cms.param.NavigationParam;
|
||||||
import com.gxwebsoft.cms.param.WebsiteParam;
|
import com.gxwebsoft.cms.param.WebsiteParam;
|
||||||
import com.gxwebsoft.cms.service.*;
|
import com.gxwebsoft.cms.service.*;
|
||||||
|
import com.gxwebsoft.common.core.exception.BusinessException;
|
||||||
import com.gxwebsoft.common.core.security.JwtUtil;
|
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
@@ -72,6 +73,8 @@ public class WebsiteController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private RedisUtil redisUtil;
|
private RedisUtil redisUtil;
|
||||||
@Resource
|
@Resource
|
||||||
|
private MpPagesService mpPagesService;
|
||||||
|
@Resource
|
||||||
private MpMenuService mpMenuService;
|
private MpMenuService mpMenuService;
|
||||||
@Resource
|
@Resource
|
||||||
private OrderService orderService;
|
private OrderService orderService;
|
||||||
@@ -82,7 +85,7 @@ public class WebsiteController extends BaseController {
|
|||||||
|
|
||||||
@ApiOperation("获取网站信息")
|
@ApiOperation("获取网站信息")
|
||||||
@GetMapping("/getSiteInfo")
|
@GetMapping("/getSiteInfo")
|
||||||
public ApiResult<Website> getSiteInfo(HttpServletRequest request) {
|
public ApiResult<?> getSiteInfo(HttpServletRequest request) {
|
||||||
final Integer tenantId = getTenantId();
|
final Integer tenantId = getTenantId();
|
||||||
String key = "SiteInfo:" + tenantId;
|
String key = "SiteInfo:" + tenantId;
|
||||||
final String siteInfo = redisUtil.get(key);
|
final String siteInfo = redisUtil.get(key);
|
||||||
@@ -99,6 +102,102 @@ public class WebsiteController extends BaseController {
|
|||||||
// 获取站点信息
|
// 获取站点信息
|
||||||
final WebsiteParam websiteParam = new WebsiteParam();
|
final WebsiteParam websiteParam = new WebsiteParam();
|
||||||
if (websiteService.count() == 0) {
|
if (websiteService.count() == 0) {
|
||||||
|
// 创建网站
|
||||||
|
createWebsite(access_token);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
|
||||||
|
// 获取站点信息
|
||||||
|
final List<Website> websites = websiteService.listRel(websiteParam);
|
||||||
|
final Website website = websites.get(0);
|
||||||
|
map.put("website",website);
|
||||||
|
|
||||||
|
// 原生导航条
|
||||||
|
final List<MpPages> tabBar = mpPagesService.list(new LambdaQueryWrapper<MpPages>().eq(MpPages::getSubpackage, "MainPackage").last("limit 5"));
|
||||||
|
map.put("tabBar",tabBar);
|
||||||
|
// tabBar.stream().map(MpPages::getHome).collect()
|
||||||
|
|
||||||
|
// 小程序端导航图标
|
||||||
|
final MpMenuParam mpMenuParam = new MpMenuParam();
|
||||||
|
final List<MpMenu> mpMenus = mpMenuService.listRel(mpMenuParam);
|
||||||
|
final Map<String, List<MpMenu>> mpMenuMap = mpMenus.stream().collect(Collectors.groupingBy(MpMenu::getGroupName));
|
||||||
|
website.setMpMenus(mpMenuMap);
|
||||||
|
|
||||||
|
// 附加自定义导航
|
||||||
|
final NavigationParam navigationParam = new NavigationParam();
|
||||||
|
navigationParam.setHide(0);
|
||||||
|
final List<Navigation> navigations = navigationService.listRel(navigationParam);
|
||||||
|
final Map<Integer, List<Navigation>> collect = navigations.stream().collect(Collectors.groupingBy(Navigation::getPosition));
|
||||||
|
website.setNavigations(navigations);
|
||||||
|
// 封装网站顶部菜单
|
||||||
|
if(!CollectionUtils.isEmpty(collect.get(1))){
|
||||||
|
final List<Navigation> topNavs = toTreeData(collect.get(1), 0, Navigation::getParentId, Navigation::getNavigationId, Navigation::setChildren);
|
||||||
|
website.setTopNavs(topNavs);
|
||||||
|
}
|
||||||
|
// 封装网站底部菜单
|
||||||
|
if (!CollectionUtils.isEmpty(collect.get(2))) {
|
||||||
|
final List<Navigation> bottomNavs = toTreeData(collect.get(2), 0, Navigation::getParentId, Navigation::getNavigationId, Navigation::setChildren);
|
||||||
|
website.setBottomNavs(bottomNavs);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 读取幻灯片广告
|
||||||
|
final List<Ad> list = adService.list(new LambdaQueryWrapper<Ad>().eq(Ad::getAdType,"幻灯片"));
|
||||||
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
|
final Ad ad = list.get(0);
|
||||||
|
website.setSlide(ad);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 首页布局
|
||||||
|
final Design design = designService.getOne(new LambdaQueryWrapper<Design>().eq(Design::getHome, 1).last("limit 1"));
|
||||||
|
if (design != null) {
|
||||||
|
website.setLayout(design.getLayout());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 读取友情链接
|
||||||
|
final LinkParam linkParam = new LinkParam();
|
||||||
|
linkParam.setLinkType("友情链接");
|
||||||
|
website.setLinks(linkService.listRel(linkParam));
|
||||||
|
|
||||||
|
// 配置信息
|
||||||
|
HashMap<String, Object> config = new HashMap<>();
|
||||||
|
config.put("LICENSE_CODE", "");
|
||||||
|
config.put("MAP_KEY", "");
|
||||||
|
final List<WebsiteField> fields = websiteFieldService.list();
|
||||||
|
fields.forEach(d -> {
|
||||||
|
config.put(d.getName(),d.getValue());
|
||||||
|
});
|
||||||
|
map.put("config",config);
|
||||||
|
// website.setConfig(config);
|
||||||
|
|
||||||
|
// 服务器时间
|
||||||
|
HashMap<String, Object> serverTime = new HashMap<>();
|
||||||
|
// 今天日期
|
||||||
|
DateTime date = DateUtil.date();
|
||||||
|
String today= DateUtil.today();
|
||||||
|
// 明天日期
|
||||||
|
final DateTime dateTime = DateUtil.tomorrow();
|
||||||
|
String tomorrow = DateUtil.format(dateTime, "yyyy-MM-dd");
|
||||||
|
// 后天日期
|
||||||
|
final DateTime dateTime2 = DateUtil.offsetDay(date, 2);
|
||||||
|
final String afterDay = DateUtil.format(dateTime2, "yyyy-MM-dd");
|
||||||
|
// 今天星期几
|
||||||
|
final int week = DateUtil.thisDayOfWeek();
|
||||||
|
final DateTime nextWeek = DateUtil.nextWeek();
|
||||||
|
serverTime.put("now",DateUtil.now()); // 2024-07-18 22:06:36
|
||||||
|
serverTime.put("today",today); // 2024-07-18
|
||||||
|
serverTime.put("tomorrow",tomorrow); // 2024-07-19
|
||||||
|
serverTime.put("afterDay",afterDay); // 2024-07-20
|
||||||
|
serverTime.put("nextWeek",nextWeek); // 2024-07-25 22:06:36
|
||||||
|
serverTime.put("week",week); // 5
|
||||||
|
website.setServerTime(serverTime);
|
||||||
|
redisUtil.set(key,website,1L, TimeUnit.DAYS);
|
||||||
|
return success(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createWebsite(String access_token) {
|
||||||
|
final Integer tenantId = getTenantId();
|
||||||
// 请求主服务器获取租户信息
|
// 请求主服务器获取租户信息
|
||||||
String result = HttpRequest.get("https://server.gxwebsoft.com/api/auth/tenant")
|
String result = HttpRequest.get("https://server.gxwebsoft.com/api/auth/tenant")
|
||||||
.header("Authorization", access_token)
|
.header("Authorization", access_token)
|
||||||
@@ -110,7 +209,7 @@ public class WebsiteController extends BaseController {
|
|||||||
final String data = jsonObject.getString("data");
|
final String data = jsonObject.getString("data");
|
||||||
final Company company = JSONObject.parseObject(data, Company.class);
|
final Company company = JSONObject.parseObject(data, Company.class);
|
||||||
if(company == null){
|
if(company == null){
|
||||||
return success("站点不存在",null);
|
throw new BusinessException("站点不存在");
|
||||||
}
|
}
|
||||||
// 创建网站记录
|
// 创建网站记录
|
||||||
final Website website = new Website();
|
final Website website = new Website();
|
||||||
@@ -277,87 +376,6 @@ public class WebsiteController extends BaseController {
|
|||||||
websiteFieldService.save(field);
|
websiteFieldService.save(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取站点信息
|
|
||||||
final List<Website> websites = websiteService.listRel(websiteParam);
|
|
||||||
final Website website = websites.get(0);
|
|
||||||
|
|
||||||
// 附加自定义字段
|
|
||||||
// website.setFields(fields);
|
|
||||||
|
|
||||||
// 小程序端导航图标
|
|
||||||
final MpMenuParam mpMenuParam = new MpMenuParam();
|
|
||||||
website.setMpMenus(mpMenuService.listRel(mpMenuParam));
|
|
||||||
|
|
||||||
// 附加自定义导航
|
|
||||||
final NavigationParam navigationParam = new NavigationParam();
|
|
||||||
navigationParam.setHide(0);
|
|
||||||
final List<Navigation> navigations = navigationService.listRel(navigationParam);
|
|
||||||
final Map<Integer, List<Navigation>> collect = navigations.stream().collect(Collectors.groupingBy(Navigation::getPosition));
|
|
||||||
website.setNavigations(navigations);
|
|
||||||
// 封装网站顶部菜单
|
|
||||||
if(!CollectionUtils.isEmpty(collect.get(1))){
|
|
||||||
final List<Navigation> topNavs = toTreeData(collect.get(1), 0, Navigation::getParentId, Navigation::getNavigationId, Navigation::setChildren);
|
|
||||||
website.setTopNavs(topNavs);
|
|
||||||
}
|
|
||||||
// 封装网站底部菜单
|
|
||||||
if (!CollectionUtils.isEmpty(collect.get(2))) {
|
|
||||||
final List<Navigation> bottomNavs = toTreeData(collect.get(2), 0, Navigation::getParentId, Navigation::getNavigationId, Navigation::setChildren);
|
|
||||||
website.setBottomNavs(bottomNavs);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 读取幻灯片广告
|
|
||||||
final List<Ad> list = adService.list(new LambdaQueryWrapper<Ad>().eq(Ad::getAdType,"幻灯片"));
|
|
||||||
if (!CollectionUtils.isEmpty(list)) {
|
|
||||||
final Ad ad = list.get(0);
|
|
||||||
website.setSlide(ad);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 首页布局
|
|
||||||
final Design design = designService.getOne(new LambdaQueryWrapper<Design>().eq(Design::getHome, 1).last("limit 1"));
|
|
||||||
if (design != null) {
|
|
||||||
website.setLayout(design.getLayout());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 读取友情链接
|
|
||||||
final LinkParam linkParam = new LinkParam();
|
|
||||||
linkParam.setLinkType("友情链接");
|
|
||||||
website.setLinks(linkService.listRel(linkParam));
|
|
||||||
|
|
||||||
// 配置信息
|
|
||||||
HashMap<String, Object> config = new HashMap<>();
|
|
||||||
config.put("LICENSE_CODE", "");
|
|
||||||
config.put("MAP_KEY", "");
|
|
||||||
final List<WebsiteField> fields = websiteFieldService.list();
|
|
||||||
fields.forEach(d -> {
|
|
||||||
config.put(d.getName(),d.getValue());
|
|
||||||
});
|
|
||||||
website.setConfig(config);
|
|
||||||
|
|
||||||
// 服务器时间
|
|
||||||
HashMap<String, Object> serverTime = new HashMap<>();
|
|
||||||
// 今天日期
|
|
||||||
DateTime date = DateUtil.date();
|
|
||||||
String today= DateUtil.today();
|
|
||||||
// 明天日期
|
|
||||||
final DateTime dateTime = DateUtil.tomorrow();
|
|
||||||
String tomorrow = DateUtil.format(dateTime, "yyyy-MM-dd");
|
|
||||||
// 后天日期
|
|
||||||
final DateTime dateTime2 = DateUtil.offsetDay(date, 2);
|
|
||||||
final String afterDay = DateUtil.format(dateTime2, "yyyy-MM-dd");
|
|
||||||
// 今天星期几
|
|
||||||
final int week = DateUtil.thisDayOfWeek();
|
|
||||||
final DateTime nextWeek = DateUtil.nextWeek();
|
|
||||||
serverTime.put("now",DateUtil.now()); // 2024-07-18 22:06:36
|
|
||||||
serverTime.put("today",today); // 2024-07-18
|
|
||||||
serverTime.put("tomorrow",tomorrow); // 2024-07-19
|
|
||||||
serverTime.put("afterDay",afterDay); // 2024-07-20
|
|
||||||
serverTime.put("nextWeek",nextWeek); // 2024-07-25 22:06:36
|
|
||||||
serverTime.put("week",week); // 5
|
|
||||||
website.setServerTime(serverTime);
|
|
||||||
redisUtil.set(key,website,1L, TimeUnit.DAYS);
|
|
||||||
return success(website);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("获取服务器时间")
|
@ApiOperation("获取服务器时间")
|
||||||
@GetMapping("/getServerTime")
|
@GetMapping("/getServerTime")
|
||||||
public ApiResult<?> getServerTime(){
|
public ApiResult<?> getServerTime(){
|
||||||
|
|||||||
@@ -0,0 +1,89 @@
|
|||||||
|
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-21 22:18:08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value = "Mp对象", description = "小程序信息")
|
||||||
|
@TableName("cms_mp")
|
||||||
|
public class Mp implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "ID")
|
||||||
|
@TableId(value = "mp_id", type = IdType.AUTO)
|
||||||
|
private Integer mpId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "小程序ID")
|
||||||
|
private String appId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "小程序名称")
|
||||||
|
private String mpName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "小程序简称")
|
||||||
|
private String shortName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "头像")
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "小程序码")
|
||||||
|
private String mpQrcode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "微信认证")
|
||||||
|
private Integer authentication;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "主体信息")
|
||||||
|
private String companyName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "小程序备案")
|
||||||
|
private String icpNo;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "登录邮箱")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "登录密码")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "原始ID")
|
||||||
|
private String ghId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "入口页面")
|
||||||
|
private String mainPath;
|
||||||
|
|
||||||
|
@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;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
@@ -120,4 +121,9 @@ public class MpMenu implements Serializable {
|
|||||||
@ApiModelProperty(value = "分组名称")
|
@ApiModelProperty(value = "分组名称")
|
||||||
private String groupName;
|
private String groupName;
|
||||||
|
|
||||||
|
@ApiModelProperty("子菜单")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<MpMenu> children;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import java.io.Serializable;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 网站信息记录表
|
* 网站信息记录表
|
||||||
@@ -135,7 +136,7 @@ public class Website implements Serializable {
|
|||||||
|
|
||||||
@ApiModelProperty(value = "小程序导航图标")
|
@ApiModelProperty(value = "小程序导航图标")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<MpMenu> mpMenus;
|
private Map<String, List<MpMenu>> mpMenus;
|
||||||
|
|
||||||
@ApiModelProperty(value = "网站导航栏")
|
@ApiModelProperty(value = "网站导航栏")
|
||||||
@TableField(exist = false)
|
@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.Mp;
|
||||||
|
import com.gxwebsoft.cms.param.MpParam;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序信息Mapper
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-07-21 22:18:08
|
||||||
|
*/
|
||||||
|
public interface MpMapper extends BaseMapper<Mp> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*
|
||||||
|
* @param page 分页对象
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<Mp>
|
||||||
|
*/
|
||||||
|
List<Mp> selectPageRel(@Param("page") IPage<Mp> page,
|
||||||
|
@Param("param") MpParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<User>
|
||||||
|
*/
|
||||||
|
List<Mp> selectListRel(@Param("param") MpParam param);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
<?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.MpMapper">
|
||||||
|
|
||||||
|
<!-- 关联查询sql -->
|
||||||
|
<sql id="selectSql">
|
||||||
|
SELECT a.*
|
||||||
|
FROM cms_mp a
|
||||||
|
<where>
|
||||||
|
<if test="param.mpId != null">
|
||||||
|
AND a.mp_id = #{param.mpId}
|
||||||
|
</if>
|
||||||
|
<if test="param.appId != null">
|
||||||
|
AND a.app_id LIKE CONCAT('%', #{param.appId}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.mpName != null">
|
||||||
|
AND a.mp_name LIKE CONCAT('%', #{param.mpName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.shortName != null">
|
||||||
|
AND a.short_name LIKE CONCAT('%', #{param.shortName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.avatar != null">
|
||||||
|
AND a.avatar LIKE CONCAT('%', #{param.avatar}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.mpQrcode != null">
|
||||||
|
AND a.mp_qrcode LIKE CONCAT('%', #{param.mpQrcode}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.authentication != null">
|
||||||
|
AND a.authentication = #{param.authentication}
|
||||||
|
</if>
|
||||||
|
<if test="param.companyName != null">
|
||||||
|
AND a.company_name LIKE CONCAT('%', #{param.companyName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.icpNo != null">
|
||||||
|
AND a.icp_no LIKE CONCAT('%', #{param.icpNo}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.email != null">
|
||||||
|
AND a.email LIKE CONCAT('%', #{param.email}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.password != null">
|
||||||
|
AND a.password LIKE CONCAT('%', #{param.password}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.ghId != null">
|
||||||
|
AND a.gh_id LIKE CONCAT('%', #{param.ghId}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.mainPath != null">
|
||||||
|
AND a.main_path LIKE CONCAT('%', #{param.mainPath}, '%')
|
||||||
|
</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.Mp">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 查询全部 -->
|
||||||
|
<select id="selectListRel" resultType="com.gxwebsoft.cms.entity.Mp">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
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-21 22:18:08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@ApiModel(value = "MpParam对象", description = "小程序信息查询参数")
|
||||||
|
public class MpParam extends BaseParam {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "ID")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer mpId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "小程序ID")
|
||||||
|
private String appId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "小程序名称")
|
||||||
|
private String mpName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "小程序简称")
|
||||||
|
private String shortName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "头像")
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "小程序码")
|
||||||
|
private String mpQrcode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "微信认证")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer authentication;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "主体信息")
|
||||||
|
private String companyName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "小程序备案")
|
||||||
|
private String icpNo;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "登录邮箱")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "登录密码")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "原始ID")
|
||||||
|
private String ghId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "入口页面")
|
||||||
|
private String mainPath;
|
||||||
|
|
||||||
|
@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.Mp;
|
||||||
|
import com.gxwebsoft.cms.param.MpParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序信息Service
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-07-21 22:18:08
|
||||||
|
*/
|
||||||
|
public interface MpService extends IService<Mp> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页关联查询
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return PageResult<Mp>
|
||||||
|
*/
|
||||||
|
PageResult<Mp> pageRel(MpParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<Mp>
|
||||||
|
*/
|
||||||
|
List<Mp> listRel(MpParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询
|
||||||
|
*
|
||||||
|
* @param mpId ID
|
||||||
|
* @return Mp
|
||||||
|
*/
|
||||||
|
Mp getByIdRel(Integer mpId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.gxwebsoft.cms.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.gxwebsoft.cms.mapper.MpMapper;
|
||||||
|
import com.gxwebsoft.cms.service.MpService;
|
||||||
|
import com.gxwebsoft.cms.entity.Mp;
|
||||||
|
import com.gxwebsoft.cms.param.MpParam;
|
||||||
|
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-21 22:18:08
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class MpServiceImpl extends ServiceImpl<MpMapper, Mp> implements MpService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<Mp> pageRel(MpParam param) {
|
||||||
|
PageParam<Mp, MpParam> page = new PageParam<>(param);
|
||||||
|
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||||
|
List<Mp> list = baseMapper.selectPageRel(page, param);
|
||||||
|
return new PageResult<>(list, page.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Mp> listRel(MpParam param) {
|
||||||
|
List<Mp> list = baseMapper.selectListRel(param);
|
||||||
|
// 排序
|
||||||
|
PageParam<Mp, MpParam> page = new PageParam<>();
|
||||||
|
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||||
|
return page.sortRecords(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mp getByIdRel(Integer mpId) {
|
||||||
|
MpParam param = new MpParam();
|
||||||
|
param.setMpId(mpId);
|
||||||
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -67,7 +67,8 @@ public class CmsGenerator {
|
|||||||
// "cms_form_record",
|
// "cms_form_record",
|
||||||
// "cms_domain",
|
// "cms_domain",
|
||||||
// "cms_mp_menu"
|
// "cms_mp_menu"
|
||||||
"cms_mp_pages"
|
// "cms_mp_pages"
|
||||||
|
"cms_mp"
|
||||||
|
|
||||||
};
|
};
|
||||||
// 需要去除的表前缀
|
// 需要去除的表前缀
|
||||||
|
|||||||
Reference in New Issue
Block a user