新增表单管理模块
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.gxwebsoft.cms.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.gxwebsoft.cms.entity.Article;
|
||||
import com.gxwebsoft.cms.entity.ArticleCategory;
|
||||
@@ -9,13 +8,18 @@ import com.gxwebsoft.cms.param.ArticleParam;
|
||||
import com.gxwebsoft.cms.service.ArticleCategoryService;
|
||||
import com.gxwebsoft.cms.service.ArticleContentService;
|
||||
import com.gxwebsoft.cms.service.ArticleService;
|
||||
import com.gxwebsoft.common.core.web.*;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -92,6 +96,7 @@ public class ArticleController extends BaseController {
|
||||
}
|
||||
|
||||
@ApiOperation("添加文章记录表")
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody Article article) {
|
||||
// 记录当前登录用户id
|
||||
@@ -114,14 +119,22 @@ public class ArticleController extends BaseController {
|
||||
}
|
||||
|
||||
@ApiOperation("修改文章记录表")
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody Article article) {
|
||||
if (articleService.updateById(article)) {
|
||||
article.setUpdateTime(DateUtil.date());
|
||||
articleService.updateById(article);
|
||||
// 更新文章内容
|
||||
ArticleContent content = articleContentService.getById(article.getArticleId());
|
||||
ArticleContent content = new ArticleContent();
|
||||
content.setArticleId(article.getArticleId());
|
||||
content.setContent(article.getContent());
|
||||
if(articleContentService.count(new LambdaQueryWrapper<ArticleContent>().eq(ArticleContent::getArticleId,article.getArticleId())) > 0){
|
||||
articleContentService.updateById(content);
|
||||
}else {
|
||||
articleContentService.save(content);
|
||||
}
|
||||
// 更新时间
|
||||
article.setUpdateTime(new Date());
|
||||
articleService.updateById(article);
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.gxwebsoft.cms.controller;
|
||||
|
||||
import com.gxwebsoft.cms.entity.Form;
|
||||
import com.gxwebsoft.cms.param.FormParam;
|
||||
import com.gxwebsoft.cms.service.FormService;
|
||||
import com.gxwebsoft.common.core.web.*;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 表单设计表控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-03-14 08:59:33
|
||||
*/
|
||||
@Api(tags = "表单设计表管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/cms/form")
|
||||
public class FormController extends BaseController {
|
||||
@Resource
|
||||
private FormService formService;
|
||||
|
||||
@ApiOperation("分页查询表单设计表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<Form>> page(FormParam param) {
|
||||
// 使用关联查询
|
||||
return success(formService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部表单设计表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<Form>> list(FormParam param) {
|
||||
// 使用关联查询
|
||||
return success(formService.listRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询表单设计表")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<Form> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(formService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加表单设计表")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody Form form) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
form.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (formService.save(form)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改表单设计表")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody Form form) {
|
||||
if (formService.updateById(form)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除表单设计表")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (formService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加表单设计表")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<Form> list) {
|
||||
if (formService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改表单设计表")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<Form> batchParam) {
|
||||
if (batchParam.update(formService, "form_id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除表单设计表")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (formService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.gxwebsoft.cms.controller;
|
||||
|
||||
import com.gxwebsoft.cms.entity.FormRecord;
|
||||
import com.gxwebsoft.cms.param.FormRecordParam;
|
||||
import com.gxwebsoft.cms.service.FormRecordService;
|
||||
import com.gxwebsoft.common.core.web.*;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 表单数据记录表控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-03-14 08:59:33
|
||||
*/
|
||||
@Api(tags = "表单数据记录表管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/cms/form-record")
|
||||
public class FormRecordController extends BaseController {
|
||||
@Resource
|
||||
private FormRecordService formRecordService;
|
||||
|
||||
@ApiOperation("分页查询表单数据记录表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<FormRecord>> page(FormRecordParam param) {
|
||||
// 使用关联查询
|
||||
return success(formRecordService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部表单数据记录表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<FormRecord>> list(FormRecordParam param) {
|
||||
// 使用关联查询
|
||||
return success(formRecordService.listRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询表单数据记录表")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<FormRecord> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(formRecordService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加表单数据记录表")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody FormRecord formRecord) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
formRecord.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (formRecordService.save(formRecord)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改表单数据记录表")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody FormRecord formRecord) {
|
||||
if (formRecordService.updateById(formRecord)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除表单数据记录表")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (formRecordService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加表单数据记录表")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<FormRecord> list) {
|
||||
if (formRecordService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改表单数据记录表")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<FormRecord> batchParam) {
|
||||
if (batchParam.update(formRecordService, "form_record_id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除表单数据记录表")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (formRecordService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.gxwebsoft.cms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -23,6 +25,7 @@ public class ArticleContent implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "文章ID")
|
||||
@TableId(value = "article_id", type = IdType.AUTO)
|
||||
private Integer articleId;
|
||||
|
||||
@ApiModelProperty(value = "文章内容")
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.gxwebsoft.cms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 表单设计表
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-03-14 08:59:33
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "Form对象", description = "表单设计表")
|
||||
@TableName("cms_form")
|
||||
public class Form implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
@TableId(value = "form_id", type = IdType.AUTO)
|
||||
private Integer formId;
|
||||
|
||||
@ApiModelProperty(value = "表单标题")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "顶部图片")
|
||||
private String photo;
|
||||
|
||||
@ApiModelProperty(value = "背景图片")
|
||||
private String background;
|
||||
|
||||
@ApiModelProperty(value = "提交次数")
|
||||
private Integer submitNumber;
|
||||
|
||||
@ApiModelProperty(value = "页面布局")
|
||||
private String layout;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.gxwebsoft.cms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 表单数据记录表
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-03-14 08:59:33
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "FormRecord对象", description = "表单数据记录表")
|
||||
@TableName("cms_form_record")
|
||||
public class FormRecord implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
@TableId(value = "form_record_id", type = IdType.AUTO)
|
||||
private Integer formRecordId;
|
||||
|
||||
@ApiModelProperty(value = "表单ID")
|
||||
private Integer formId;
|
||||
|
||||
@ApiModelProperty(value = "表单数据")
|
||||
private String formData;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "表单名称")
|
||||
@TableField(exist = false)
|
||||
private String formName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.cms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.cms.entity.Form;
|
||||
import com.gxwebsoft.cms.param.FormParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 表单设计表Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-03-14 08:59:33
|
||||
*/
|
||||
public interface FormMapper extends BaseMapper<Form> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<Form>
|
||||
*/
|
||||
List<Form> selectPageRel(@Param("page") IPage<Form> page,
|
||||
@Param("param") FormParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<Form> selectListRel(@Param("param") FormParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.cms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.cms.entity.FormRecord;
|
||||
import com.gxwebsoft.cms.param.FormRecordParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 表单数据记录表Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-03-14 08:59:33
|
||||
*/
|
||||
public interface FormRecordMapper extends BaseMapper<FormRecord> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<FormRecord>
|
||||
*/
|
||||
List<FormRecord> selectPageRel(@Param("page") IPage<FormRecord> page,
|
||||
@Param("param") FormRecordParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<FormRecord> selectListRel(@Param("param") FormRecordParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?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.gxwebsoft.cms.mapper.FormMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
FROM cms_form a
|
||||
<where>
|
||||
<if test="param.formId != null">
|
||||
AND a.form_id = #{param.formId}
|
||||
</if>
|
||||
<if test="param.name != null">
|
||||
AND a.name LIKE CONCAT('%', #{param.name}, '%')
|
||||
</if>
|
||||
<if test="param.photo != null">
|
||||
AND a.photo LIKE CONCAT('%', #{param.photo}, '%')
|
||||
</if>
|
||||
<if test="param.background != null">
|
||||
AND a.background LIKE CONCAT('%', #{param.background}, '%')
|
||||
</if>
|
||||
<if test="param.submitNumber != null">
|
||||
AND a.submit_number = #{param.submitNumber}
|
||||
</if>
|
||||
<if test="param.layout != null">
|
||||
AND a.layout LIKE CONCAT('%', #{param.layout}, '%')
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.sortNumber != null">
|
||||
AND a.sort_number = #{param.sortNumber}
|
||||
</if>
|
||||
<if test="param.comments != null">
|
||||
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
|
||||
</if>
|
||||
<if test="param.status != null">
|
||||
AND a.status = #{param.status}
|
||||
</if>
|
||||
<if test="param.createTimeStart != null">
|
||||
AND a.create_time >= #{param.createTimeStart}
|
||||
</if>
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.cms.entity.Form">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.cms.entity.Form">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,51 @@
|
||||
<?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.gxwebsoft.cms.mapper.FormRecordMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*,b.name as formName
|
||||
FROM cms_form_record a
|
||||
LEFT JOIN cms_form b ON a.form_id = b.form_id
|
||||
<where>
|
||||
<if test="param.formRecordId != null">
|
||||
AND a.form_record_id = #{param.formRecordId}
|
||||
</if>
|
||||
<if test="param.formId != null">
|
||||
AND a.form_id = #{param.formId}
|
||||
</if>
|
||||
<if test="param.formData != null">
|
||||
AND a.form_data LIKE CONCAT('%', #{param.formData}, '%')
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.sortNumber != null">
|
||||
AND a.sort_number = #{param.sortNumber}
|
||||
</if>
|
||||
<if test="param.comments != null">
|
||||
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
|
||||
</if>
|
||||
<if test="param.status != null">
|
||||
AND a.status = #{param.status}
|
||||
</if>
|
||||
<if test="param.createTimeStart != null">
|
||||
AND a.create_time >= #{param.createTimeStart}
|
||||
</if>
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.cms.entity.FormRecord">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.cms.entity.FormRecord">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.gxwebsoft.cms.param;
|
||||
|
||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||
import com.gxwebsoft.common.core.web.BaseParam;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 表单设计表查询参数
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-03-14 08:59:33
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(value = "FormParam对象", description = "表单设计表查询参数")
|
||||
public class FormParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer formId;
|
||||
|
||||
@ApiModelProperty(value = "表单标题")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "顶部图片")
|
||||
private String photo;
|
||||
|
||||
@ApiModelProperty(value = "背景图片")
|
||||
private String background;
|
||||
|
||||
@ApiModelProperty(value = "提交次数")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer submitNumber;
|
||||
|
||||
@ApiModelProperty(value = "页面布局")
|
||||
private String layout;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.gxwebsoft.cms.param;
|
||||
|
||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||
import com.gxwebsoft.common.core.web.BaseParam;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 表单数据记录表查询参数
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-03-14 08:59:33
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(value = "FormRecordParam对象", description = "表单数据记录表查询参数")
|
||||
public class FormRecordParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer formRecordId;
|
||||
|
||||
@ApiModelProperty(value = "表单ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer formId;
|
||||
|
||||
@ApiModelProperty(value = "表单数据")
|
||||
private String formData;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.gxwebsoft.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.cms.entity.FormRecord;
|
||||
import com.gxwebsoft.cms.param.FormRecordParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 表单数据记录表Service
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-03-14 08:59:33
|
||||
*/
|
||||
public interface FormRecordService extends IService<FormRecord> {
|
||||
|
||||
/**
|
||||
* 分页关联查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return PageResult<FormRecord>
|
||||
*/
|
||||
PageResult<FormRecord> pageRel(FormRecordParam param);
|
||||
|
||||
/**
|
||||
* 关联查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<FormRecord>
|
||||
*/
|
||||
List<FormRecord> listRel(FormRecordParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param formRecordId ID
|
||||
* @return FormRecord
|
||||
*/
|
||||
FormRecord getByIdRel(Integer formRecordId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.gxwebsoft.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.cms.entity.Form;
|
||||
import com.gxwebsoft.cms.param.FormParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 表单设计表Service
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-03-14 08:59:33
|
||||
*/
|
||||
public interface FormService extends IService<Form> {
|
||||
|
||||
/**
|
||||
* 分页关联查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return PageResult<Form>
|
||||
*/
|
||||
PageResult<Form> pageRel(FormParam param);
|
||||
|
||||
/**
|
||||
* 关联查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<Form>
|
||||
*/
|
||||
List<Form> listRel(FormParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param formId ID
|
||||
* @return Form
|
||||
*/
|
||||
Form getByIdRel(Integer formId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.gxwebsoft.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.cms.mapper.FormRecordMapper;
|
||||
import com.gxwebsoft.cms.service.FormRecordService;
|
||||
import com.gxwebsoft.cms.entity.FormRecord;
|
||||
import com.gxwebsoft.cms.param.FormRecordParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 表单数据记录表Service实现
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-03-14 08:59:33
|
||||
*/
|
||||
@Service
|
||||
public class FormRecordServiceImpl extends ServiceImpl<FormRecordMapper, FormRecord> implements FormRecordService {
|
||||
|
||||
@Override
|
||||
public PageResult<FormRecord> pageRel(FormRecordParam param) {
|
||||
PageParam<FormRecord, FormRecordParam> page = new PageParam<>(param);
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
List<FormRecord> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FormRecord> listRel(FormRecordParam param) {
|
||||
List<FormRecord> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<FormRecord, FormRecordParam> page = new PageParam<>();
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FormRecord getByIdRel(Integer formRecordId) {
|
||||
FormRecordParam param = new FormRecordParam();
|
||||
param.setFormRecordId(formRecordId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.gxwebsoft.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.cms.mapper.FormMapper;
|
||||
import com.gxwebsoft.cms.service.FormService;
|
||||
import com.gxwebsoft.cms.entity.Form;
|
||||
import com.gxwebsoft.cms.param.FormParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 表单设计表Service实现
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-03-14 08:59:33
|
||||
*/
|
||||
@Service
|
||||
public class FormServiceImpl extends ServiceImpl<FormMapper, Form> implements FormService {
|
||||
|
||||
@Override
|
||||
public PageResult<Form> pageRel(FormParam param) {
|
||||
PageParam<Form, FormParam> page = new PageParam<>(param);
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
List<Form> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Form> listRel(FormParam param) {
|
||||
List<Form> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<Form, FormParam> page = new PageParam<>();
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Form getByIdRel(Integer formId) {
|
||||
FormParam param = new FormParam();
|
||||
param.setFormId(formId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -54,6 +54,8 @@ public class CmsGenerator {
|
||||
// "cms_design_record",
|
||||
// "cms_website",
|
||||
// "cms_website_field",
|
||||
"cms_form",
|
||||
"cms_form_record"
|
||||
};
|
||||
// 需要去除的表前缀
|
||||
private static final String[] TABLE_PREFIX = new String[]{
|
||||
|
||||
Reference in New Issue
Block a user