瀏覽代碼

完善房间管理

zhengqiang 5 年之前
父節點
當前提交
f7a7e69117

+ 20 - 4
src/main/java/com/jpsoft/epay/modules/base/controller/RoomInfoController.java

@@ -25,11 +25,28 @@ public class RoomInfoController {
 
     @ApiOperation(value="创建空记录")
     @GetMapping("create")
-    public MessageResult<RoomInfo> create(){
+    public MessageResult<RoomInfo> create(String parentId){
         MessageResult<RoomInfo> msgResult = new MessageResult<>();
 
         RoomInfo roomInfo = new RoomInfo();
 
+        if(StringUtils.isNotEmpty(parentId)){
+            RoomInfo parent = roomInfoService.get(parentId);
+
+            roomInfo.setParentId(parent.getId());
+            roomInfo.setParentName(parent.getName());
+
+            if (parent.getType().equals("1")){
+                roomInfo.setType("2");
+            }
+            else if (parent.getType().equals("2")){
+                roomInfo.setType("3");
+            }
+        }
+        else{
+            roomInfo.setType("1");
+        }
+
         msgResult.setData(roomInfo);
         msgResult.setResult(true);
 
@@ -51,7 +68,7 @@ public class RoomInfoController {
 
             if (affectCount > 0) {
                 msgResult.setResult(true);
-                msgResult.setData(roomInfo);
+                msgResult.setData(roomInfoService.get(roomInfo.getId()));
             } else {
                 msgResult.setResult(false);
                 msgResult.setMessage("数据库添加失败");
@@ -106,7 +123,7 @@ public class RoomInfoController {
 
             if (affectCount > 0) {
                 msgResult.setResult(true);
-                msgResult.setData(roomInfo);
+                msgResult.setData(roomInfoService.get(roomInfo.getId()));
             } else {
                 msgResult.setResult(false);
                 msgResult.setMessage("数据库更新失败");
@@ -223,7 +240,6 @@ public class RoomInfoController {
         }
 
         if (StringUtils.isNotEmpty(type)) {
-            //1查目录-2查值
             searchParams.put("type", type);
         }
 

+ 1 - 1
src/main/java/com/jpsoft/epay/modules/sys/controller/MenuController.java

@@ -232,7 +232,7 @@ public class MenuController {
         Map<String, Object> searchParams = new HashMap<>();
 
         List<Sort> sortList = new ArrayList<>();
-        sortList.add(new Sort("create_time", "asc"));
+        sortList.add(new Sort("sort_no", "asc"));
 
         if (StringUtils.isNotEmpty(menuName)) {
             searchParams.put("menuName", "%" + menuName + "%");

+ 28 - 28
src/main/resources/mapper/base/RoomInfo.xml

@@ -5,22 +5,22 @@
 <mapper namespace="com.jpsoft.epay.modules.base.dao.RoomInfoDAO">
 	<resultMap id="RoomInfoMap" type="RoomInfo">
 		<id property="id" column="id_" />
-			<result property="name" column="name_" />
-			<result property="number" column="number_" />
-			<result property="type" column="type_" />
-			<result property="useType" column="use_type" />
-			<result property="sortNo" column="sort_no" />
-			<result property="parentId" column="parent_id" />
-		    <result property="parentName" column="parent_name"/>
-			<result property="createBy" column="create_by" />
-			<result property="createTime" column="create_time" />
-			<result property="updateBy" column="update_by" />
-			<result property="updateTime" column="update_time" />
-			<result property="delFlag" column="del_flag" />
-			<result property="hasChildren" column="has_children" />
-			<association property="useTypeN" column="use_type" select="com.jpsoft.epay.modules.sys.dao.DataDictionaryDAO.getName"/>
-			<!--<association property="children" column="id_" select="com.jpsoft.epay.modules.base.dao.RoomInfoDAO.getChildren"/>-->
-			</resultMap>
+		<result property="name" column="name_" />
+		<result property="number" column="number_" />
+		<result property="type" column="type_" />
+		<result property="useType" column="use_type" />
+		<result property="sortNo" column="sort_no" />
+		<result property="parentId" column="parent_id" />
+		<result property="parentName" column="parent_name"/>
+		<result property="createBy" column="create_by" />
+		<result property="createTime" column="create_time" />
+		<result property="updateBy" column="update_by" />
+		<result property="updateTime" column="update_time" />
+		<result property="delFlag" column="del_flag" />
+		<result property="hasChildren" column="has_children" />
+		<association property="useTypeN" column="use_type" select="com.jpsoft.epay.modules.sys.dao.DataDictionaryDAO.getName"/>
+		<!--<association property="children" column="id_" select="com.jpsoft.epay.modules.base.dao.RoomInfoDAO.getChildren"/>-->
+	</resultMap>
 	<insert id="insert" parameterType="RoomInfo">
 	<!--
 	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
@@ -32,18 +32,18 @@
 	    (id_,name_,number_,type_,sort_no,parent_id,create_by,create_time,update_by,update_time,del_flag,use_type)
 		values
 		(
-#{id,jdbcType=VARCHAR}
-,#{name,jdbcType=VARCHAR}
-,#{number,jdbcType= NUMERIC }
-,#{type,jdbcType=VARCHAR}
-,#{sortNo,jdbcType= NUMERIC }
-,#{parentId,jdbcType=VARCHAR}
-,#{createBy,jdbcType=VARCHAR}
-,#{createTime,jdbcType= TIMESTAMP }
-,#{updateBy,jdbcType=VARCHAR}
-,#{updateTime,jdbcType= TIMESTAMP }
-,#{delFlag,jdbcType= NUMERIC }
-,#{useType,jdbcType= VARCHAR }
+			#{id,jdbcType=VARCHAR}
+			,#{name,jdbcType=VARCHAR}
+			,#{number,jdbcType= NUMERIC }
+			,#{type,jdbcType=VARCHAR}
+			,#{sortNo,jdbcType= NUMERIC }
+			,#{parentId,jdbcType=VARCHAR}
+			,#{createBy,jdbcType=VARCHAR}
+			,#{createTime,jdbcType= TIMESTAMP }
+			,#{updateBy,jdbcType=VARCHAR}
+			,#{updateTime,jdbcType= TIMESTAMP }
+			,#{delFlag,jdbcType= NUMERIC }
+			,#{useType,jdbcType= VARCHAR }
 		)
 	]]>
 	</insert>

+ 1 - 0
src/main/resources/mapper/sys/Menu.xml

@@ -127,6 +127,7 @@
         and ur.role_id = rm.role_id
         and rm.menu_id = m.id_
         and m.menu_type = 2
+        and m.del_flag=0
         <if test="parentId==null">
             and m.parent_id is null
         </if>