dcs 4 月之前
父节点
当前提交
98102cce4d

+ 45 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/controller/ReminderController.java

@@ -0,0 +1,45 @@
+package com.bosshand.virgo.api.controller;
+
+import com.bosshand.virgo.api.model.Reminder;
+import com.bosshand.virgo.api.service.ReminderService;
+import com.bosshand.virgo.core.response.Response;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+@RequestMapping({"reminder"})
+@Api(tags = {"提醒管理"})
+public class ReminderController {
+
+    @Autowired
+    ReminderService reminderService;
+
+    @ApiOperation("保存")
+    @RequestMapping(value = "", method = RequestMethod.POST)
+    public Response insert(@RequestBody Reminder reminder) {
+        return Response.ok(reminderService.insert(reminder));
+    }
+
+    @ApiOperation("获取")
+    @RequestMapping(value = "/query", method = RequestMethod.POST)
+    public Response getList(@RequestBody Reminder reminder) {
+        return Response.ok(reminderService.getList(reminder));
+    }
+
+    @ApiOperation("更新")
+    @RequestMapping(value = "/update", method = RequestMethod.PUT)
+    public Response update(@RequestBody Reminder reminder) {
+        reminderService.update(reminder);
+        return Response.ok();
+    }
+
+    @ApiOperation("删除")
+    @RequestMapping(value = "/delete/{id}", method = RequestMethod.DELETE)
+    public Response delete(@PathVariable long id) {
+        reminderService.delete(id);
+        return Response.ok();
+    }
+
+}

+ 21 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/dao/ReminderDao.java

@@ -0,0 +1,21 @@
+package com.bosshand.virgo.api.dao;
+
+import com.bosshand.virgo.api.model.Reminder;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface ReminderDao {
+
+    int insert(Reminder reminder);
+
+    int update(Reminder reminder);
+
+    int delete(long id);
+
+    Reminder get(long id);
+
+    List<Reminder> getList(Reminder reminder);
+
+}

+ 138 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/model/Reminder.java

@@ -0,0 +1,138 @@
+package com.bosshand.virgo.api.model;
+
+/**
+ * 提醒
+ */
+public class Reminder {
+
+    private long id;
+
+    /**
+     * 组织id
+     */
+    private long organizationId;
+    /**
+     * 项目id
+     */
+    private long projectId;
+    /**
+     * 提醒名称
+     */
+    private String name;
+    /**
+     * 提醒类型
+     */
+    private Integer type;
+    /**
+     * 提醒内容
+     */
+    private String content;
+    /**
+     * 提醒时间
+     */
+    private String date;
+    /**
+     * 提醒次数
+     */
+    private Integer frequency;
+    /**
+     * 提醒人员列表
+     */
+    private String userList;
+    /**
+     * 附件
+     */
+    private String attachment;
+    /**
+     * 状态
+     */
+    private Integer state;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public long getOrganizationId() {
+        return organizationId;
+    }
+
+    public void setOrganizationId(long organizationId) {
+        this.organizationId = organizationId;
+    }
+
+    public long getProjectId() {
+        return projectId;
+    }
+
+    public void setProjectId(long projectId) {
+        this.projectId = projectId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public String getDate() {
+        return date;
+    }
+
+    public void setDate(String date) {
+        this.date = date;
+    }
+
+    public Integer getFrequency() {
+        return frequency;
+    }
+
+    public void setFrequency(Integer frequency) {
+        this.frequency = frequency;
+    }
+
+    public String getUserList() {
+        return userList;
+    }
+
+    public void setUserList(String userList) {
+        this.userList = userList;
+    }
+
+    public String getAttachment() {
+        return attachment;
+    }
+
+    public void setAttachment(String attachment) {
+        this.attachment = attachment;
+    }
+
+    public Integer getState() {
+        return state;
+    }
+
+    public void setState(Integer state) {
+        this.state = state;
+    }
+}

+ 38 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/service/ReminderService.java

@@ -0,0 +1,38 @@
+package com.bosshand.virgo.api.service;
+
+import com.bosshand.virgo.api.dao.ReminderDao;
+import com.bosshand.virgo.api.model.Reminder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class ReminderService {
+
+    @Autowired
+    ReminderDao reminderDao;
+
+    public Reminder get(long id) {
+        return reminderDao.get(id);
+    }
+
+    public Reminder insert(Reminder reminder) {
+        reminderDao.insert(reminder);
+        return reminder;
+    }
+
+    public Reminder update(Reminder reminder) {
+        reminderDao.update(reminder);
+        return reminder;
+    }
+
+    public List<Reminder> getList(Reminder reminder) {
+        return reminderDao.getList(reminder);
+    }
+
+    public int delete(long id) {
+        return reminderDao.delete(id);
+    }
+
+}

+ 81 - 0
virgo.api/src/main/resources/mapper/ReminderMapper.xml

@@ -0,0 +1,81 @@
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.bosshand.virgo.api.dao.ReminderDao">
+
+    <resultMap type="com.bosshand.virgo.api.model.Reminder" id="result">
+        <id column="id" property="id"/>
+        <result column="organizationId" property="organizationId"/>
+        <result column="projectId" property="projectId"/>
+        <result column="name" property="name"/>
+        <result column="type" property="type"/>
+        <result column="content" property="content"/>
+        <result column="date" property="date"/>
+        <result column="frequency" property="frequency"/>
+        <result column="userList" property="userList"/>
+        <result column="attachment" property="attachment"/>
+        <result column="state" property="state"/>
+    </resultMap>
+
+    <select id="get" resultMap="result">
+        select * from reminder where id = #{id}
+    </select>
+
+    <select id="getList" resultMap="result">
+        select * from reminder
+        <where>
+            <if test="id != 0">
+                and id = #{id}
+            </if>
+            <if test="organizationId != 0">
+                and organizationId = #{organizationId}
+            </if>
+            <if test="projectId != 0">
+                and projectId = #{projectId}
+            </if>
+            <if test="name != null">
+                and name = #{name}
+            </if>
+            <if test="type != null">
+                and type = #{type}
+            </if>
+            <if test="date != null">
+                and date = #{date}
+            </if>
+            <if test="frequency != null">
+                and frequency = #{frequency}
+            </if>
+            <if test="state != null">
+                and state = #{state}
+            </if>
+        </where>
+    </select>
+
+    <insert id="insert" useGeneratedKeys="true" keyProperty="id">
+        INSERT INTO reminder (`organizationId`, `projectId`, `name`, `type`, `content`, `date`, `frequency`, `userList`, `attachment`, `state`)
+        VALUES (#{organizationId}, #{projectId}, #{name}, #{type}, #{content}, #{date}, #{frequency}, #{userList}, #{attachment}, #{state})
+    </insert>
+
+    <update id="delete">
+        DELETE FROM reminder WHERE id = #{id}
+    </update>
+
+    <update id="update" parameterType="com.bosshand.virgo.api.model.Reminder">
+        UPDATE reminder
+        <trim prefix="set" suffixOverrides=",">
+            <if test="organizationId!=0">organizationId=#{organizationId},</if>
+            <if test="projectId!=0">projectId=#{projectId},</if>
+            <if test="name!=null">name=#{name},</if>
+            <if test="type!=null">type=#{type},</if>
+            <if test="content!=null">content=#{content},</if>
+            <if test="date!=null">date=#{date},</if>
+            <if test="frequency!=null">frequency=#{frequency},</if>
+            <if test="userList!=null">userList=#{userList},</if>
+            <if test="attachment!=null">attachment=#{attachment},</if>
+            <if test="state!=null">state=#{state},</if>
+        </trim>
+        WHERE id=#{id}
+    </update>
+
+</mapper>