Skip to content

Commit

Permalink
Add questionnaire system
Browse files Browse the repository at this point in the history
  • Loading branch information
tangllty committed Jul 10, 2024
1 parent d91482d commit 2c29ada
Show file tree
Hide file tree
Showing 18 changed files with 1,287 additions and 76 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

* Bump spring-boot-dependencies from 3.3.0 to 3.3.1

### Features

* Add questionnaire system

## 1.6.6

### Bug Fixes
Expand Down
222 changes: 146 additions & 76 deletions databases/20221210.sql

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<module>tang-framework</module>
<module>tang-monitor</module>
<module>tang-starter</module>
<module>tang-survey</module>
<module>tang-system</module>
<module>tang-tool</module>
</modules>
Expand Down Expand Up @@ -309,6 +310,12 @@
<version>${tang.version}</version>
</dependency>

<dependency>
<groupId>com.tang</groupId>
<artifactId>tang-survey</artifactId>
<version>${tang.version}</version>
</dependency>

<dependency>
<groupId>com.tang</groupId>
<artifactId>tang-system</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions tang-admin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
<artifactId>tang-swagger</artifactId>
</dependency>

<dependency>
<groupId>com.tang</groupId>
<artifactId>tang-survey</artifactId>
</dependency>

</dependencies>

<build>
Expand Down
12 changes: 12 additions & 0 deletions tang-commons/src/main/kotlin/com/tang/commons/utils/GenSqlUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,18 @@ object GenSqlUtils {
)),
)),
)),
Menu("调查问卷", "survey", "调查问卷", "调查问卷目录", arrayListOf(
Menu("调查问卷设计", "form", "survey/form/index", "survey:form:menu", "调查问卷", "调查问卷菜单", arrayListOf(
Menu("调查问卷查询", "survey:form:list", "调查问卷查询按钮"),
Menu("调查问卷新增", "survey:form:add", "调查问卷新增按钮"),
Menu("调查问卷修改", "survey:form:edit", "调查问卷修改按钮"),
Menu("调查问卷删除", "survey:form:delete", "调查问卷删除按钮"),
)),
Menu("用户答案", "answer", "survey/answer/index", "survey:answer:menu", "用户答案", "用户答案菜单", arrayListOf(
Menu("用户答案查询", "survey:answer:list", "用户答案查询按钮"),
Menu("用户答案删除", "survey:answer:delete", "用户答案删除按钮"),
)),
)),
)

val parentMenu = Menu()
Expand Down
27 changes: 27 additions & 0 deletions tang-survey/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.tang</groupId>
<artifactId>tang-parent</artifactId>
<version>1.6.6</version>
</parent>

<artifactId>tang-survey</artifactId>

<description>
tang-survey 调查问卷
</description>

<dependencies>

<dependency>
<groupId>com.tang</groupId>
<artifactId>tang-commons</artifactId>
</dependency>

</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
package com.tang.survey.controller

import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.DeleteMapping
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.PutMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

import com.tang.commons.utils.AjaxResult
import com.tang.commons.utils.page.PageResult
import com.tang.commons.utils.page.PageUtils
import com.tang.survey.entity.SurveyForm
import com.tang.survey.service.SurveyFormService

/**
* 调查问卷逻辑控制层
*
* @author Tang
*/
@RestController
@RequestMapping("/survey/form")
class SurveyFormController(private val surveyFormService: SurveyFormService) {

/**
* 查询调查问卷列表
*
* @param surveyForm 调查问卷对象
* @return 调查问卷列表
*/
@PreAuthorize("@auth.hasPermission('survey:form:list')")
@GetMapping("/list")
fun list(surveyForm: SurveyForm): PageResult {
PageUtils.startPage()
val list = surveyFormService.selectSurveyFormList(surveyForm)
return PageUtils.getDataTable(list)
}

/**
* 通过调查问卷主键查询调查问卷信息
*
* @param formId 调查问卷主键
* @return 调查问卷信息
*/
@PreAuthorize("@auth.hasPermission('survey:form:list')")
@GetMapping("/{formId}")
fun selectSurveyFormByFormId(@PathVariable formId: Long): AjaxResult {
val surveyForm = surveyFormService.selectSurveyFormByFormId(formId)
return AjaxResult.success(surveyForm)
}

/**
* 新增调查问卷信息
*
* @param surveyForm 调查问卷信息
* @return 影响行数
*/
@PreAuthorize("@auth.hasPermission('survey:form:add')")
@PostMapping
fun insertSurveyForm(@RequestBody surveyForm: SurveyForm): AjaxResult {
return AjaxResult.rows(surveyFormService.insertSurveyForm(surveyForm))
}

/**
* 通过调查问卷主键修改调查问卷信息
*
* @param surveyForm 调查问卷信息
* @return 影响行数
*/
@PreAuthorize("@auth.hasPermission('survey:form:edit')")
@PutMapping
fun updateSurveyFormByFormId(@RequestBody surveyForm: SurveyForm): AjaxResult {
return AjaxResult.rows(surveyFormService.updateSurveyFormByFormId(surveyForm))
}

/**
* 通过调查问卷主键删除调查问卷信息
*
* @param formId 调查问卷主键
* @return 影响行数
*/
@PreAuthorize("@auth.hasPermission('survey:form:delete')")
@DeleteMapping("/{formId}")
fun deleteSurveyFormByFormId(@PathVariable formId: Long): AjaxResult {
return AjaxResult.rows(surveyFormService.deleteSurveyFormByFormId(formId))
}

/**
* 通过调查问卷主键数组批量删除调查问卷信息
*
* @param formIds 调查问卷主键数组
* @return 影响行数
*/
@PreAuthorize("@auth.hasPermission('survey:form:delete')")
@DeleteMapping
fun deleteSurveyFormByFormIds(@RequestBody formIds: Array<Long>): AjaxResult {
return AjaxResult.rows(surveyFormService.deleteSurveyFormByFormIds(formIds))
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
package com.tang.survey.controller

import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.DeleteMapping
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.PutMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

import com.tang.commons.utils.AjaxResult
import com.tang.commons.utils.page.PageResult
import com.tang.commons.utils.page.PageUtils
import com.tang.survey.entity.SurveyUserAnswer
import com.tang.survey.service.SurveyUserAnswerService

/**
* 调查问卷用户答案逻辑控制层
*
* @author Tang
*/
@RestController
@RequestMapping("/survey/answer")
class SurveyUserAnswerController(private val surveyUserAnswerService: SurveyUserAnswerService) {

/**
* 查询调查问卷用户答案列表
*
* @param surveyUserAnswer 调查问卷用户答案对象
* @return 调查问卷用户答案列表
*/
@PreAuthorize("@auth.hasPermission('survey:answer:list')")
@GetMapping("/list")
fun list(surveyUserAnswer: SurveyUserAnswer): PageResult {
PageUtils.startPage()
val list = surveyUserAnswerService.selectSurveyUserAnswerList(surveyUserAnswer)
return PageUtils.getDataTable(list)
}

/**
* 通过调查问卷用户答案主键查询调查问卷用户答案信息
*
* @param answerId 调查问卷用户答案主键
* @return 调查问卷用户答案信息
*/
@PreAuthorize("@auth.hasPermission('survey:answer:list')")
@GetMapping("/{answerId}")
fun selectSurveyUserAnswerByAnswerId(@PathVariable answerId: Long): AjaxResult {
val surveyUserAnswer = surveyUserAnswerService.selectSurveyUserAnswerByAnswerId(answerId)
return AjaxResult.success(surveyUserAnswer)
}

/**
* 新增调查问卷用户答案信息
*
* @param surveyUserAnswer 调查问卷用户答案信息
* @return 影响行数
*/
@PreAuthorize("@auth.hasPermission('survey:answer:add')")
@PostMapping
fun insertSurveyUserAnswer(@RequestBody surveyUserAnswer: SurveyUserAnswer): AjaxResult {
return AjaxResult.rows(surveyUserAnswerService.insertSurveyUserAnswer(surveyUserAnswer))
}

/**
* 通过调查问卷用户答案主键修改调查问卷用户答案信息
*
* @param surveyUserAnswer 调查问卷用户答案信息
* @return 影响行数
*/
@PreAuthorize("@auth.hasPermission('survey:answer:edit')")
@PutMapping
fun updateSurveyUserAnswerByAnswerId(@RequestBody surveyUserAnswer: SurveyUserAnswer): AjaxResult {
return AjaxResult.rows(surveyUserAnswerService.updateSurveyUserAnswerByAnswerId(surveyUserAnswer))
}

/**
* 通过调查问卷用户答案主键删除调查问卷用户答案信息
*
* @param answerId 调查问卷用户答案主键
* @return 影响行数
*/
@PreAuthorize("@auth.hasPermission('survey:answer:delete')")
@DeleteMapping("/{answerId}")
fun deleteSurveyUserAnswerByAnswerId(@PathVariable answerId: Long): AjaxResult {
return AjaxResult.rows(surveyUserAnswerService.deleteSurveyUserAnswerByAnswerId(answerId))
}

/**
* 通过调查问卷用户答案主键数组批量删除调查问卷用户答案信息
*
* @param answerIds 调查问卷用户答案主键数组
* @return 影响行数
*/
@PreAuthorize("@auth.hasPermission('survey:answer:delete')")
@DeleteMapping
fun deleteSurveyUserAnswerByAnswerIds(@RequestBody answerIds: Array<Long>): AjaxResult {
return AjaxResult.rows(surveyUserAnswerService.deleteSurveyUserAnswerByAnswerIds(answerIds))
}

}
62 changes: 62 additions & 0 deletions tang-survey/src/main/kotlin/com/tang/survey/entity/SurveyForm.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package com.tang.survey.entity

import java.time.LocalDate
import java.time.LocalDateTime

import org.apache.commons.lang3.StringUtils

import com.tang.commons.base.entity.BaseEntity

/**
* 调查问卷实体类 qs_survey_form
*
* @author Tang
*/
class SurveyForm : BaseEntity() {

companion object {
@java.io.Serial
private val serialVersionUID = 1L
}

/**
* 问卷ID
*/
var formId: Long? = null

/**
* 问卷编码
*/
var formCode: Long? = null

/**
* 问卷名称
*/
var formName: String? = null

/**
* 问卷数据
*/
var formData: String? = null

/**
* 发布状态{0=未发布, 1=已发布}
*/
var publishStatus: String? = null

/**
* 发布时间
*/
var publishTime: LocalDateTime? = null

/**
* 关闭时间
*/
var closeTime: LocalDateTime? = null

/**
* 状态{0=正常, 1=停用}
*/
var status: String? = null

}
Loading

0 comments on commit 2c29ada

Please sign in to comment.