提交 035279b1 编写于 作者: Jadan-Z's avatar Jadan-Z

1、完成表ds_form_page_type涉及增删改查功能

上级 442e5144
/*******************************************************************************
* Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package com.skyeye.eve.controller;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.eve.service.DsFormPageTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class DsFormPageTypeController {
@Autowired
private DsFormPageTypeService dsFormPageTypeService;
/**
*
* @Title: queryDsFormPageTypeList
* @Description: 获取动态表单页面分类列表
* @param inputObject
* @param outputObject
* @throws Exception 异常
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/DsFormPageTypeController/queryDsFormPageTypeList")
@ResponseBody
public void queryDsFormPageTypeList(InputObject inputObject, OutputObject outputObject) throws Exception{
dsFormPageTypeService.queryDsFormPageTypeList(inputObject, outputObject);
}
/**
*
* @Title: insertDsFormPageType
* @Description: 新增动态表单页面分类
* @param inputObject
* @param outputObject
* @throws Exception 异常
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/DsFormPageTypeController/insertDsFormPageType")
@ResponseBody
public void insertDsFormPageType(InputObject inputObject, OutputObject outputObject) throws Exception{
dsFormPageTypeService.insertDsFormPageType(inputObject, outputObject);
}
/**
*
* @Title: delDsFormPageTypeById
* @Description: 删除动态表单分类
* @param inputObject
* @param outputObject
* @throws Exception 异常
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/DsFormPageTypeController/delDsFormPageTypeById")
@ResponseBody
public void delDsFormPageTypeById(InputObject inputObject, OutputObject outputObject) throws Exception{
dsFormPageTypeService.delDsFormPageTypeById(inputObject, outputObject);
}
/**
*
* @Title: queryDsFormPageTypeById
* @Description: 根据id查询动态表单页面分类详情
* @param inputObject
* @param outputObject
* @throws Exception 异常
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/DsFormPageTypeController/queryDsFormPageTypeById")
@ResponseBody
public void queryDsFormPageTypeById(InputObject inputObject, OutputObject outputObject) throws Exception{
dsFormPageTypeService.queryDsFormPageTypeById(inputObject, outputObject);
}
/**
*
* @Title: updateDsFormPageTypeById
* @Description: 通过id编辑对应的动态表单分类信息
* @param inputObject
* @param outputObject
* @throws Exception 异常
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/DsFormPageTypeController/updateDsFormPageTypeById")
@ResponseBody
public void updateDsFormPageTypeById(InputObject inputObject, OutputObject outputObject) throws Exception{
dsFormPageTypeService.updateDsFormPageTypeById(inputObject, outputObject);
}
/**
*
* @Title: queryDsFormPageTypeByParentId
* @Description: 通过parentId查找对应的动态表单分类列表
* @param inputObject
* @param outputObject
* @throws Exception 异常
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/DsFormPageTypeController/queryDsFormPageTypeByParentId")
@ResponseBody
public void queryDsFormPageTypeByParentId(InputObject inputObject, OutputObject outputObject) throws Exception{
dsFormPageTypeService.queryDsFormPageTypeByParentId(inputObject, outputObject);
}
}
/*******************************************************************************
* Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package com.skyeye.eve.dao;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* @ClassName: DsFormPageTypeDao
* @Description: 动态表单页面分类数据层
* @author: skyeye云系列--郑杰
* @date: 2021/11/6 23:33
* @Copyright: 2021 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
public interface DsFormPageTypeDao {
List<Map<String, Object>> queryDsFormPageTypeList(Map<String, Object> map);
void insertDsFormPageType(Map<String, Object> map);
Map<String, Object> queryDsFormPageTypeById(@Param("id") String id);
String queryDsFormPageTypeByParentIdAndTypeName(Map<String, Object> map);
List<Map<String, Object>> queryDsFormPageTypeByParentId(@Param("parentId") String parentId);
void updateDsFormPageTypeById(Map<String, Object> map) throws Exception;
void delDsFormPageTypeById(@Param("id") String id) throws Exception;
}
/*******************************************************************************
* Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package com.skyeye.eve.service;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
/**
* @ClassName: DsFormPageTypeService
* @Description: 动态表单页面分类业务层
* @author: skyeye云系列--郑杰
* @date: 2021/11/6 23:33
* @Copyright: 2021 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
public interface DsFormPageTypeService {
void queryDsFormPageTypeList(InputObject inputObject, OutputObject outputObject) throws Exception;
void insertDsFormPageType(InputObject inputObject, OutputObject outputObject) throws Exception;
void queryDsFormPageTypeById(InputObject inputObject, OutputObject outputObject) throws Exception;
void queryDsFormPageTypeByParentId(InputObject inputObject, OutputObject outputObject) throws Exception;
void updateDsFormPageTypeById(InputObject inputObject, OutputObject outputObject) throws Exception;
void delDsFormPageTypeById(InputObject inputObject, OutputObject outputObject) throws Exception;
}
/*******************************************************************************
* Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package com.skyeye.eve.service.impl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.common.util.DateUtil;
import com.skyeye.common.util.ToolUtil;
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 java.util.List;
import java.util.Map;
/**
* @ClassName: DsFormPageTypeServiceImpl
* @Description: 动态表单页面分类业务实现层
* @author: skyeye云系列--郑杰
* @date: 2021/11/6 23:33
* @Copyright: 2021 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
@Service
public class DsFormPageTypeServiceImpl implements DsFormPageTypeService {
@Autowired
private DsFormPageTypeDao dsFormPageTypeDao;
@Override
public void queryDsFormPageTypeList(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> inputParams = inputObject.getParams();
Page pages = PageHelper.startPage(Integer.parseInt(inputParams.get("page").toString()), Integer.parseInt(inputParams.get("limit").toString()));
List<Map<String, Object>> emailSendModelList = dsFormPageTypeDao.queryDsFormPageTypeList(inputParams);
outputObject.setBeans(emailSendModelList);
outputObject.settotal(pages.getTotal());
}
@Override
public void insertDsFormPageType(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> inputParams = inputObject.getParams();
if (checkParentIdExists(inputParams, outputObject)) {
return;
}
inputParams.put("id", ToolUtil.getSurFaceId());
inputParams.put("createTime", DateUtil.getTimeAndToString());
inputParams.put("userId", inputObject.getLogParams().get("id"));
dsFormPageTypeDao.insertDsFormPageType(inputParams);
}
@Override
public void queryDsFormPageTypeById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> inputParams = inputObject.getParams();
Map<String, Object> dsFormPageTypeBean = dsFormPageTypeDao.queryDsFormPageTypeById(inputParams.get("id").toString());
outputObject.setBean(dsFormPageTypeBean);
outputObject.settotal(1);
}
@Override
public void queryDsFormPageTypeByParentId(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> inputParams = inputObject.getParams();
List<Map<String, Object>> dsFormPageTypeList = dsFormPageTypeDao.queryDsFormPageTypeByParentId(inputParams.get("parentId").toString());
outputObject.setBeans(dsFormPageTypeList);
outputObject.settotal(dsFormPageTypeList.size());
}
@Override
public void updateDsFormPageTypeById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> inputParams = inputObject.getParams();
if (checkParentIdExists(inputParams, outputObject)) {
return;
}
inputParams.put("lastUpdateTime", DateUtil.getTimeAndToString());
inputParams.put("userId", inputObject.getLogParams().get("id"));
dsFormPageTypeDao.updateDsFormPageTypeById(inputParams);
}
/**
* 校验parentId是否存在
*
* @param inputParams
* @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;
}
// 父节点不存在默认赋值0
inputParams.put("parentId", 0);
return false;
}
@Override
public void delDsFormPageTypeById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> inputParams = inputObject.getParams();
dsFormPageTypeDao.delDsFormPageTypeById(inputParams.get("id").toString());
}
}
<?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.skyeye.eve.dao.DsFormPageTypeDao">
<select id="queryDsFormPageTypeList" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.type_name typeName,
a.parent_id parentId,
b.user_name createName,
CONVERT(a.create_time, char) createTime,
c.user_name lastUpdateName,
CONVERT(a.last_update_time, char) lastUpdateTime
FROM
ds_form_page_type a
LEFT JOIN sys_eve_user_staff b ON a.create_id = b.user_id
LEFT JOIN sys_eve_user_staff c ON a.last_update_id = c.user_id
WHERE 1 = 1
<if test="typeName != '' and typeName != null">
AND a.type_name LIKE '%${typeName}%'
</if>
ORDER BY a.create_time DESC
</select>
<insert id="insertDsFormPageType" parameterType="java.util.Map">
INSERT INTO ds_form_page_type
(id, type_name, parent_id, create_id, create_time, last_update_id, last_update_time)
VALUES
(#{id}, #{typeName}, #{parentId}, #{userId}, #{createTime}, #{userId}, #{createTime})
</insert>
<select id="queryDsFormPageTypeById" parameterType="java.lang.String" resultType="java.util.Map">
SELECT
a.id,
a.type_name typeName,
a.parent_id parentId,
b.user_name createName,
CONVERT(a.create_time, char) createTime,
c.user_name lastUpdateName,
CONVERT(a.last_update_time, char) lastUpdateTime
FROM
ds_form_page_type a
LEFT JOIN sys_eve_user_staff b ON a.create_id = b.user_id
LEFT JOIN sys_eve_user_staff c ON a.last_update_id = c.user_id
WHERE a.id = #{id}
</select>
<select id="queryDsFormPageTypeByParentIdAndTypeName" parameterType="java.util.Map" resultType="java.lang.String">
SELECT
a.id
FROM
ds_form_page_type a
WHERE a.parent_id = #{parentId} AND a.type_name = #{typeName}
</select>
<select id="queryDsFormPageTypeByParentId" parameterType="java.lang.String" resultType="java.util.Map">
SELECT
a.id,
a.type_name typeName,
a.parent_id parentId,
b.user_name createName,
CONVERT(a.create_time, char) createTime,
c.user_name lastUpdateName,
CONVERT(a.last_update_time, char) lastUpdateTime
FROM
ds_form_page_type a
LEFT JOIN sys_eve_user_staff b ON a.create_id = b.user_id
LEFT JOIN sys_eve_user_staff c ON a.last_update_id = c.user_id
WHERE a.parent_id = #{parentId}
</select>
<update id="updateDsFormPageTypeById" parameterType="java.util.Map">
UPDATE ds_form_page_type
SET
type_name = #{typeName},
parent_id = #{parentId},
last_update_id = #{userId},
last_update_time = #{lastUpdateTime}
WHERE id = #{id}
</update>
<delete id="delDsFormPageTypeById" parameterType="java.lang.String">
DELETE FROM ds_form_page_type
WHERE id = #{id}
</delete>
</mapper>
\ No newline at end of file
......@@ -143,5 +143,31 @@
<property id="rowId" name="pageId" ref="required" var="页面id" />
</url>
<!-- 动态表单系列结束 -->
<!-- 动态表单页面分类开始 -->
<url id="dsformpagetype001" path="/post/DsFormPageTypeController/queryDsFormPageTypeList" method = "POST" val="获取动态表单页面分类列表" allUse="2">
<property id="typeName" name="typeName" ref="" var="分类名称"/>
<property id="limit" name="limit" ref="required,num" var="分页参数,每页多少条数据" />
<property id="page" name="page" ref="required,num" var="分页参数,第几页"/>
</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"/>
</url>
<url id="dsformpagetype003" path="/post/DsFormPageTypeController/delDsFormPageTypeById" method = "DELETE" val="删除动态表单分类" allUse="2">
<property id="id" name="id" ref="required" var="动态表单分类id"/>
</url>
<url id="dsformpagetype004" path="/post/DsFormPageTypeController/queryDsFormPageTypeById" method = "GET" val="根据id查询动态表单页面分类详情" allUse="2">
<property id="id" name="id" ref="required" var="动态表单内容id"/>
</url>
<url id="dsformpagetype005" path="/post/DsFormPageTypeController/updateDsFormPageTypeById" method = "PUT" val="通过id编辑对应的动态表单分类信息" allUse="2">
<property id="id" name="id" ref="required" var="动态表单内容id"/>
<property id="typeName" name="typeName" ref="required" var="分类名称"/>
<property id="parentId" name="parentId" ref="required" var="父id"/>
</url>
<url id="dsformpagetype006" path="/post/DsFormPageTypeController/queryDsFormPageTypeByParentId" method = "GET" val="通过parentId查找对应的动态表单分类列表" allUse="2">
<property id="parentId" name="parentId" ref="required" var="父id"/>
</url>
<!-- 动态表单页面分类结束 -->
</controller>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册