提交 18a42aa8 编写于 作者: Skyeye云's avatar Skyeye云

Merge branch 'company_server' of https://gitee.com/doc_wei01/skyeye into company_server

......@@ -19,18 +19,56 @@ import java.util.Map;
*/
public interface DsFormPageTypeDao {
/**
* 分页+typeName模糊查询动态表单页面分类列表
*
* @param map
* @return
*/
List<Map<String, Object>> queryDsFormPageTypeList(Map<String, Object> map);
/**
* 新增动态表单页面分类
*
* @param map
*/
void insertDsFormPageType(Map<String, Object> map);
/**
* 根据id查询动态表单页面分类详情
*
* @param id 唯一标识
* @return 详情信息
*/
Map<String, Object> queryDsFormPageTypeById(@Param("id") String id);
/**
* 根据parentId+typeName查询动态表单页面的id
* @param map
* @return 唯一标识id
*/
String queryDsFormPageTypeByParentIdAndTypeName(Map<String, Object> map);
/**
* 根据parentId查询动态表单页面分类列表
*
* @param parentId 父节点id
* @return 动态表单页面分类列表
*/
List<Map<String, Object>> queryDsFormPageTypeByParentId(@Param("parentId") String parentId);
void updateDsFormPageTypeById(Map<String, Object> map) throws Exception;
/**
* 根据id更新动态表单页面分类
*
* @param map
* @throws Exception
*/
void updateDsFormPageTypeById(Map<String, Object> map);
void delDsFormPageTypeById(@Param("id") String id) throws Exception;
/**
* 根据id删除动态表单页面分类
* @param id 唯一标识
*/
void delDsFormPageTypeById(@Param("id") String id);
}
......@@ -17,16 +17,58 @@ import com.skyeye.common.object.OutputObject;
*/
public interface DsFormPageTypeService {
/**
* 获取动态表单页面分类列表
*
* @param inputObject
* @param outputObject
* @throws Exception
*/
void queryDsFormPageTypeList(InputObject inputObject, OutputObject outputObject) throws Exception;
/**
* 新增动态表单页面分类
*
* @param inputObject
* @param outputObject
* @throws Exception
*/
void insertDsFormPageType(InputObject inputObject, OutputObject outputObject) throws Exception;
/**
* 根据id查询动态表单页面分类详情
*
* @param inputObject
* @param outputObject
* @throws Exception
*/
void queryDsFormPageTypeById(InputObject inputObject, OutputObject outputObject) throws Exception;
/**
* 通过parentId查找对应的动态表单分类列表
*
* @param inputObject
* @param outputObject
* @throws Exception
*/
void queryDsFormPageTypeByParentId(InputObject inputObject, OutputObject outputObject) throws Exception;
/**
* 通过id编辑对应的动态表单分类信息
*
* @param inputObject
* @param outputObject
* @throws Exception
*/
void updateDsFormPageTypeById(InputObject inputObject, OutputObject outputObject) throws Exception;
/**
* 删除动态表单分类
*
* @param inputObject
* @param outputObject
* @throws Exception
*/
void delDsFormPageTypeById(InputObject inputObject, OutputObject outputObject) throws Exception;
}
......@@ -14,6 +14,7 @@ import com.skyeye.eve.dao.DsFormPageTypeDao;
import com.skyeye.eve.service.DsFormPageTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
......@@ -84,26 +85,41 @@ public class DsFormPageTypeServiceImpl implements DsFormPageTypeService {
* 校验parentId是否存在
*
* @param inputParams
* @param outputObject
* @return true: parentId+typeName存在, 反之false
*/
private boolean checkParentIdExists(Map<String, Object> inputParams, OutputObject outputObject) {
Object parentId = inputParams.get("parentId");
if (parentId != null) {
String tempId = dsFormPageTypeDao.queryDsFormPageTypeByParentIdAndTypeName(inputParams);
if (tempId == null || tempId.equals(inputParams.get("id"))) {
return false;
}
outputObject.setreturnMessage("父节点下已存在该分类名称.");
return true;
String tempId = dsFormPageTypeDao.queryDsFormPageTypeByParentIdAndTypeName(inputParams);
if (tempId == null || tempId.equals(inputParams.get("id"))) {
return false;
}
// 父节点不存在默认赋值0
inputParams.put("parentId", 0);
return false;
outputObject.setreturnMessage("父节点下已存在该分类名称.");
return true;
}
@Override
@Transactional(value="transactionManager")
public void delDsFormPageTypeById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> inputParams = inputObject.getParams();
dsFormPageTypeDao.delDsFormPageTypeById(inputParams.get("id").toString());
// 根据Id查询该节点id是否被作为parentId使用
String id = inputParams.get("id").toString();
delSubDsFormPageType(id);
dsFormPageTypeDao.delDsFormPageTypeById(id);
}
/**
* 根据id删除挂载该节点作为父节点的页面分类节点
*
* @param id 页面分类id
*/
private void delSubDsFormPageType(String id) {
List<Map<String, Object>> dsFormPageTypeList = dsFormPageTypeDao.queryDsFormPageTypeByParentId(id);
if (dsFormPageTypeList.size() != 0) {
dsFormPageTypeList.forEach(cs -> {
String tempId = cs.get("id").toString();
delSubDsFormPageType(tempId);
dsFormPageTypeDao.delDsFormPageTypeById(tempId);
});
}
}
}
......@@ -152,7 +152,7 @@
</url>
<url id="dsformpagetype002" path="/post/DsFormPageTypeController/insertDsFormPageType" method="POST" val="新增动态表单页面分类" allUse="2">
<property id="typeName" name="typeName" ref="required" var="分类名称"/>
<property id="parentId" name="parentId" ref="" var="父id"/>
<property id="parentId" name="parentId" ref="required" var="父id"/>
</url>
<url id="dsformpagetype003" path="/post/DsFormPageTypeController/delDsFormPageTypeById" method="DELETE" val="删除动态表单分类" allUse="2">
<property id="id" name="id" ref="required" var="动态表单分类id"/>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册