Переглянути джерело

加入 员工自定义菜单功能

java110 4 роки тому
батько
коміт
0991eca85e

+ 90 - 0
java110-bean/src/main/java/com/java110/dto/menuUser/MenuUserDto.java

@@ -0,0 +1,90 @@
+package com.java110.dto.menuUser;
+
+import com.java110.dto.PageDto;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @ClassName FloorDto
+ * @Description 自定义菜单数据层封装
+ * @Author wuxw
+ * @Date 2019/4/24 8:52
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+public class MenuUserDto extends PageDto implements Serializable {
+
+    private String muId;
+private String name;
+private String icon;
+private String mId;
+private String staffId;
+private String url;
+private String seq;
+
+
+    private Date createTime;
+
+    private String statusCd = "0";
+
+
+    public String getMuId() {
+        return muId;
+    }
+public void setMuId(String muId) {
+        this.muId = muId;
+    }
+public String getName() {
+        return name;
+    }
+public void setName(String name) {
+        this.name = name;
+    }
+public String getIcon() {
+        return icon;
+    }
+public void setIcon(String icon) {
+        this.icon = icon;
+    }
+public String getMId() {
+        return mId;
+    }
+public void setMId(String mId) {
+        this.mId = mId;
+    }
+public String getStaffId() {
+        return staffId;
+    }
+public void setStaffId(String staffId) {
+        this.staffId = staffId;
+    }
+public String getUrl() {
+        return url;
+    }
+public void setUrl(String url) {
+        this.url = url;
+    }
+public String getSeq() {
+        return seq;
+    }
+public void setSeq(String seq) {
+        this.seq = seq;
+    }
+
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getStatusCd() {
+        return statusCd;
+    }
+
+    public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
+}

+ 89 - 0
java110-bean/src/main/java/com/java110/po/menuUser/MenuUserPo.java

@@ -0,0 +1,89 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.po.menuUser;
+
+import java.io.Serializable;
+import java.util.Date;
+/**
+ * 类表述: Po 数据模型实体对象 基本保持与数据库模型一直 用于 增加修改删除 等时的数据载体
+ * add by 吴学文 at 2022-02-27 12:21:33 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+public class MenuUserPo implements Serializable {
+
+    private String muId;
+private String name;
+private String icon;
+private String mId;
+private String statusCd = "0";
+private String staffId;
+private String url;
+private String seq;
+public String getMuId() {
+        return muId;
+    }
+public void setMuId(String muId) {
+        this.muId = muId;
+    }
+public String getName() {
+        return name;
+    }
+public void setName(String name) {
+        this.name = name;
+    }
+public String getIcon() {
+        return icon;
+    }
+public void setIcon(String icon) {
+        this.icon = icon;
+    }
+public String getMId() {
+        return mId;
+    }
+public void setMId(String mId) {
+        this.mId = mId;
+    }
+public String getStatusCd() {
+        return statusCd;
+    }
+public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
+public String getStaffId() {
+        return staffId;
+    }
+public void setStaffId(String staffId) {
+        this.staffId = staffId;
+    }
+public String getUrl() {
+        return url;
+    }
+public void setUrl(String url) {
+        this.url = url;
+    }
+public String getSeq() {
+        return seq;
+    }
+public void setSeq(String seq) {
+        this.seq = seq;
+    }
+
+
+
+}

+ 124 - 0
java110-db/src/main/resources/mapper/user/MenuUserV1ServiceDaoImplMapper.xml

@@ -0,0 +1,124 @@
+<?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="menuUserV1ServiceDaoImpl">
+
+
+
+
+
+    <!-- 保存自定义菜单信息 add by wuxw 2018-07-03 -->
+    <insert id="saveMenuUserInfo" parameterType="Map">
+        insert into m_menu_user(
+mu_id,name,icon,m_id,staff_id,url,seq
+) values (
+#{muId},#{name},#{icon},#{mId},#{staffId},#{url},#{seq}
+)
+    </insert>
+
+
+
+    <!-- 查询自定义菜单信息 add by wuxw 2018-07-03 -->
+    <select id="getMenuUserInfo" parameterType="Map" resultType="Map">
+        select  t.mu_id,t.mu_id muId,t.name,t.icon,t.m_id,t.m_id mId,t.status_cd,t.status_cd statusCd,t.staff_id,t.staff_id staffId,t.url,t.seq 
+from m_menu_user t 
+where 1 =1 
+<if test="muId !=null and muId != ''">
+   and t.mu_id= #{muId}
+</if> 
+<if test="name !=null and name != ''">
+   and t.name= #{name}
+</if> 
+<if test="icon !=null and icon != ''">
+   and t.icon= #{icon}
+</if> 
+<if test="mId !=null and mId != ''">
+   and t.m_id= #{mId}
+</if> 
+<if test="statusCd !=null and statusCd != ''">
+   and t.status_cd= #{statusCd}
+</if> 
+<if test="staffId !=null and staffId != ''">
+   and t.staff_id= #{staffId}
+</if> 
+<if test="url !=null and url != ''">
+   and t.url= #{url}
+</if> 
+<if test="seq !=null and seq != ''">
+   and t.seq= #{seq}
+</if> 
+order by t.create_time desc
+<if test="page != -1 and page != null ">
+   limit #{page}, #{row}
+</if> 
+
+    </select>
+
+
+
+
+    <!-- 修改自定义菜单信息 add by wuxw 2018-07-03 -->
+    <update id="updateMenuUserInfo" parameterType="Map">
+        update  m_menu_user t set t.status_cd = #{statusCd}
+<if test="newBId != null and newBId != ''">
+,t.b_id = #{newBId}
+</if> 
+<if test="name !=null and name != ''">
+, t.name= #{name}
+</if> 
+<if test="icon !=null and icon != ''">
+, t.icon= #{icon}
+</if> 
+<if test="mId !=null and mId != ''">
+, t.m_id= #{mId}
+</if> 
+<if test="staffId !=null and staffId != ''">
+, t.staff_id= #{staffId}
+</if> 
+<if test="url !=null and url != ''">
+, t.url= #{url}
+</if> 
+<if test="seq !=null and seq != ''">
+, t.seq= #{seq}
+</if> 
+ where 1=1 <if test="muId !=null and muId != ''">
+and t.mu_id= #{muId}
+</if> 
+
+    </update>
+
+    <!-- 查询自定义菜单数量 add by wuxw 2018-07-03 -->
+     <select id="queryMenuUsersCount" parameterType="Map" resultType="Map">
+        select  count(1) count 
+from m_menu_user t 
+where 1 =1 
+<if test="muId !=null and muId != ''">
+   and t.mu_id= #{muId}
+</if> 
+<if test="name !=null and name != ''">
+   and t.name= #{name}
+</if> 
+<if test="icon !=null and icon != ''">
+   and t.icon= #{icon}
+</if> 
+<if test="mId !=null and mId != ''">
+   and t.m_id= #{mId}
+</if> 
+<if test="statusCd !=null and statusCd != ''">
+   and t.status_cd= #{statusCd}
+</if> 
+<if test="staffId !=null and staffId != ''">
+   and t.staff_id= #{staffId}
+</if> 
+<if test="url !=null and url != ''">
+   and t.url= #{url}
+</if> 
+<if test="seq !=null and seq != ''">
+   and t.seq= #{seq}
+</if> 
+
+
+     </select>
+
+</mapper>

+ 14 - 11
java110-generator/src/main/java/com/java110/code/TableToJson.java

@@ -18,22 +18,25 @@ import java.nio.charset.Charset;
 public class TableToJson {
 
     //show create table c_orders  用这个语句获取
-    public static final String createTableSql = "CREATE TABLE `m_menu_group_catalog` (\n" +
-            "  `gc_id` varchar(30) NOT NULL COMMENT '目录名称',\n" +
-            "  `ca_id` varchar(30) NOT NULL COMMENT '目录ID',\n" +
-            "  `g_id` varchar(30) NOT NULL COMMENT '菜单组ID',\n" +
-            "  `store_type` varchar(12) DEFAULT NULL COMMENT '商户类型',\n" +
+    public static final String createTableSql = "CREATE TABLE `m_menu_user` (\n" +
+            "  `mu_id` varchar(30) NOT NULL COMMENT '编号',\n" +
+            "  `m_id` varchar(30) NOT NULL COMMENT '菜单ID',\n" +
+            "  `staff_id` varchar(30) NOT NULL COMMENT '员工ID',\n" +
+            "  `name` varchar(64) NOT NULL COMMENT '菜单名称',\n" +
+            "  `icon` varchar(128) NOT NULL COMMENT '菜单组ID',\n" +
+            "  `url` varchar(200) NOT NULL COMMENT '打开地址',\n" +
+            "  `seq` int(11) NOT NULL COMMENT '列顺序',\n" +
             "  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',\n" +
             "  `status_cd` varchar(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,0在用,1失效'\n" +
-            ")";
+            ") ";
 
     public static void main(String[] args) {
-        String desc = "菜单目录组";
-        String id = "gcId";
-        String name = "menuGroupCatalog";
+        String desc = "自定义菜单";
+        String id = "muId";
+        String name = "menuUser";
         String shareName = "user"; //生成到那个服务下
-        String shareColumn = "store_type";
-        String shareParam = "storeType";
+        String shareColumn = "m_id";
+        String shareParam = "mId";
         //业务名称 desc 业务编码名称生成后类名 name 主键 id  需要放到那个服务 shareName
         String newSql = createTableSql.substring(createTableSql.indexOf("(") + 1, createTableSql.lastIndexOf(")"));
         String tableName = createTableSql.substring(createTableSql.indexOf("TABLE") + 5, createTableSql.indexOf("("));

+ 33 - 14
java110-generator/src/main/resources/newBack/template_1.json

@@ -1,27 +1,46 @@
 {
   "param": {
-    "storeType": "store_type",
-    "gId": "g_id",
-    "gcId": "gc_id",
-    "caId": "ca_id",
-    "statusCd": "status_cd"
+    "muId": "mu_id",
+    "name": "name",
+    "icon": "icon",
+    "mId": "m_id",
+    "statusCd": "status_cd",
+    "staffId": "staff_id",
+    "url": "url",
+    "seq": "seq"
   },
-  "name": "menuGroupCatalog",
-  "shareColumn": "store_type",
-  "id": "gcId",
+  "name": "menuUser",
+  "shareColumn": "m_id",
+  "id": "muId",
   "shareName": "user",
   "autoMove": true,
   "required": [
     {
-      "msg": "目录ID不能为空",
-      "code": "caId"
+      "msg": "菜单ID不能为空",
+      "code": "mId"
+    },
+    {
+      "msg": "员工ID不能为空",
+      "code": "staffId"
+    },
+    {
+      "msg": "菜单名称不能为空",
+      "code": "name"
     },
     {
       "msg": "菜单组ID不能为空",
-      "code": "gId"
+      "code": "icon"
+    },
+    {
+      "msg": "打开地址不能为空",
+      "code": "url"
+    },
+    {
+      "msg": "列顺序不能为空",
+      "code": "seq"
     }
   ],
-  "desc": "菜单目录组",
-  "shareParam": "storeType",
-  "tableName": "m_menu_group_catalog"
+  "desc": "自定义菜单",
+  "shareParam": "mId",
+  "tableName": "m_menu_user"
 }

+ 68 - 0
java110-interface/src/main/java/com/java110/intf/user/IMenuUserV1InnerServiceSMO.java

@@ -0,0 +1,68 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.intf.user;
+
+import com.java110.config.feign.FeignConfiguration;
+import com.java110.dto.menuUser.MenuUserDto;
+import com.java110.po.menuUser.MenuUserPo;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import java.util.List;
+
+/**
+ * 类表述: 服务之前调用的接口类,不对外提供接口能力 只用于接口建调用
+ * add by 吴学文 at 2022-02-27 12:21:33 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@FeignClient(name = "user-service", configuration = {FeignConfiguration.class})
+@RequestMapping("/menuUserV1Api")
+public interface IMenuUserV1InnerServiceSMO {
+
+
+    @RequestMapping(value = "/saveMenuUser", method = RequestMethod.POST)
+    public int saveMenuUser(@RequestBody  MenuUserPo menuUserPo);
+
+    @RequestMapping(value = "/updateMenuUser", method = RequestMethod.POST)
+    public int updateMenuUser(@RequestBody  MenuUserPo menuUserPo);
+
+    @RequestMapping(value = "/deleteMenuUser", method = RequestMethod.POST)
+    public int deleteMenuUser(@RequestBody  MenuUserPo menuUserPo);
+
+    /**
+     * <p>查询小区楼信息</p>
+     *
+     *
+     * @param menuUserDto 数据对象分享
+     * @return MenuUserDto 对象数据
+     */
+    @RequestMapping(value = "/queryMenuUsers", method = RequestMethod.POST)
+    List<MenuUserDto> queryMenuUsers(@RequestBody MenuUserDto menuUserDto);
+
+    /**
+     * 查询<p>小区楼</p>总记录数
+     *
+     * @param menuUserDto 数据对象分享
+     * @return 小区下的小区楼记录数
+     */
+    @RequestMapping(value = "/queryMenuUsersCount", method = RequestMethod.POST)
+    int queryMenuUsersCount(@RequestBody MenuUserDto menuUserDto);
+}

+ 71 - 0
service-user/src/main/java/com/java110/user/cmd/menuUser/DeleteMenuUserCmd.java

@@ -0,0 +1,71 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.user.cmd.menuUser;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.AbstractServiceCmdListener;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.intf.user.IMenuUserV1InnerServiceSMO;
+import com.java110.po.menuUser.MenuUserPo;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * 类表述:删除
+ * 服务编码:menuUser.deleteMenuUser
+ * 请求路劲:/app/menuUser.DeleteMenuUser
+ * add by 吴学文 at 2022-02-27 12:21:33 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@Java110Cmd(serviceCode = "menuUser.deleteMenuUser")
+public class DeleteMenuUserCmd extends AbstractServiceCmdListener {
+    private static Logger logger = LoggerFactory.getLogger(DeleteMenuUserCmd.class);
+
+    @Autowired
+    private IMenuUserV1InnerServiceSMO menuUserV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "muId", "muId不能为空");
+        Assert.hasKeyAndValue(reqJson, "mId", "mId不能为空");
+
+    }
+
+    @Override
+    @Java110Transactional
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+        MenuUserPo menuUserPo = BeanConvertUtil.covertBean(reqJson, MenuUserPo.class);
+        int flag = menuUserV1InnerServiceSMOImpl.deleteMenuUser(menuUserPo);
+
+        if (flag < 1) {
+            throw new CmdException("删除数据失败");
+        }
+
+        cmdDataFlowContext.setResponseEntity(ResultVo.success());
+    }
+}

+ 84 - 0
service-user/src/main/java/com/java110/user/cmd/menuUser/ListMenuUserCmd.java

@@ -0,0 +1,84 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.user.cmd.menuUser;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.AbstractServiceCmdListener;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.intf.user.IMenuUserV1InnerServiceSMO;
+import com.java110.po.menuUser.MenuUserPo;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import com.java110.dto.menuUser.MenuUserDto;
+import java.util.List;
+import java.util.ArrayList;
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.HttpStatus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * 类表述:查询
+ * 服务编码:menuUser.listMenuUser
+ * 请求路劲:/app/menuUser.ListMenuUser
+ * add by 吴学文 at 2022-02-27 12:21:33 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@Java110Cmd(serviceCode = "menuUser.listMenuUser")
+public class ListMenuUserCmd extends AbstractServiceCmdListener {
+
+  private static Logger logger = LoggerFactory.getLogger(ListMenuUserCmd.class);
+    @Autowired
+    private IMenuUserV1InnerServiceSMO menuUserV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        super.validatePageInfo(reqJson);
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+           MenuUserDto menuUserDto = BeanConvertUtil.covertBean(reqJson, MenuUserDto.class);
+
+           int count = menuUserV1InnerServiceSMOImpl.queryMenuUsersCount(menuUserDto);
+
+           List<MenuUserDto> menuUserDtos = null;
+
+           if (count > 0) {
+               menuUserDtos = menuUserV1InnerServiceSMOImpl.queryMenuUsers(menuUserDto);
+           } else {
+               menuUserDtos = new ArrayList<>();
+           }
+
+           ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, menuUserDtos);
+
+           ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+           cmdDataFlowContext.setResponseEntity(responseEntity);
+    }
+}

+ 80 - 0
service-user/src/main/java/com/java110/user/cmd/menuUser/SaveMenuUserCmd.java

@@ -0,0 +1,80 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.user.cmd.menuUser;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.AbstractServiceCmdListener;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.intf.user.IMenuUserV1InnerServiceSMO;
+import com.java110.po.menuUser.MenuUserPo;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * 类表述:保存
+ * 服务编码:menuUser.saveMenuUser
+ * 请求路劲:/app/menuUser.SaveMenuUser
+ * add by 吴学文 at 2022-02-27 12:21:33 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@Java110Cmd(serviceCode = "menuUser.saveMenuUser")
+public class SaveMenuUserCmd extends AbstractServiceCmdListener {
+
+    private static Logger logger = LoggerFactory.getLogger(SaveMenuUserCmd.class);
+
+    public static final String CODE_PREFIX_ID = "10";
+
+    @Autowired
+    private IMenuUserV1InnerServiceSMO menuUserV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "mId", "请求报文中未包含mId");
+        Assert.hasKeyAndValue(reqJson, "staffId", "请求报文中未包含staffId");
+        Assert.hasKeyAndValue(reqJson, "name", "请求报文中未包含name");
+        Assert.hasKeyAndValue(reqJson, "icon", "请求报文中未包含icon");
+        Assert.hasKeyAndValue(reqJson, "url", "请求报文中未包含url");
+        Assert.hasKeyAndValue(reqJson, "seq", "请求报文中未包含seq");
+
+    }
+
+    @Override
+    @Java110Transactional
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+        MenuUserPo menuUserPo = BeanConvertUtil.covertBean(reqJson, MenuUserPo.class);
+        menuUserPo.setMuId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
+        int flag = menuUserV1InnerServiceSMOImpl.saveMenuUser(menuUserPo);
+
+        if (flag < 1) {
+            throw new CmdException("保存数据失败");
+        }
+
+        cmdDataFlowContext.setResponseEntity(ResultVo.success());
+    }
+}

+ 74 - 0
service-user/src/main/java/com/java110/user/cmd/menuUser/UpdateMenuUserCmd.java

@@ -0,0 +1,74 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.user.cmd.menuUser;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.AbstractServiceCmdListener;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.intf.user.IMenuUserV1InnerServiceSMO;
+import com.java110.po.menuUser.MenuUserPo;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+/**
+ * 类表述:更新
+ * 服务编码:menuUser.updateMenuUser
+ * 请求路劲:/app/menuUser.UpdateMenuUser
+ * add by 吴学文 at 2022-02-27 12:21:33 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@Java110Cmd(serviceCode = "menuUser.updateMenuUser")
+public class UpdateMenuUserCmd extends AbstractServiceCmdListener {
+
+    private static Logger logger = LoggerFactory.getLogger(UpdateMenuUserCmd.class);
+
+
+    @Autowired
+    private IMenuUserV1InnerServiceSMO menuUserV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "muId", "muId不能为空");
+        Assert.hasKeyAndValue(reqJson, "mId", "mId不能为空");
+
+    }
+
+    @Override
+    @Java110Transactional
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+        MenuUserPo menuUserPo = BeanConvertUtil.covertBean(reqJson, MenuUserPo.class);
+        int flag = menuUserV1InnerServiceSMOImpl.updateMenuUser(menuUserPo);
+
+        if (flag < 1) {
+            throw new CmdException("更新数据失败");
+        }
+
+        cmdDataFlowContext.setResponseEntity(ResultVo.success());
+    }
+}

+ 77 - 0
service-user/src/main/java/com/java110/user/dao/IMenuUserV1ServiceDao.java

@@ -0,0 +1,77 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.user.dao;
+
+
+import com.java110.utils.exception.DAOException;
+import com.java110.entity.merchant.BoMerchant;
+import com.java110.entity.merchant.BoMerchantAttr;
+import com.java110.entity.merchant.Merchant;
+import com.java110.entity.merchant.MerchantAttr;
+
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 类表述:
+ * add by 吴学文 at 2022-02-27 12:21:33 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+public interface IMenuUserV1ServiceDao {
+
+
+    /**
+     * 保存 自定义菜单信息
+     * @param info
+     * @throws DAOException DAO异常
+     */
+    int saveMenuUserInfo(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 查询自定义菜单信息(instance过程)
+     * 根据bId 查询自定义菜单信息
+     * @param info bId 信息
+     * @return 自定义菜单信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getMenuUserInfo(Map info) throws DAOException;
+
+
+
+    /**
+     * 修改自定义菜单信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    int updateMenuUserInfo(Map info) throws DAOException;
+
+
+    /**
+     * 查询自定义菜单总数
+     *
+     * @param info 自定义菜单信息
+     * @return 自定义菜单数量
+     */
+    int queryMenuUsersCount(Map info);
+
+}

+ 112 - 0
service-user/src/main/java/com/java110/user/dao/impl/MenuUserV1ServiceDaoImpl.java

@@ -0,0 +1,112 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.user.dao.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.exception.DAOException;
+import com.java110.utils.util.DateUtil;
+import com.java110.core.base.dao.BaseServiceDao;
+import com.java110.user.dao.IMenuUserV1ServiceDao;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 类表述:
+ * add by 吴学文 at 2022-02-27 12:21:33 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@Service("menuUserV1ServiceDaoImpl")
+public class MenuUserV1ServiceDaoImpl extends BaseServiceDao implements IMenuUserV1ServiceDao {
+
+    private static Logger logger = LoggerFactory.getLogger(MenuUserV1ServiceDaoImpl.class);
+
+
+
+
+
+    /**
+     * 保存自定义菜单信息 到 instance
+     * @param info   bId 信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public int saveMenuUserInfo(Map info) throws DAOException {
+        logger.debug("保存 saveMenuUserInfo 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.insert("menuUserV1ServiceDaoImpl.saveMenuUserInfo",info);
+
+        return saveFlag;
+    }
+
+
+    /**
+     * 查询自定义菜单信息(instance)
+     * @param info bId 信息
+     * @return List<Map>
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public List<Map> getMenuUserInfo(Map info) throws DAOException {
+        logger.debug("查询 getMenuUserInfo 入参 info : {}",info);
+
+        List<Map> businessMenuUserInfos = sqlSessionTemplate.selectList("menuUserV1ServiceDaoImpl.getMenuUserInfo",info);
+
+        return businessMenuUserInfos;
+    }
+
+
+    /**
+     * 修改自定义菜单信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public int updateMenuUserInfo(Map info) throws DAOException {
+        logger.debug("修改 updateMenuUserInfo 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.update("menuUserV1ServiceDaoImpl.updateMenuUserInfo",info);
+
+        return saveFlag;
+    }
+
+     /**
+     * 查询自定义菜单数量
+     * @param info 自定义菜单信息
+     * @return 自定义菜单数量
+     */
+    @Override
+    public int queryMenuUsersCount(Map info) {
+        logger.debug("查询 queryMenuUsersCount 入参 info : {}",info);
+
+        List<Map> businessMenuUserInfos = sqlSessionTemplate.selectList("menuUserV1ServiceDaoImpl.queryMenuUsersCount", info);
+        if (businessMenuUserInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessMenuUserInfos.get(0).get("count").toString());
+    }
+
+
+}

+ 89 - 0
service-user/src/main/java/com/java110/user/smo/impl/MenuUserV1InnerServiceSMOImpl.java

@@ -0,0 +1,89 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.user.smo.impl;
+
+
+import com.java110.user.dao.IMenuUserV1ServiceDao;
+import com.java110.intf.user.IMenuUserV1InnerServiceSMO;
+import com.java110.dto.menuUser.MenuUserDto;
+import com.java110.po.menuUser.MenuUserPo;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.dto.user.UserDto;
+import com.java110.dto.PageDto;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 类表述: 服务之前调用的接口实现类,不对外提供接口能力 只用于接口建调用
+ * add by 吴学文 at 2022-02-27 12:21:33 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@RestController
+public class MenuUserV1InnerServiceSMOImpl extends BaseServiceSMO implements IMenuUserV1InnerServiceSMO {
+
+    @Autowired
+    private IMenuUserV1ServiceDao menuUserV1ServiceDaoImpl;
+
+
+    @Override
+    public int saveMenuUser(@RequestBody  MenuUserPo menuUserPo) {
+        int saveFlag = menuUserV1ServiceDaoImpl.saveMenuUserInfo(BeanConvertUtil.beanCovertMap(menuUserPo));
+        return saveFlag;
+    }
+
+     @Override
+    public int updateMenuUser(@RequestBody  MenuUserPo menuUserPo) {
+        int saveFlag = menuUserV1ServiceDaoImpl.updateMenuUserInfo(BeanConvertUtil.beanCovertMap(menuUserPo));
+        return saveFlag;
+    }
+
+     @Override
+    public int deleteMenuUser(@RequestBody  MenuUserPo menuUserPo) {
+       menuUserPo.setStatusCd("1");
+       int saveFlag = menuUserV1ServiceDaoImpl.updateMenuUserInfo(BeanConvertUtil.beanCovertMap(menuUserPo));
+       return saveFlag;
+    }
+
+    @Override
+    public List<MenuUserDto> queryMenuUsers(@RequestBody  MenuUserDto menuUserDto) {
+
+        //校验是否传了 分页信息
+
+        int page = menuUserDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            menuUserDto.setPage((page - 1) * menuUserDto.getRow());
+        }
+
+        List<MenuUserDto> menuUsers = BeanConvertUtil.covertBeanList(menuUserV1ServiceDaoImpl.getMenuUserInfo(BeanConvertUtil.beanCovertMap(menuUserDto)), MenuUserDto.class);
+
+        return menuUsers;
+    }
+
+
+    @Override
+    public int queryMenuUsersCount(@RequestBody MenuUserDto menuUserDto) {
+        return menuUserV1ServiceDaoImpl.queryMenuUsersCount(BeanConvertUtil.beanCovertMap(menuUserDto));    }
+
+}