From 7c79540cfc9a815da9141120096ac387e793f1ad Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Tue, 25 Jan 2022 08:55:04 +0800
Subject: [PATCH] 1投票

---
 src/main/java/org/springblade/modules/option/service/IOptionService.java                 |   44 +
 src/main/java/org/springblade/modules/useroption/entity/Useroption.java                  |   57 ++
 src/main/java/org/springblade/modules/vote/entity/Vote.java                              |   78 +++
 src/main/java/org/springblade/modules/option/controller/OptionController.java            |  126 +++++
 src/main/java/org/springblade/modules/option/mapper/OptionMapper.java                    |   44 +
 src/main/java/org/springblade/modules/useroption/controller/UseroptionController.java    |  151 ++++++
 src/main/java/org/springblade/modules/useroption/vo/UseroptionVO.java                    |   36 +
 src/main/java/org/springblade/modules/option/dto/OptionDTO.java                          |   34 +
 src/main/java/org/springblade/modules/option/vo/OptionVO.java                            |   36 +
 src/main/java/org/springblade/modules/vote/controller/VoteController.java                |  193 ++++++++
 src/main/java/org/springblade/modules/vote/dto/VoteDTO.java                              |   34 +
 src/main/java/org/springblade/modules/vote/service/IVoteService.java                     |   44 +
 src/main/java/org/springblade/modules/vote/mapper/VoteMapper.xml                         |   40 +
 src/main/java/org/springblade/modules/useroption/mapper/UseroptionMapper.xml             |   26 +
 src/main/java/org/springblade/modules/vote/vo/VoteVO.java                                |   36 +
 src/main/java/org/springblade/modules/option/service/impl/OptionServiceImpl.java         |   48 ++
 src/main/java/org/springblade/modules/vote/mapper/VoteMapper.java                        |   44 +
 src/main/java/org/springblade/modules/vote/service/impl/VoteServiceImpl.java             |   49 ++
 src/main/java/org/springblade/modules/useroption/mapper/UseroptionMapper.java            |   44 +
 src/main/java/org/springblade/modules/option/mapper/OptionMapper.xml                     |   23 +
 src/main/java/org/springblade/modules/useroption/service/IUseroptionService.java         |   41 +
 src/main/java/org/springblade/modules/useroption/service/impl/UseroptionServiceImpl.java |   46 ++
 src/main/java/org/springblade/modules/useroption/dto/UseroptionDTO.java                  |   34 +
 src/main/java/org/springblade/common/config/BladeConfiguration.java                      |    2 
 src/main/java/org/springblade/modules/option/entity/Option.java                          |   60 ++
 25 files changed, 1,370 insertions(+), 0 deletions(-)

diff --git a/src/main/java/org/springblade/common/config/BladeConfiguration.java b/src/main/java/org/springblade/common/config/BladeConfiguration.java
index 45a60ee..1b0b95c 100644
--- a/src/main/java/org/springblade/common/config/BladeConfiguration.java
+++ b/src/main/java/org/springblade/common/config/BladeConfiguration.java
@@ -108,6 +108,8 @@
 		secureRegistry.excludePathPatterns("/integral/**");
 		secureRegistry.excludePathPatterns("/organ/**");
 		secureRegistry.excludePathPatterns("/policy/**");
+		secureRegistry.excludePathPatterns("/vote/vote/**");
+		secureRegistry.excludePathPatterns("/useroption/useroption/**");
 		return secureRegistry;
 	}
 
diff --git a/src/main/java/org/springblade/modules/option/controller/OptionController.java b/src/main/java/org/springblade/modules/option/controller/OptionController.java
new file mode 100644
index 0000000..801ad8f
--- /dev/null
+++ b/src/main/java/org/springblade/modules/option/controller/OptionController.java
@@ -0,0 +1,126 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.option.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.modules.option.entity.Option;
+import org.springblade.modules.option.service.IOptionService;
+import org.springblade.modules.option.vo.OptionVO;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+
+/**
+ *  控制器
+ *
+ * @author BladeX
+ * @since 2022-01-24
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("option/option")
+@Api(value = "", tags = "接口")
+public class OptionController extends BladeController {
+
+	private final IOptionService optionService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入option")
+	public R<Option> detail(Option option) {
+		Option detail = optionService.getOne(Condition.getQueryWrapper(option));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入option")
+	public R<IPage<Option>> list(Option option, Query query) {
+		IPage<Option> pages = optionService.page(Condition.getPage(query), Condition.getQueryWrapper(option));
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入option")
+	public R<IPage<OptionVO>> page(OptionVO option, Query query) {
+		IPage<OptionVO> pages = optionService.selectOptionPage(Condition.getPage(query), option);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入option")
+	public R save(@Valid @RequestBody Option option) {
+		return R.status(optionService.save(option));
+	}
+
+	/**
+	 * 修改
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入option")
+	public R update(@Valid @RequestBody Option option) {
+		return R.status(optionService.updateById(option));
+	}
+
+	/**
+	 * 新增或修改
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入option")
+	public R submit(@Valid @RequestBody Option option) {
+		return R.status(optionService.saveOrUpdate(option));
+	}
+
+
+	/**
+	 * 删除
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(optionService.removeByIds(Func.toLongList(ids)));
+	}
+
+
+}
diff --git a/src/main/java/org/springblade/modules/option/dto/OptionDTO.java b/src/main/java/org/springblade/modules/option/dto/OptionDTO.java
new file mode 100644
index 0000000..43a909d
--- /dev/null
+++ b/src/main/java/org/springblade/modules/option/dto/OptionDTO.java
@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.option.dto;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.option.entity.Option;
+
+/**
+ * 数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2022-01-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class OptionDTO extends Option {
+	private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/option/entity/Option.java b/src/main/java/org/springblade/modules/option/entity/Option.java
new file mode 100644
index 0000000..590fff6
--- /dev/null
+++ b/src/main/java/org/springblade/modules/option/entity/Option.java
@@ -0,0 +1,60 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.option.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 java.io.Serializable;
+
+/**
+ * 实体类
+ *
+ * @author BladeX
+ * @since 2022-01-24
+ */
+@Data
+@TableName("sys_option")
+@ApiModel(value = "Option对象", description = "Option对象")
+public class Option implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+	@TableId(value = "id", type = IdType.AUTO)
+	private Integer id;
+	/**
+	* 投票id
+	*/
+		@ApiModelProperty(value = "投票id")
+		private Integer voteid;
+	/**
+	* 选项名称
+	*/
+		@ApiModelProperty(value = "选项名称")
+		private String optionname;
+	/**
+	* 选项类型
+	*/
+		@ApiModelProperty(value = "选项类型")
+		private Integer optiontype;
+		private Integer num;
+
+
+}
diff --git a/src/main/java/org/springblade/modules/option/mapper/OptionMapper.java b/src/main/java/org/springblade/modules/option/mapper/OptionMapper.java
new file mode 100644
index 0000000..3c41016
--- /dev/null
+++ b/src/main/java/org/springblade/modules/option/mapper/OptionMapper.java
@@ -0,0 +1,44 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.option.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.modules.option.entity.Option;
+import org.springblade.modules.option.vo.OptionVO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ *  Mapper 接口
+ *
+ * @author BladeX
+ * @since 2022-01-24
+ */
+public interface OptionMapper extends BaseMapper<Option> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param option
+	 * @return
+	 */
+	List<OptionVO> selectOptionPage(IPage page, OptionVO option);
+	void update(Integer num,Integer voteid,Integer optiontype);
+}
diff --git a/src/main/java/org/springblade/modules/option/mapper/OptionMapper.xml b/src/main/java/org/springblade/modules/option/mapper/OptionMapper.xml
new file mode 100644
index 0000000..329b5d8
--- /dev/null
+++ b/src/main/java/org/springblade/modules/option/mapper/OptionMapper.xml
@@ -0,0 +1,23 @@
+<?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="org.springblade.modules.option.mapper.OptionMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="optionResultMap" type="org.springblade.modules.option.entity.Option">
+        <id column="id" property="id"/>
+        <result column="voteid" property="voteid"/>
+        <result column="optionname" property="optionname"/>
+        <result column="optiontype" property="optiontype"/>
+    </resultMap>
+
+
+    <select id="selectOptionPage" resultMap="optionResultMap">
+        select *
+        from sys_option
+        where is_deleted = 0
+    </select>
+
+    <update id="update">
+        update sys_option set num=#{num} where voteid=#{voteid} and  optiontype=#{optiontype}
+    </update>
+</mapper>
diff --git a/src/main/java/org/springblade/modules/option/service/IOptionService.java b/src/main/java/org/springblade/modules/option/service/IOptionService.java
new file mode 100644
index 0000000..4db0631
--- /dev/null
+++ b/src/main/java/org/springblade/modules/option/service/IOptionService.java
@@ -0,0 +1,44 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.option.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springblade.modules.option.entity.Option;
+import org.springblade.modules.option.vo.OptionVO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ *  服务类
+ *
+ * @author BladeX
+ * @since 2022-01-24
+ */
+public interface IOptionService extends IService<Option> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param option
+	 * @return
+	 */
+	IPage<OptionVO> selectOptionPage(IPage<OptionVO> page, OptionVO option);
+	void update(Integer num,Integer voteid,Integer optiontype);
+}
diff --git a/src/main/java/org/springblade/modules/option/service/impl/OptionServiceImpl.java b/src/main/java/org/springblade/modules/option/service/impl/OptionServiceImpl.java
new file mode 100644
index 0000000..96cd4c4
--- /dev/null
+++ b/src/main/java/org/springblade/modules/option/service/impl/OptionServiceImpl.java
@@ -0,0 +1,48 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.option.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.modules.option.entity.Option;
+import org.springblade.modules.option.mapper.OptionMapper;
+import org.springblade.modules.option.service.IOptionService;
+import org.springblade.modules.option.vo.OptionVO;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ *  服务实现类
+ *
+ * @author BladeX
+ * @since 2022-01-24
+ */
+@Service
+public class OptionServiceImpl extends ServiceImpl<OptionMapper, Option> implements IOptionService {
+
+	@Override
+	public IPage<OptionVO> selectOptionPage(IPage<OptionVO> page, OptionVO option) {
+		return page.setRecords(baseMapper.selectOptionPage(page, option));
+	}
+
+	@Override
+	public void update(Integer num, Integer voteid, Integer optiontype) {
+		baseMapper.update(num, voteid, optiontype);
+	}
+}
diff --git a/src/main/java/org/springblade/modules/option/vo/OptionVO.java b/src/main/java/org/springblade/modules/option/vo/OptionVO.java
new file mode 100644
index 0000000..d880d91
--- /dev/null
+++ b/src/main/java/org/springblade/modules/option/vo/OptionVO.java
@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.option.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.option.entity.Option;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2022-01-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "OptionVO对象", description = "OptionVO对象")
+public class OptionVO extends Option {
+	private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/useroption/controller/UseroptionController.java b/src/main/java/org/springblade/modules/useroption/controller/UseroptionController.java
new file mode 100644
index 0000000..125b4a6
--- /dev/null
+++ b/src/main/java/org/springblade/modules/useroption/controller/UseroptionController.java
@@ -0,0 +1,151 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.useroption.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.bstek.ureport.expression.model.Op;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.modules.option.entity.Option;
+import org.springblade.modules.option.service.IOptionService;
+import org.springblade.modules.useroption.entity.Useroption;
+import org.springblade.modules.useroption.service.IUseroptionService;
+import org.springblade.modules.useroption.vo.UseroptionVO;
+import org.springblade.modules.vote.entity.Vote;
+import org.springblade.modules.vote.service.IVoteService;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 控制器
+ * 用户投票表
+ *
+ * @author BladeX
+ * @since 2022-01-24
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("useroption/useroption")
+@Api(value = "", tags = "接口")
+public class UseroptionController extends BladeController {
+
+	private final IUseroptionService useroptionService;
+	private final IVoteService voteService;
+	private final IOptionService optionService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入useroption")
+	public R<Useroption> detail(Useroption useroption) {
+		Useroption detail = useroptionService.getOne(Condition.getQueryWrapper(useroption));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入useroption")
+	public R<IPage<Useroption>> list(Useroption useroption, Query query) {
+		IPage<Useroption> pages = useroptionService.page(Condition.getPage(query), Condition.getQueryWrapper(useroption));
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入useroption")
+	public R<IPage<UseroptionVO>> page(UseroptionVO useroption, Query query) {
+		IPage<UseroptionVO> pages = useroptionService.selectUseroptionPage(Condition.getPage(query), useroption);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入useroption")
+	public R save(@Valid @RequestBody Useroption useroption) {
+		return R.status(useroptionService.save(useroption));
+	}
+
+	/**
+	 * 修改
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入useroption")
+	public R update(@Valid @RequestBody Useroption useroption) {
+		return R.status(useroptionService.updateById(useroption));
+	}
+
+	/**
+	 * 新增或修改
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入useroption")
+	public R submit(@Valid @RequestBody Useroption useroption) {
+		return R.status(useroptionService.saveOrUpdate(useroption));
+	}
+
+
+	/**
+	 * 删除
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(useroptionService.removeByIds(Func.toLongList(ids)));
+	}
+
+
+	@PostMapping("/sav")
+	public R sav(@Valid @RequestBody Useroption useroption) {
+		Integer voteid = useroption.getVoteid();
+		Vote vote = new Vote();
+		vote.setId(voteid);
+		Vote one = voteService.getOne(Condition.getQueryWrapper(vote));
+		Integer npeople = one.getNpeople() + 1;
+		one.setNpeople(npeople);
+		voteService.updateById(one);
+		//投票选择表调整选择次数
+		Integer num = useroptionService.selectInfo(voteid, useroption.getUseroption());
+		int i = num + 1;
+		optionService.update(i, voteid, useroption.getUseroption());
+		return R.status(useroptionService.save(useroption));
+	}
+}
diff --git a/src/main/java/org/springblade/modules/useroption/dto/UseroptionDTO.java b/src/main/java/org/springblade/modules/useroption/dto/UseroptionDTO.java
new file mode 100644
index 0000000..c2e50d2
--- /dev/null
+++ b/src/main/java/org/springblade/modules/useroption/dto/UseroptionDTO.java
@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.useroption.dto;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.useroption.entity.Useroption;
+
+/**
+ * 数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2022-01-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class UseroptionDTO extends Useroption {
+	private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/useroption/entity/Useroption.java b/src/main/java/org/springblade/modules/useroption/entity/Useroption.java
new file mode 100644
index 0000000..cfda151
--- /dev/null
+++ b/src/main/java/org/springblade/modules/useroption/entity/Useroption.java
@@ -0,0 +1,57 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.useroption.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 io.swagger.models.auth.In;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 实体类
+ *
+ * @author BladeX
+ * @since 2022-01-24
+ */
+@Data
+@TableName("sys_useroption")
+@ApiModel(value = "Useroption对象", description = "Useroption对象")
+public class Useroption implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+	@TableId(value = "id", type = IdType.AUTO)
+	private Integer id;
+	/**
+	 * 用户id
+	 */
+	@ApiModelProperty(value = "用户id")
+	private Integer userid;
+	/**
+	 * 用户选择的值
+	 */
+	@ApiModelProperty(value = "用户选择的值")
+	private Integer useroption;
+	private String optioname;
+	private Integer voteid;
+
+
+}
diff --git a/src/main/java/org/springblade/modules/useroption/mapper/UseroptionMapper.java b/src/main/java/org/springblade/modules/useroption/mapper/UseroptionMapper.java
new file mode 100644
index 0000000..1d9b954
--- /dev/null
+++ b/src/main/java/org/springblade/modules/useroption/mapper/UseroptionMapper.java
@@ -0,0 +1,44 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.useroption.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import io.swagger.models.auth.In;
+import org.springblade.modules.useroption.entity.Useroption;
+import org.springblade.modules.useroption.vo.UseroptionVO;
+
+import java.util.List;
+
+/**
+ *  Mapper 接口
+ *
+ * @author BladeX
+ * @since 2022-01-24
+ */
+public interface UseroptionMapper extends BaseMapper<Useroption> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param useroption
+	 * @return
+	 */
+	List<UseroptionVO> selectUseroptionPage(IPage page, UseroptionVO useroption);
+   	Integer selectInfo(Integer voteid, Integer optiontype);
+}
diff --git a/src/main/java/org/springblade/modules/useroption/mapper/UseroptionMapper.xml b/src/main/java/org/springblade/modules/useroption/mapper/UseroptionMapper.xml
new file mode 100644
index 0000000..6cf018f
--- /dev/null
+++ b/src/main/java/org/springblade/modules/useroption/mapper/UseroptionMapper.xml
@@ -0,0 +1,26 @@
+<?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="org.springblade.modules.useroption.mapper.UseroptionMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="useroptionResultMap" type="org.springblade.modules.useroption.entity.Useroption">
+        <id column="id" property="id"/>
+        <result column="userid" property="userid"/>
+        <result column="useroption" property="useroption"/>
+    </resultMap>
+
+
+    <select id="selectUseroptionPage" resultMap="useroptionResultMap">
+        select *
+        from sys_useroption
+        where is_deleted = 0
+    </select>
+
+    <select id="selectInfo" resultType="java.lang.Integer">
+        SELECT num
+        FROM sys_option
+        WHERE voteid = #{voteid}
+          AND optiontype = #{optiontype}
+    </select>
+
+</mapper>
diff --git a/src/main/java/org/springblade/modules/useroption/service/IUseroptionService.java b/src/main/java/org/springblade/modules/useroption/service/IUseroptionService.java
new file mode 100644
index 0000000..89621a8
--- /dev/null
+++ b/src/main/java/org/springblade/modules/useroption/service/IUseroptionService.java
@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.useroption.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springblade.modules.useroption.entity.Useroption;
+import org.springblade.modules.useroption.vo.UseroptionVO;
+
+/**
+ *  服务类
+ *
+ * @author BladeX
+ * @since 2022-01-24
+ */
+public interface IUseroptionService extends IService<Useroption> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param useroption
+	 * @return
+	 */
+	IPage<UseroptionVO> selectUseroptionPage(IPage<UseroptionVO> page, UseroptionVO useroption);
+	Integer selectInfo(Integer voteid, Integer optiontype);
+}
diff --git a/src/main/java/org/springblade/modules/useroption/service/impl/UseroptionServiceImpl.java b/src/main/java/org/springblade/modules/useroption/service/impl/UseroptionServiceImpl.java
new file mode 100644
index 0000000..0455820
--- /dev/null
+++ b/src/main/java/org/springblade/modules/useroption/service/impl/UseroptionServiceImpl.java
@@ -0,0 +1,46 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.useroption.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.modules.useroption.entity.Useroption;
+import org.springblade.modules.useroption.mapper.UseroptionMapper;
+import org.springblade.modules.useroption.service.IUseroptionService;
+import org.springblade.modules.useroption.vo.UseroptionVO;
+import org.springframework.stereotype.Service;
+
+/**
+ *  服务实现类
+ *
+ * @author BladeX
+ * @since 2022-01-24
+ */
+@Service
+public class UseroptionServiceImpl extends ServiceImpl<UseroptionMapper, Useroption> implements IUseroptionService {
+
+	@Override
+	public IPage<UseroptionVO> selectUseroptionPage(IPage<UseroptionVO> page, UseroptionVO useroption) {
+		return page.setRecords(baseMapper.selectUseroptionPage(page, useroption));
+	}
+
+	@Override
+	public Integer selectInfo(Integer voteid, Integer optiontype) {
+		return baseMapper.selectInfo(voteid, optiontype);
+	}
+
+}
diff --git a/src/main/java/org/springblade/modules/useroption/vo/UseroptionVO.java b/src/main/java/org/springblade/modules/useroption/vo/UseroptionVO.java
new file mode 100644
index 0000000..1b45750
--- /dev/null
+++ b/src/main/java/org/springblade/modules/useroption/vo/UseroptionVO.java
@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.useroption.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.useroption.entity.Useroption;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2022-01-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "UseroptionVO对象", description = "UseroptionVO对象")
+public class UseroptionVO extends Useroption {
+	private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/vote/controller/VoteController.java b/src/main/java/org/springblade/modules/vote/controller/VoteController.java
new file mode 100644
index 0000000..102d123
--- /dev/null
+++ b/src/main/java/org/springblade/modules/vote/controller/VoteController.java
@@ -0,0 +1,193 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.vote.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.google.common.reflect.TypeToken;
+import com.google.gson.Gson;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.modules.option.entity.Option;
+import org.springblade.modules.option.service.IOptionService;
+import org.springblade.modules.vote.entity.Vote;
+import org.springblade.modules.vote.service.IVoteService;
+import org.springblade.modules.vote.vo.VoteVO;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.lang.reflect.Type;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 控制器
+ *
+ * @author BladeX
+ * @since 2022-01-24
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("vote/vote")
+@Api(value = "", tags = "接口")
+public class VoteController extends BladeController {
+
+	private final IVoteService voteService;
+	private final IOptionService optionService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入vote")
+	public R<Vote> detail(Vote vote) {
+		Vote detail = voteService.getOne(Condition.getQueryWrapper(vote));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入vote")
+	public R<IPage<Vote>> list(Vote vote, Query query) {
+		IPage<Vote> pages = voteService.page(Condition.getPage(query), Condition.getQueryWrapper(vote));
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入vote")
+	public R<IPage<VoteVO>> page(VoteVO vote, Query query) {
+		IPage<VoteVO> pages = voteService.selectVotePage(Condition.getPage(query), vote);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入vote")
+	public R save(@Valid @RequestBody Vote vote) {
+		return R.status(voteService.save(vote));
+	}
+
+	/**
+	 * 修改
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入vote")
+	public R update(@Valid @RequestBody Vote vote) {
+		return R.status(voteService.updateById(vote));
+	}
+
+	/**
+	 * 新增或修改
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入vote")
+	public R submit(@Valid @RequestBody Vote vote) {
+		return R.status(voteService.saveOrUpdate(vote));
+	}
+
+
+	/**
+	 * 删除
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(voteService.removeByIds(Func.toLongList(ids)));
+	}
+
+	/**
+	 * 投票新增
+	 *
+	 * @param param
+	 * @return
+	 */
+	@PostMapping("/sav")
+	public R sav(@RequestBody Map<Object, Object> param) {
+		//获取数组GKEY
+		String g = param.get("G").toString();
+		List<Object> marshallingGKEYList;
+		Gson gson = new Gson();
+		Type types = new TypeToken<List<Object>>() {
+		}.getType();
+		marshallingGKEYList = gson.fromJson(g, types);
+		//投票标题
+		String votename = param.get("votename").toString();
+		//介绍
+		String introduce = param.get("introduce").toString();
+		//发起人
+		String uid = param.get("uid").toString();
+		//发起时间
+		Date date = new Date();
+		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd :hh:mm:ss");
+		String time = dateFormat.format(date);
+		//类型
+		String type = param.get("type").toString();
+		//投票新增
+		Vote vote = new Vote();
+		vote.setVotename(votename);
+		vote.setIntroduce(introduce);
+		vote.setUid(uid);
+		vote.setTime(time);
+		vote.setType(type);
+		vote.setOpnum(marshallingGKEYList.size());
+		voteService.save(vote);
+		Option option = new Option();
+		int num = 0;
+		for (int i = 0; i < marshallingGKEYList.size(); i++) {
+			num++;
+			option.setOptionname(marshallingGKEYList.get(i).toString());
+			option.setVoteid(vote.getId());
+			option.setOptiontype(num);
+			optionService.save(option);
+		}
+		return R.success("成功");
+	}
+
+
+	/**
+	 * 投票列表查询
+	 *
+	 * @return
+	 */
+	@PostMapping("/selectList")
+	public R selectList() {
+		return R.data(voteService.selectList());
+	}
+}
diff --git a/src/main/java/org/springblade/modules/vote/dto/VoteDTO.java b/src/main/java/org/springblade/modules/vote/dto/VoteDTO.java
new file mode 100644
index 0000000..4c90968
--- /dev/null
+++ b/src/main/java/org/springblade/modules/vote/dto/VoteDTO.java
@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.vote.dto;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.vote.entity.Vote;
+
+/**
+ * 数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2022-01-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class VoteDTO extends Vote {
+	private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/vote/entity/Vote.java b/src/main/java/org/springblade/modules/vote/entity/Vote.java
new file mode 100644
index 0000000..95e49c2
--- /dev/null
+++ b/src/main/java/org/springblade/modules/vote/entity/Vote.java
@@ -0,0 +1,78 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.vote.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 java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.Date;
+
+/**
+ * 实体类
+ *
+ * @author BladeX
+ * @since 2022-01-24
+ */
+@Data
+@TableName("sys_vote")
+@ApiModel(value = "Vote对象", description = "Vote对象")
+public class Vote implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	@TableId(value = "id", type = IdType.AUTO)
+	private Integer id;
+	/**
+	 * 投票标题
+	 */
+	@ApiModelProperty(value = "投票标题")
+	private String votename;
+	/**
+	 * 介绍
+	 */
+	@ApiModelProperty(value = "介绍")
+	private String introduce;
+	/**
+	 * 发起人
+	 */
+	@ApiModelProperty(value = "发起人")
+	private String uid;
+	/**
+	 * 发起时间
+	 */
+	@ApiModelProperty(value = "发起时间")
+	private String time;
+	/**
+	 * 类型
+	 */
+	@ApiModelProperty(value = "类型")
+	private String type;
+	/**
+	 * 参与人数
+	 */
+	@ApiModelProperty(value = "参与人数")
+	private Integer npeople;
+	private Integer opnum;
+
+
+}
diff --git a/src/main/java/org/springblade/modules/vote/mapper/VoteMapper.java b/src/main/java/org/springblade/modules/vote/mapper/VoteMapper.java
new file mode 100644
index 0000000..e47eead
--- /dev/null
+++ b/src/main/java/org/springblade/modules/vote/mapper/VoteMapper.java
@@ -0,0 +1,44 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.vote.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.modules.vote.entity.Vote;
+import org.springblade.modules.vote.vo.VoteVO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ *  Mapper 接口
+ *
+ * @author BladeX
+ * @since 2022-01-24
+ */
+public interface VoteMapper extends BaseMapper<Vote> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param vote
+	 * @return
+	 */
+	List<VoteVO> selectVotePage(IPage page, VoteVO vote);
+	List<Map<Object,Object>> selectList();
+}
diff --git a/src/main/java/org/springblade/modules/vote/mapper/VoteMapper.xml b/src/main/java/org/springblade/modules/vote/mapper/VoteMapper.xml
new file mode 100644
index 0000000..58aeb87
--- /dev/null
+++ b/src/main/java/org/springblade/modules/vote/mapper/VoteMapper.xml
@@ -0,0 +1,40 @@
+<?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="org.springblade.modules.vote.mapper.VoteMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="voteResultMap" type="org.springblade.modules.vote.entity.Vote">
+        <id column="id" property="id"/>
+        <result column="votename" property="votename"/>
+        <result column="introduce" property="introduce"/>
+        <result column="uid" property="uid"/>
+        <result column="time" property="time"/>
+        <result column="type" property="type"/>
+        <result column="npeople" property="npeople"/>
+    </resultMap>
+
+
+    <select id="selectVotePage" resultMap="voteResultMap">
+        select * from sys_vote where is_deleted = 0
+    </select>
+
+    <select id="selectList"  resultType="java.util.HashMap">
+        SELECT v.votename,
+               v.introduce,
+               v.npeople,
+               v.time,
+               v.type,
+               v.uid,
+               GROUP_CONCAT(o.optionname) as optionname,
+               GROUP_CONCAT(o.num)        as num
+        FROM sys_vote v
+                 INNER JOIN sys_option o ON v.id = o.voteid
+        GROUP BY v.votename,
+                 v.introduce,
+                 v.npeople,
+                 v.time,
+                 v.type,
+                 v.uid
+    </select>
+
+</mapper>
diff --git a/src/main/java/org/springblade/modules/vote/service/IVoteService.java b/src/main/java/org/springblade/modules/vote/service/IVoteService.java
new file mode 100644
index 0000000..8a2a2aa
--- /dev/null
+++ b/src/main/java/org/springblade/modules/vote/service/IVoteService.java
@@ -0,0 +1,44 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.vote.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springblade.modules.vote.entity.Vote;
+import org.springblade.modules.vote.vo.VoteVO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ *  服务类
+ *
+ * @author BladeX
+ * @since 2022-01-24
+ */
+public interface IVoteService extends IService<Vote> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param vote
+	 * @return
+	 */
+	IPage<VoteVO> selectVotePage(IPage<VoteVO> page, VoteVO vote);
+	List<Map<Object,Object>> selectList();
+}
diff --git a/src/main/java/org/springblade/modules/vote/service/impl/VoteServiceImpl.java b/src/main/java/org/springblade/modules/vote/service/impl/VoteServiceImpl.java
new file mode 100644
index 0000000..2cfe3b6
--- /dev/null
+++ b/src/main/java/org/springblade/modules/vote/service/impl/VoteServiceImpl.java
@@ -0,0 +1,49 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.vote.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.modules.vote.entity.Vote;
+import org.springblade.modules.vote.mapper.VoteMapper;
+import org.springblade.modules.vote.service.IVoteService;
+import org.springblade.modules.vote.vo.VoteVO;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ *  服务实现类
+ *
+ * @author BladeX
+ * @since 2022-01-24
+ */
+@Service
+public class VoteServiceImpl extends ServiceImpl<VoteMapper, Vote> implements IVoteService {
+
+	@Override
+	public IPage<VoteVO> selectVotePage(IPage<VoteVO> page, VoteVO vote) {
+		return page.setRecords(baseMapper.selectVotePage(page, vote));
+	}
+
+	@Override
+	public List<Map<Object, Object>> selectList() {
+		return baseMapper.selectList();
+	}
+
+}
diff --git a/src/main/java/org/springblade/modules/vote/vo/VoteVO.java b/src/main/java/org/springblade/modules/vote/vo/VoteVO.java
new file mode 100644
index 0000000..1c687b6
--- /dev/null
+++ b/src/main/java/org/springblade/modules/vote/vo/VoteVO.java
@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.vote.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.vote.entity.Vote;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2022-01-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "VoteVO对象", description = "VoteVO对象")
+public class VoteVO extends Vote {
+	private static final long serialVersionUID = 1L;
+
+}

--
Gitblit v1.9.3