Explorar el Código

Merge branch 'feat-20231031-portalConfig'

# Conflicts:
#	hnqz-common/hnqz-common-core/src/main/java/com/qunzhixinxi/hnqz/common/core/entity/CommonColour.java
#	hnqz-upms/hnqz-upms-api/src/main/java/com/qunzhixinxi/hnqz/admin/api/entity/SysPortalConf.java
#	hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/controller/SysPortalConfController.java
#	hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/SysPortalConfService.java
shc hace 1 año
padre
commit
0c9b0fbfe8

+ 21 - 21
hnqz-common/hnqz-common-core/src/main/java/com/qunzhixinxi/hnqz/common/core/entity/CommonColour.java

@@ -14,25 +14,25 @@ import java.io.Serializable;
 @Data
 public class CommonColour implements Serializable {
 
-	private static final long serialVersionUID = 2309656570997581153L;
-
-	/**
-	 * r
-	 */
-	private Integer r;
-
-	/**
-	 * g
-	 */
-	private Integer g;
-
-	/**
-	 * b
-	 */
-	private Integer b;
-
-	/**
-	 * 十六进制
-	 */
-	private String hex;
+    private static final long serialVersionUID = 2309656570997581153L;
+
+    /**
+     * r
+     */
+    private Integer r;
+
+    /**
+     * g
+     */
+    private Integer g;
+
+    /**
+     * b
+     */
+    private Integer b;
+
+    /**
+     * 十六进制
+     */
+    private String hex;
 }

+ 84 - 83
hnqz-upms/hnqz-upms-api/src/main/java/com/qunzhixinxi/hnqz/admin/api/entity/SysPortalConf.java

@@ -15,92 +15,93 @@ import java.time.LocalDateTime;
 /**
  * 门户配置信息
  *
- * @author jimmy
- * @version 1.0.0
- * @date 2023-06-05 19:24
+ * @author QuTong
+ * @version 1.0.1
+ * @date 2023年10月31日17:58:40
  */
 @Data
 @TableName(value = "sys_portal_conf", autoResultMap = true)
 public class SysPortalConf implements Serializable {
 
-	private static final long serialVersionUID = 4526768420806607933L;
-	/**
-	 * 主键
-	 */
-	@TableId(type = IdType.AUTO)
-	private Long confId;
-
-	/**
-	 * 专属路径
-	 */
-	@TableField(value = "spec_path")
-	private String specialPath;
-
-	/**
-	 * logo
-	 */
-	private String portalLogo;
-
-	/**
-	 * icon
-	 */
-	private String portalIcon;
-
-	/**
-	 * title
-	 */
-	private String portalTitle;
-
-	/**
-	 * 名称
-	 */
-	private String portalName;
-
-	/**
-	 * 背景图
-	 */
-	@TableField(value = "bg_img")
-	private String backgroundImage;
-
-	/**
-	 * 主题色
-	 */
-	@TableField(typeHandler = JacksonTypeHandler.class)
-	private CommonColour themeColor;
-
-	/**
-	 * icp备案号
-	 */
-	@TableField(value = "icp_no")
-	private String icpNo;
-
-	/**
-	 * 公安备案号
-	 */
-	@TableField(value = "pc_no")
-	private String policeNo;
-
-	/**
-	 * 创建人
-	 */
-	@TableField(fill = FieldFill.INSERT)
-	private String createdBy;
-
-	/**
-	 * 修改人
-	 */
-	@TableField(fill = FieldFill.INSERT_UPDATE)
-	private String modifiedBy;
-
-	/**
-	 * 创建时间
-	 */
-	@TableField(fill = FieldFill.INSERT)
-	private LocalDateTime createdTime;
-
-	/**
-	 * 修改时间
-	 */
-	@TableField(fill = FieldFill.INSERT_UPDATE)
-	private LocalDateTime modifiedTime;
+    private static final long serialVersionUID = 4526768420806607933L;
+
+    /**
+     * 主键
+     */
+    @TableId(type = IdType.AUTO)
+    private Long confId;
+
+    /**
+     * 专属路径
+     */
+    @TableField(value = "spec_path")
+    private String specialPath;
+
+    /**
+     * logo
+     */
+    private String portalLogo;
+
+    /**
+     * icon
+     */
+    private String portalIcon;
+
+    /**
+     * title
+     */
+    private String portalTitle;
+
+    /**
+     * 名称
+     */
+    private String portalName;
+
+    /**
+     * 背景图
+     */
+    @TableField(value = "bg_img")
+    private String backgroundImage;
+
+    /**
+     * 主题色
+     */
+    @TableField(typeHandler = JacksonTypeHandler.class)
+    private CommonColour themeColor;
+
+    /**
+     * icp备案号
+     */
+    @TableField(value = "icp_no")
+    private String icpNo;
+
+    /**
+     * 公安备案号
+     */
+    @TableField(value = "pc_no")
+    private String policeNo;
+
+    /**
+     * 创建人
+     */
+    @TableField(fill = FieldFill.INSERT)
+    private String createdBy;
+
+    /**
+     * 修改人
+     */
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private String modifiedBy;
+
+    /**
+     * 创建时间
+     */
+    @TableField(fill = FieldFill.INSERT)
+    private LocalDateTime createdTime;
+
+    /**
+     * 修改时间
+     */
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private LocalDateTime modifiedTime;
 }

+ 75 - 4
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/controller/SysPortalConfController.java

@@ -1,14 +1,16 @@
 package com.qunzhixinxi.hnqz.admin.controller;
 
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.qunzhixinxi.hnqz.admin.api.entity.SysPortalConf;
 import com.qunzhixinxi.hnqz.admin.service.SysPortalConfService;
 import com.qunzhixinxi.hnqz.common.core.util.R;
 import com.qunzhixinxi.hnqz.common.security.annotation.Inner;
+import com.qunzhixinxi.hnqz.common.security.util.SecurityUtils;
 import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+
+import java.time.LocalDateTime;
 
 /**
  * 门户专属配置前端控制器
@@ -31,11 +33,80 @@ public class SysPortalConfController {
 	 */
 	@Inner(value = false)
 	@GetMapping(value = "/portal/conf")
-	public R<SysPortalConf> getPortalConf(@RequestParam(value = "specialPath") String specialPath) {
+	public R<SysPortalConf> getPortalConf(@RequestParam(value = "s") String specialPath) {
 
 		return R.ok(portalConfService.getOne(Wrappers.<SysPortalConf>lambdaQuery().eq(SysPortalConf::getSpecialPath, specialPath)));
 
 	}
 
+	/**
+	 * 修改门户专属配置
+	 *
+	 * @param sysPortalConf 配置实体
+	 * @return Boolean
+	 */
+	@PutMapping(value = "/portal/conf")
+	public R<Boolean> editPortalConf(@RequestBody SysPortalConf sysPortalConf) {
+
+		// 主键id校验,防止异常
+		if (null == sysPortalConf.getConfId()) {
+			R.failed("修改门户配置主键不能为空");
+		}
+
+
+		LocalDateTime now = LocalDateTime.now();
+		sysPortalConf.setModifiedBy("admin");
+		sysPortalConf.setModifiedTime(now);
+
+		return R.ok(portalConfService.updateById(sysPortalConf));
+	}
+
+	/**
+	 * 新增门户专属配置
+	 *
+	 * @param sysPortalConf 配置实体
+	 * @return Boolean
+	 */
+	@PostMapping(value = "/portal/conf")
+	public R<Boolean> addPortalConf(@RequestBody SysPortalConf sysPortalConf) {
+
+		LocalDateTime now = LocalDateTime.now();
+		sysPortalConf.setCreatedBy("admin");
+		sysPortalConf.setModifiedBy("admin");
+		sysPortalConf.setCreatedTime(now);
+		sysPortalConf.setModifiedTime(now);
+
+		return R.ok(portalConfService.save(sysPortalConf));
+
+	}
+
+	/**
+	 * 获取详情
+	 *
+	 * @param configId 配置详情
+	 * @return 详情信息
+	 */
+	@GetMapping(value = "/portal/conf/details")
+	public R<SysPortalConf> getDetails(@RequestParam(value = "configId") Integer configId) {
+
+		SysPortalConf portalConf = portalConfService.getById(configId);
 
+		return R.ok(portalConf);
+	}
+
+	/**
+	 * 获取分页结果
+	 *
+	 * @param current 当前页码
+	 * @param size    每页记录数
+	 * @return 分页结果
+	 */
+	@GetMapping(value = "/portal/conf/page")
+	public R<Page<SysPortalConf>> pageConfigs(@RequestParam(value = "current", defaultValue = "1") Integer current,
+											  @RequestParam(value = "size", defaultValue = "20") Integer size) {
+
+		Page<SysPortalConf> confPage = portalConfService.page(new Page<>(current, size));
+
+		return R.ok(confPage);
+	}
 }

+ 2 - 2
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/SysPortalConfService.java

@@ -6,9 +6,9 @@ import com.qunzhixinxi.hnqz.admin.api.entity.SysPortalConf;
 /**
  * 门户配置信息服务
  *
- * @author jimmy
+ * @author QuTong
  * @version 1.0.0
- * @date 2023-06-05 19:30
+ * @date 2023年10月31日17:22:24
  */
 public interface SysPortalConfService extends IService<SysPortalConf> {