Browse Source

update:操作手册

yonge 3 years ago
parent
commit
6e2fc1d30f

+ 105 - 0
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/SysManualController.java

@@ -0,0 +1,105 @@
+package com.yonge.cooleshow.admin.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
+import com.yonge.cooleshow.auth.api.entity.SysUser;
+import com.yonge.cooleshow.biz.dal.entity.SysManual;
+import com.yonge.cooleshow.biz.dal.queryInfo.SysManualQueryInfo;
+import com.yonge.cooleshow.biz.dal.service.SysManualService;
+import com.yonge.cooleshow.common.controller.BaseController;
+
+/**
+ * (SysManual)表控制层
+ *
+ * @author makejava
+ * @since 2021-12-20 14:23:36
+ */
+@RestController
+@Api(tags = "帮助手册")
+@RequestMapping("/sysManual")
+public class SysManualController extends BaseController {
+    /**
+     * 服务对象
+     */
+    @Autowired
+    private SysManualService sysManualService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+
+    @ApiOperation(value = "查询操作手册")
+    @RequestMapping("/listMenuIds")
+    public Object listMenuIds() {
+        return succeed(sysManualService.listMenuIds());
+    }
+
+    @ApiOperation(value = "查询操作手册")
+    @RequestMapping("/list")
+    public Object list(SysManualQueryInfo queryInfo) {
+        return succeed(sysManualService.query(queryInfo));
+    }
+
+    @ApiOperation(value = "新增帮助手册")
+    @PostMapping("/add")
+    public Object add(@RequestBody SysManual sysManual) throws Exception {
+        this.check(sysManual);
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        return succeed(sysManualService.add(sysManual, sysUser.getId()));
+    }
+
+    @ApiOperation(value = "修改帮助手册")
+    @PostMapping("/update")
+    public Object update(@RequestBody SysManual sysManual) throws Exception {
+        this.check(sysManual);
+        if (sysManual.getId() == null) {
+            throw new Exception("更新必须有id");
+        }
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        return succeed(sysManualService.update(sysManual, sysUser.getId()));
+    }
+
+    private void check(SysManual sysManual) throws Exception {
+        if (sysManual.getMenuId() == null) {
+            throw new Exception("菜单Id是必须");
+        }
+        if (sysManual.getName() == null) {
+            throw new Exception("菜单名是必填");
+        }
+        if (sysManual.getName().length() > 256) {
+            throw new Exception("菜单名不能超过256");
+        }
+        if (sysManual.getOpFlow() == null) {
+            throw new Exception("操作流程必填");
+        }
+        if (sysManual.getOpFlow().length() > 8000) {
+            throw new Exception("操作流程不能超过8000字节");
+        }
+        if (sysManual.getFunRule() == null) {
+            throw new Exception("功能规则必填");
+        }
+        if (sysManual.getFunRule().length() > 8000) {
+            throw new Exception("功能规则不能超过8000字节");
+        }
+    }
+
+    @ApiOperation(value = "删除帮助手册")
+    @PostMapping("/remove")
+    public Object remove(@RequestBody SysManual sysManual) throws Exception {
+        sysManualService.removeById(sysManual.getId());
+        return succeed();
+    }
+
+}

+ 27 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/SysManualDao.java

@@ -0,0 +1,27 @@
+package com.yonge.cooleshow.biz.dal.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ibatis.annotations.Param;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.yonge.cooleshow.biz.dal.entity.SysManual;
+
+/**
+ * (SysManual)表数据库访问层
+ *
+ * @author makejava
+ * @since 2021-12-20 17:22:42
+ */
+public interface SysManualDao extends BaseMapper<SysManual> {
+
+    int insertBatch(@Param("entities") List<SysManual> entities);
+
+    int findRecordCount(Map<String, Object> params);
+
+    List<SysManual> queryRecord(Map<String, Object> params);
+
+    List<String> listMenuIds();
+}
+

+ 160 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/SysManual.java

@@ -0,0 +1,160 @@
+package com.yonge.cooleshow.biz.dal.entity;
+
+
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.baomidou.mybatisplus.annotation.TableId;
+
+import java.io.Serializable;
+
+/**
+ * (SysManual)表实体类
+ *
+ * @author makejava
+ * @since 2021-12-20 13:46:08
+ */
+@ApiModel(value = "sys_manual-${tableInfo.comment}")
+public class SysManual implements Serializable {
+    @TableId(value = "id_", type = IdType.AUTO)
+    @ApiModelProperty(value = "${column.comment}")
+    private Integer id;
+
+    @TableField("menu_id_")
+    @ApiModelProperty(value = "菜单Id")
+    private Integer menuId;
+
+    @TableField("name_")
+    @ApiModelProperty(value = "手册名称")
+    private String name;
+
+    @TableField("op_flow_")
+    @ApiModelProperty(value = "操作流程")
+    private String opFlow;
+
+    @TableField("fun_rule_")
+    @ApiModelProperty(value = "功能规则")
+    private String funRule;
+
+    @TableField("video_url_")
+    @ApiModelProperty(value = "操作视频")
+    private String videoUrl;
+
+    @TableField("create_time_")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+
+    @TableField("update_time_")
+    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+
+    @TableField("operator_id_")
+    @ApiModelProperty(value = "操作人")
+    private Long operatorId;
+
+    @TableField(exist = false)
+    @ApiModelProperty(value = "操作人名称")
+    private String operatorName;
+
+    @TableField(exist = false)
+    @ApiModelProperty(value = "菜单名")
+    private String menuName;
+
+    // -------------------------------------------------------------------------
+
+    public String getOperatorName() {
+        return operatorName;
+    }
+
+    public void setOperatorName(String operatorName) {
+        this.operatorName = operatorName;
+    }
+
+    public String getMenuName() {
+        return menuName;
+    }
+
+    public void setMenuName(String menuName) {
+        this.menuName = menuName;
+    }
+
+    private static final long serialVersionUID = 1L;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getMenuId() {
+        return menuId;
+    }
+
+    public void setMenuId(Integer menuId) {
+        this.menuId = menuId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getOpFlow() {
+        return opFlow;
+    }
+
+    public void setOpFlow(String opFlow) {
+        this.opFlow = opFlow;
+    }
+
+    public String getFunRule() {
+        return funRule;
+    }
+
+    public void setFunRule(String funRule) {
+        this.funRule = funRule;
+    }
+
+    public String getVideoUrl() {
+        return videoUrl;
+    }
+
+    public void setVideoUrl(String videoUrl) {
+        this.videoUrl = videoUrl;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Long getOperatorId() {
+        return operatorId;
+    }
+
+    public void setOperatorId(Long operatorId) {
+        this.operatorId = operatorId;
+    }
+
+
+}
+

+ 35 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/queryInfo/SysManualQueryInfo.java

@@ -0,0 +1,35 @@
+package com.yonge.cooleshow.biz.dal.queryInfo;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import com.yonge.cooleshow.common.page.QueryInfo;
+
+/**
+ * Description
+ *
+ * @author: feng-ji
+ * @date: 2021-12-20
+ */
+public class SysManualQueryInfo  extends QueryInfo {
+
+    private Integer id;
+
+    @ApiModelProperty(value = "按菜单查询")
+    private Integer menuId;
+
+    public Integer getMenuId() {
+        return menuId;
+    }
+
+    public void setMenuId(Integer menuId) {
+        this.menuId = menuId;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+}

+ 24 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/SysManualService.java

@@ -0,0 +1,24 @@
+package com.yonge.cooleshow.biz.dal.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.yonge.cooleshow.biz.dal.entity.SysManual;
+import com.yonge.cooleshow.biz.dal.queryInfo.SysManualQueryInfo;
+import com.yonge.cooleshow.common.page.PageInfo;
+
+/**
+ * (SysManual)表服务接口
+ *
+ * @author makejava
+ * @since 2021-12-20 13:46:08
+ */
+public interface SysManualService extends IService<SysManual> {
+
+    PageInfo<SysManual> query(SysManualQueryInfo queryInfo);
+
+    Boolean add(SysManual sysManual, Long userId);
+
+    int update(SysManual sysManual, Long userId);
+
+    String listMenuIds();
+}
+

+ 76 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/SysManualServiceImpl.java

@@ -0,0 +1,76 @@
+package com.yonge.cooleshow.biz.dal.service.impl;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import jodd.util.StringUtil;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.yonge.cooleshow.biz.dal.dao.SysManualDao;
+import com.yonge.cooleshow.biz.dal.entity.SysManual;
+import com.yonge.cooleshow.biz.dal.queryInfo.SysManualQueryInfo;
+import com.yonge.cooleshow.biz.dal.service.SysManualService;
+import com.yonge.cooleshow.common.page.PageInfo;
+import com.yonge.toolset.utils.collection.MapUtil;
+
+/**
+ * (SysManual)表服务实现类
+ *
+ * @author makejava
+ * @since 2021-12-20 17:19:38
+ */
+@Service("sysManualService")
+public class SysManualServiceImpl extends ServiceImpl<SysManualDao, SysManual> implements SysManualService {
+
+    private final static Logger logger = LoggerFactory.getLogger(SysManualServiceImpl.class);
+
+    @Autowired
+    private SysManualDao sysManualDao;
+
+    public PageInfo<SysManual> query(SysManualQueryInfo queryInfo) {
+        PageInfo<SysManual> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+        Map<String, Object> params = new HashMap<>();
+        MapUtil.populateMap(params, queryInfo);
+        List<SysManual> dataList = null;
+        int count = sysManualDao.findRecordCount(params);
+        if (count > 0) {
+            pageInfo.setTotal(count);
+            params.put("offset", pageInfo.getOffset());
+            dataList = sysManualDao.queryRecord(params);
+        }
+        if (count == 0) {
+            dataList = new ArrayList<>();
+        }
+        pageInfo.setRows(dataList);
+
+        return pageInfo;
+    }
+
+    public Boolean add(SysManual sysManual, Long userId) {
+        sysManual.setOperatorId(userId);
+        sysManual.setCreateTime(new Date());
+        sysManual.setUpdateTime(new Date());
+        return this.save(sysManual);
+    }
+
+    public int update(SysManual sysManual, Long userId) {
+        sysManual.setOperatorId(userId);
+        sysManual.setUpdateTime(new Date());
+        return sysManualDao.updateById(sysManual);
+    }
+
+    @Override
+    public String listMenuIds() {
+        List<String> menuIds = sysManualDao.listMenuIds();
+        return StringUtil.join(menuIds, ",");
+    }
+}
+

+ 70 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/SysManualMapper.xml

@@ -0,0 +1,70 @@
+<?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.yonge.cooleshow.biz.dal.dao.SysManualDao">
+	<resultMap id="BaseResultMap" type="com.yonge.cooleshow.biz.dal.entity.SysManual">
+		<id column="id_" jdbcType="INTEGER" property="id" />
+		<result column="menu_id_" jdbcType="INTEGER" property="menuId" />
+		<result column="name_" jdbcType="VARCHAR" property="name" />
+		<result column="op_flow_" jdbcType="VARCHAR" property="opFlow" />
+		<result column="fun_rule_" jdbcType="VARCHAR" property="funRule" />
+		<result column="video_url_" jdbcType="VARCHAR" property="videoUrl" />
+		<result column="create_time_" jdbcType="TIMESTAMP" property="createTime" />
+		<result column="update_time_" jdbcType="TIMESTAMP" property="updateTime" />
+		<result column="operator_id_" jdbcType="INTEGER" property="operatorId" />
+	</resultMap>
+
+	<sql id="Base_Column_List">
+		id_, menu_id_, name_, op_flow_, fun_rule_, video_url_, create_time_,
+		update_time_, operator_id_
+	</sql>
+
+	<insert id="insertBatch" keyColumn="id_" keyProperty="id"
+		useGeneratedKeys="true" parameterType="com.yonge.cooleshow.biz.dal.entity.SysManual">
+		insert into sys_manual(menu_id_, name_, op_flow_, fun_rule_,
+		video_url_, create_time_, update_time_, operator_id_)
+		values
+		<foreach collection="entities" item="entity" separator=",">
+			(#{entity.menuId}, #{entity.name}, #{entity.opFlow},
+			#{entity.funRule}, #{entity.videoUrl}, #{entity.createTime},
+			#{entity.updateTime}, #{entity.operatorId})
+		</foreach>
+	</insert>
+	<select id="findRecordCount" resultType="java.lang.Integer">
+		select count(1) from sys_manual sm
+		left join sys_user u on sm.operator_id_ = u.id_
+		left join sys_menu m on sm.menu_id_ = m.id_
+		<where>
+			1 = 1
+			<if test="menuId != null and menuId != '' ">
+				AND menu_id_ = #{menuId}
+			</if>
+			<if test="search != null and search != '' ">
+				AND (sm.name_ like concat('%', #{search} '%') )
+			</if>
+		</where>
+		<include refid="global.limit" />
+	</select>
+
+	<select id="queryRecord" resultType="com.yonge.cooleshow.biz.dal.entity.SysManual">
+		select sm.*
+		, u.username_ as operatorName
+		, m.name_ as menuName
+		from sys_manual sm
+		left join sys_user u on sm.operator_id_ = u.id_
+		left join sys_menu m on sm.menu_id_ = m.id_
+		<where>
+			1 = 1
+			<if test="menuId != null and menuId != '' ">
+				AND sm.menu_id_ = #{menuId}
+			</if>
+			<if test="search != null and search != '' ">
+				AND (sm.name_ like concat('%', #{search} '%') )
+			</if>
+		</where>
+		<include refid="global.limit" />
+	</select>
+	<select id="listMenuIds" resultType="java.lang.String">
+		select menu_id_ from sys_manual
+	</select>
+
+</mapper>