Browse Source

app应用和app版本相关model

1021934019@qq.com 3 years ago
parent
commit
1555d27717
16 changed files with 946 additions and 0 deletions
  1. 34 0
      blade-service-api/store-goods-api/src/main/java/com/store/goods/dto/AppDTO.java
  2. 34 0
      blade-service-api/store-goods-api/src/main/java/com/store/goods/dto/AppVersionDTO.java
  3. 122 0
      blade-service-api/store-goods-api/src/main/java/com/store/goods/entity/App.java
  4. 96 0
      blade-service-api/store-goods-api/src/main/java/com/store/goods/entity/AppVersion.java
  5. 36 0
      blade-service-api/store-goods-api/src/main/java/com/store/goods/vo/AppVO.java
  6. 36 0
      blade-service-api/store-goods-api/src/main/java/com/store/goods/vo/AppVersionVO.java
  7. 140 0
      blade-service/store-goods/src/main/java/com/store/goods/controller/AppController.java
  8. 126 0
      blade-service/store-goods/src/main/java/com/store/goods/controller/AppVersionController.java
  9. 42 0
      blade-service/store-goods/src/main/java/com/store/goods/mapper/AppMapper.java
  10. 24 0
      blade-service/store-goods/src/main/java/com/store/goods/mapper/AppMapper.xml
  11. 42 0
      blade-service/store-goods/src/main/java/com/store/goods/mapper/AppVersionMapper.java
  12. 21 0
      blade-service/store-goods/src/main/java/com/store/goods/mapper/AppVersionMapper.xml
  13. 47 0
      blade-service/store-goods/src/main/java/com/store/goods/service/IAppService.java
  14. 41 0
      blade-service/store-goods/src/main/java/com/store/goods/service/IAppVersionService.java
  15. 64 0
      blade-service/store-goods/src/main/java/com/store/goods/service/impl/AppServiceImpl.java
  16. 41 0
      blade-service/store-goods/src/main/java/com/store/goods/service/impl/AppVersionServiceImpl.java

+ 34 - 0
blade-service-api/store-goods-api/src/main/java/com/store/goods/dto/AppDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.dto;
+
+import com.store.goods.entity.App;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * app应用表数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2021-12-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class AppDTO extends App {
+	private static final long serialVersionUID = 1L;
+
+}

+ 34 - 0
blade-service-api/store-goods-api/src/main/java/com/store/goods/dto/AppVersionDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.dto;
+
+import com.store.goods.entity.AppVersion;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * app版本表数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2021-12-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class AppVersionDTO extends AppVersion {
+	private static final long serialVersionUID = 1L;
+
+}

+ 122 - 0
blade-service-api/store-goods-api/src/main/java/com/store/goods/entity/App.java

@@ -0,0 +1,122 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import org.springframework.format.annotation.DateTimeFormat;
+
+/**
+ * app应用表实体类
+ *
+ * @author BladeX
+ * @since 2021-12-13
+ */
+@Data
+@TableName("blade_app")
+@ApiModel(value = "App对象", description = "app应用表")
+public class App implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	* app
+	*/
+		@ApiModelProperty(value = "app")
+		private Long id;
+	/**
+	* app名称
+	*/
+		@ApiModelProperty(value = "app名称")
+		private String appName;
+	/**
+	* logo
+	*/
+		@ApiModelProperty(value = "logo")
+		private String logo;
+	/**
+	* 小图标logo
+	*/
+		@ApiModelProperty(value = "小图标logo")
+		private String miniLogo;
+	/**
+	* 0为安卓,1为苹果
+	*/
+		@ApiModelProperty(value = "0为安卓,1为苹果")
+		private Integer type;
+	/**
+	* 安卓包名
+	*/
+		@ApiModelProperty(value = "安卓包名")
+		private String packageName;
+	/**
+	* 苹果url_schema
+	*/
+		@ApiModelProperty(value = "苹果url_schema")
+		private String urlSchema;
+	/**
+	* 苹果app_store_id
+	*/
+		@ApiModelProperty(value = "苹果app_store_id")
+		private String appStoreId;
+	/**
+	* 苹果bundle_id
+	*/
+		@ApiModelProperty(value = "苹果bundle_id")
+		private String bundleId;
+	/**
+	* app应用描述
+	*/
+		@ApiModelProperty(value = "app应用描述")
+		private String appDesc;
+
+		/**
+		 * 创建时间
+		 *
+		 * @ignore
+		 */
+		@ApiModelProperty(value = "创建时间")
+		@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+		@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+		protected Date createTime;
+
+		/**
+		 * 创建人
+		 *
+		 * @ignore
+		 */
+		@ApiModelProperty(value = "创建人")
+		protected Long createUser;
+
+		@TableField(exist = false)
+		@ApiModelProperty(value = "最新的app版本")
+		private AppVersion AppVersion;
+
+		@TableField(exist = false)
+		@ApiModelProperty(value = "app版本历史列表")
+		private List<AppVersion> AppVersionList;
+
+}

+ 96 - 0
blade-service-api/store-goods-api/src/main/java/com/store/goods/entity/AppVersion.java

@@ -0,0 +1,96 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import org.springframework.format.annotation.DateTimeFormat;
+
+/**
+ * app版本表实体类
+ *
+ * @author BladeX
+ * @since 2021-12-13
+ */
+@Data
+@TableName("blade_app_version")
+@ApiModel(value = "AppVersion对象", description = "app版本表")
+public class AppVersion implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	private Long id;
+	/**
+	* 属于的app的id
+	*/
+		@ApiModelProperty(value = "属于的app的id")
+		@TableField("appId")
+	private Long appid;
+	/**
+	* 版本名称
+	*/
+		@ApiModelProperty(value = "版本名称")
+		private String versionName;
+	/**
+	* 版本号
+	*/
+		@ApiModelProperty(value = "版本号")
+		private Long versionCode;
+	/**
+	* 版本更新描述
+	*/
+		@ApiModelProperty(value = "版本更新描述")
+		private String versionDesc;
+	/**
+	* 下载地址
+	*/
+		@ApiModelProperty(value = "下载地址")
+		private String downloadUrl;
+	/**
+	* 是否发布  0待发布 1发布
+	*/
+		@ApiModelProperty(value = "是否发布  0待发布 1发布")
+		private Integer isRelease;
+
+	/**
+	 * 创建时间
+	 *
+	 * @ignore
+	 */
+	@ApiModelProperty(value = "创建时间")
+	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	protected Date createTime;
+
+	/**
+	 * 创建人
+	 *
+	 * @ignore
+	 */
+	@ApiModelProperty(value = "创建人")
+	protected Long createUser;
+
+
+}

+ 36 - 0
blade-service-api/store-goods-api/src/main/java/com/store/goods/vo/AppVO.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.vo;
+
+import com.store.goods.entity.App;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * app应用表视图实体类
+ *
+ * @author BladeX
+ * @since 2021-12-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "AppVO对象", description = "app应用表")
+public class AppVO extends App {
+	private static final long serialVersionUID = 1L;
+
+}

+ 36 - 0
blade-service-api/store-goods-api/src/main/java/com/store/goods/vo/AppVersionVO.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.vo;
+
+import com.store.goods.entity.AppVersion;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * app版本表视图实体类
+ *
+ * @author BladeX
+ * @since 2021-12-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "AppVersionVO对象", description = "app版本表")
+public class AppVersionVO extends AppVersion {
+	private static final long serialVersionUID = 1L;
+
+}

+ 140 - 0
blade-service/store-goods/src/main/java/com/store/goods/controller/AppController.java

@@ -0,0 +1,140 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.store.goods.entity.AppVersion;
+import com.store.goods.service.IAppVersionService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.validation.Valid;
+
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.web.bind.annotation.*;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.store.goods.entity.App;
+import com.store.goods.vo.AppVO;
+import com.store.goods.service.IAppService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+import java.util.List;
+
+/**
+ * app应用表 控制器
+ *
+ * @author BladeX
+ * @since 2021-12-13
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/app")
+@Api(value = "app应用管理", tags = "app应用表接口")
+public class AppController extends BladeController {
+
+	private final IAppService appService;
+
+	private final IAppVersionService appVersionService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "查看app应用", notes = "传入app")
+	public R<App> detail(App app) {
+		App detail = appService.getOne(Condition.getQueryWrapper(app));
+		//获取全部的版本记录
+		List<AppVersion> list = appVersionService.list(new LambdaQueryWrapper<AppVersion>().eq(AppVersion::getAppid, detail.getId()).orderByDesc(AppVersion::getVersionCode));
+		detail.setAppVersionList(list);
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页 app应用表
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "app应用列表", notes = "传入app")
+	public R<IPage<App>> list(App app, Query query) {
+		try {
+			Page<App> page = new Page<>(query.getCurrent(), query.getSize());
+			IPage<App> pageList = appService.page(page, new LambdaQueryWrapper<App>().orderByDesc(App::getCreateTime));
+			pageList.getRecords().forEach(it -> {
+				//获取最新的版本信息
+				it.setAppVersion(appService.getLatestVersionById(it.getId(), null));
+			});
+			return R.data(pageList);
+		} catch (Exception e) {
+			return R.fail(e.getMessage());
+		}
+	}
+
+	/**
+	 * 分页列表查询更新历史记录
+	 *
+	 * @return
+	 */
+	@RequestMapping(value = "/versionHistory", method = RequestMethod.GET)
+	public R versionHistory(App app, Query query)
+	{
+		Page<AppVersion> page = new Page<>(query.getCurrent(), query.getSize());
+		IPage<AppVersion> pageList = appVersionService.page(page, new LambdaQueryWrapper<AppVersion>().eq(AppVersion::getAppid, app.getId()).orderByDesc(AppVersion::getVersionCode));
+		return R.data(pageList);
+	}
+
+
+	/**
+	 * 新增 app应用表
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增app应用", notes = "传入app")
+	public R save(@Valid @RequestBody App app) {
+		return R.status(appService.save(app));
+	}
+
+	/**
+	 * 修改 app应用表
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入app")
+	public R update(@Valid @RequestBody App app) {
+		return R.status(appService.updateById(app));
+	}
+
+	/**
+	 * 删除 app应用表
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(appService.removeByIds(Func.toLongList(ids)));
+	}
+
+
+}

+ 126 - 0
blade-service/store-goods/src/main/java/com/store/goods/controller/AppVersionController.java

@@ -0,0 +1,126 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.web.bind.annotation.*;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.store.goods.entity.AppVersion;
+import com.store.goods.vo.AppVersionVO;
+import com.store.goods.service.IAppVersionService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+/**
+ * app版本表 控制器
+ *
+ * @author BladeX
+ * @since 2021-12-13
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/appversion")
+@Api(value = "app版本表", tags = "app版本表接口")
+public class AppVersionController extends BladeController {
+
+	private final IAppVersionService appVersionService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入appVersion")
+	public R<AppVersion> detail(AppVersion appVersion) {
+		AppVersion detail = appVersionService.getOne(Condition.getQueryWrapper(appVersion));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页 app版本表
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入appVersion")
+	public R<IPage<AppVersion>> list(AppVersion appVersion, Query query) {
+		IPage<AppVersion> pages = appVersionService.page(Condition.getPage(query), Condition.getQueryWrapper(appVersion));
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页 app版本表
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入appVersion")
+	public R<IPage<AppVersionVO>> page(AppVersionVO appVersion, Query query) {
+		IPage<AppVersionVO> pages = appVersionService.selectAppVersionPage(Condition.getPage(query), appVersion);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增 app版本表
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入appVersion")
+	public R save(@Valid @RequestBody AppVersion appVersion) {
+		return R.status(appVersionService.save(appVersion));
+	}
+
+	/**
+	 * 修改 app版本表
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入appVersion")
+	public R update(@Valid @RequestBody AppVersion appVersion) {
+		return R.status(appVersionService.updateById(appVersion));
+	}
+
+	/**
+	 * 新增或修改 app版本表
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入appVersion")
+	public R submit(@Valid @RequestBody AppVersion appVersion) {
+		return R.status(appVersionService.saveOrUpdate(appVersion));
+	}
+
+	
+	/**
+	 * 删除 app版本表
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(appVersionService.removeByIds(Func.toLongList(ids)));
+	}
+
+	
+}

+ 42 - 0
blade-service/store-goods/src/main/java/com/store/goods/mapper/AppMapper.java

@@ -0,0 +1,42 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.mapper;
+
+import com.store.goods.entity.App;
+import com.store.goods.vo.AppVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * app应用表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2021-12-13
+ */
+public interface AppMapper extends BaseMapper<App> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param app
+	 * @return
+	 */
+	List<AppVO> selectAppPage(IPage page, AppVO app);
+
+}

+ 24 - 0
blade-service/store-goods/src/main/java/com/store/goods/mapper/AppMapper.xml

@@ -0,0 +1,24 @@
+<?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.store.goods.mapper.AppMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="appResultMap" type="com.store.goods.entity.App">
+        <id column="id" property="id"/>
+        <result column="app_name" property="appName"/>
+        <result column="logo" property="logo"/>
+        <result column="mini_logo" property="miniLogo"/>
+        <result column="type" property="type"/>
+        <result column="package_name" property="packageName"/>
+        <result column="url_schema" property="urlSchema"/>
+        <result column="app_store_id" property="appStoreId"/>
+        <result column="bundle_id" property="bundleId"/>
+        <result column="app_desc" property="appDesc"/>
+    </resultMap>
+
+
+    <select id="selectAppPage" resultMap="appResultMap">
+        select * from blade_app where is_deleted = 0
+    </select>
+
+</mapper>

+ 42 - 0
blade-service/store-goods/src/main/java/com/store/goods/mapper/AppVersionMapper.java

@@ -0,0 +1,42 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.mapper;
+
+import com.store.goods.entity.AppVersion;
+import com.store.goods.vo.AppVersionVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * app版本表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2021-12-13
+ */
+public interface AppVersionMapper extends BaseMapper<AppVersion> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param appVersion
+	 * @return
+	 */
+	List<AppVersionVO> selectAppVersionPage(IPage page, AppVersionVO appVersion);
+
+}

+ 21 - 0
blade-service/store-goods/src/main/java/com/store/goods/mapper/AppVersionMapper.xml

@@ -0,0 +1,21 @@
+<?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.store.goods.mapper.AppVersionMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="appVersionResultMap" type="com.store.goods.entity.AppVersion">
+        <id column="id" property="id"/>
+        <result column="appId" property="appid"/>
+        <result column="version_name" property="versionName"/>
+        <result column="version_code" property="versionCode"/>
+        <result column="version_desc" property="versionDesc"/>
+        <result column="download_url" property="downloadUrl"/>
+        <result column="is_release" property="isRelease"/>
+    </resultMap>
+
+
+    <select id="selectAppVersionPage" resultMap="appVersionResultMap">
+        select * from blade_app_version where is_deleted = 0
+    </select>
+
+</mapper>

+ 47 - 0
blade-service/store-goods/src/main/java/com/store/goods/service/IAppService.java

@@ -0,0 +1,47 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.service;
+
+import com.store.goods.entity.App;
+import com.store.goods.entity.AppVersion;
+import com.store.goods.vo.AppVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * app应用表 服务类
+ *
+ * @author BladeX
+ * @since 2021-12-13
+ */
+public interface IAppService extends IService<App> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param app
+	 * @return
+	 */
+	IPage<AppVO> selectAppPage(IPage<AppVO> page, AppVO app);
+
+	/**
+	 * 获取最新app版本信息
+	 * */
+	AppVersion getLatestVersionById(Long id, Integer[] release);
+
+}

+ 41 - 0
blade-service/store-goods/src/main/java/com/store/goods/service/IAppVersionService.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.service;
+
+import com.store.goods.entity.AppVersion;
+import com.store.goods.vo.AppVersionVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * app版本表 服务类
+ *
+ * @author BladeX
+ * @since 2021-12-13
+ */
+public interface IAppVersionService extends IService<AppVersion> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param appVersion
+	 * @return
+	 */
+	IPage<AppVersionVO> selectAppVersionPage(IPage<AppVersionVO> page, AppVersionVO appVersion);
+
+}

+ 64 - 0
blade-service/store-goods/src/main/java/com/store/goods/service/impl/AppServiceImpl.java

@@ -0,0 +1,64 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.store.goods.entity.App;
+import com.store.goods.entity.AppVersion;
+import com.store.goods.mapper.AppVersionMapper;
+import com.store.goods.vo.AppVO;
+import com.store.goods.mapper.AppMapper;
+import com.store.goods.service.IAppService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * app应用表 服务实现类
+ *
+ * @author BladeX
+ * @since 2021-12-13
+ */
+@Service
+public class AppServiceImpl extends ServiceImpl<AppMapper, App> implements IAppService
+{
+	@Autowired
+	private AppVersionMapper appVersionMapper;
+
+	@Override
+	public IPage<AppVO> selectAppPage(IPage<AppVO> page, AppVO app) {
+		return page.setRecords(baseMapper.selectAppPage(page, app));
+	}
+
+	@Override
+	public AppVersion getLatestVersionById(Long id, Integer[] release)
+	{
+		//查询此app应用下最新的版本信息
+		try {
+			LambdaQueryWrapper<AppVersion> wrapper = new LambdaQueryWrapper<AppVersion>()
+				.eq(AppVersion::getAppid, id)
+				.in(release != null, AppVersion::getIsRelease, release)
+				.orderByDesc(AppVersion::getVersionCode).last("limit 1");
+			return appVersionMapper.selectOne(wrapper);
+		} catch (Exception e) {
+			e.printStackTrace();
+			throw new SecurityException("应用不存在");
+		}
+	}
+
+}

+ 41 - 0
blade-service/store-goods/src/main/java/com/store/goods/service/impl/AppVersionServiceImpl.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.store.goods.service.impl;
+
+import com.store.goods.entity.AppVersion;
+import com.store.goods.vo.AppVersionVO;
+import com.store.goods.mapper.AppVersionMapper;
+import com.store.goods.service.IAppVersionService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * app版本表 服务实现类
+ *
+ * @author BladeX
+ * @since 2021-12-13
+ */
+@Service
+public class AppVersionServiceImpl extends ServiceImpl<AppVersionMapper, AppVersion> implements IAppVersionService {
+
+	@Override
+	public IPage<AppVersionVO> selectAppVersionPage(IPage<AppVersionVO> page, AppVersionVO appVersion) {
+		return page.setRecords(baseMapper.selectAppVersionPage(page, appVersion));
+	}
+
+}