浏览代码

添加大事件和家族园地模块

liuhj 4 年之前
父节点
当前提交
e2909ba365

+ 118 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TbFamilyEventsController.java

@@ -0,0 +1,118 @@
+package com.ruoyi.web.controller.api;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Arrays;
+
+import com.ruoyi.app.domain.TbFamilyAlbum;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import com.ruoyi.common.utils.StringUtils;
+import lombok.RequiredArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.app.domain.TbFamilyEvents;
+import com.ruoyi.app.service.ITbFamilyEventsService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 家族大事件
+ * 
+ * @author liuhj
+ * @date 2020-10-14
+ */
+@Api(value = "家族大事件", tags = "家族大事件")
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/system/events" )
+public class TbFamilyEventsController extends BaseController {
+
+    private final ITbFamilyEventsService iTbFamilyEventsService;
+
+    /**
+     * 查询家族大事件列表
+     */
+    @ApiOperation("查询家族大事件列表")
+    @PreAuthorize("@ss.hasPermi('system:events:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(TbFamilyEvents tbFamilyEvents)
+    {
+        startPage();
+        List<TbFamilyEvents> list = iTbFamilyEventsService.queryList(tbFamilyEvents);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出家族大事件列表
+     */
+    @ApiOperation("导出家族大事件列表")
+    @PreAuthorize("@ss.hasPermi('system:events:export')" )
+    @Log(title = "家族大事件" , businessType = BusinessType.EXPORT)
+    @GetMapping("/export" )
+    public AjaxResult export(TbFamilyEvents tbFamilyEvents) {
+        LambdaQueryWrapper<TbFamilyEvents> lqw = new LambdaQueryWrapper<TbFamilyEvents>(tbFamilyEvents);
+        List<TbFamilyEvents> list = iTbFamilyEventsService.list(lqw);
+        ExcelUtil<TbFamilyEvents> util = new ExcelUtil<TbFamilyEvents>(TbFamilyEvents. class);
+        return util.exportExcel(list, "events" );
+    }
+
+    /**
+     * 获取家族大事件详细信息
+     */
+    @ApiOperation("获取家族大事件详细信息")
+    @PreAuthorize("@ss.hasPermi('system:events:query')" )
+    @GetMapping(value = "/{id}" )
+    public AjaxResult getInfo(@PathVariable("id" ) Long id) {
+        return AjaxResult.success(iTbFamilyEventsService.getById(id));
+    }
+
+    /**
+     * 新增家族大事件
+     */
+    @ApiOperation("新增家族大事件")
+    @PreAuthorize("@ss.hasPermi('system:events:add')" )
+    @Log(title = "家族大事件" , businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody TbFamilyEvents tbFamilyEvents) {
+        return toAjax(iTbFamilyEventsService.save(tbFamilyEvents) ? 1 : 0);
+    }
+
+    /**
+     * 修改家族大事件
+     */
+    @ApiOperation("修改家族大事件")
+    @PreAuthorize("@ss.hasPermi('system:events:edit')" )
+    @Log(title = "家族大事件" , businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TbFamilyEvents tbFamilyEvents) {
+        Date date = new Date();
+        tbFamilyEvents.setUpdateTime(date);
+        return toAjax(iTbFamilyEventsService.updateById(tbFamilyEvents) ? 1 : 0);
+    }
+
+    /**
+     * 删除家族大事件
+     */
+    @ApiOperation("删除家族大事件")
+    @PreAuthorize("@ss.hasPermi('system:events:remove')" )
+    @Log(title = "家族大事件" , businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}" )
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(iTbFamilyEventsService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
+    }
+}

+ 115 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TbFamilyGardenController.java

@@ -0,0 +1,115 @@
+package com.ruoyi.web.controller.api;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+
+import java.util.List;
+import java.util.Arrays;
+
+import com.ruoyi.app.domain.TbFamilyEvents;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import com.ruoyi.common.utils.StringUtils;
+import lombok.RequiredArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.app.domain.TbFamilyGarden;
+import com.ruoyi.app.service.ITbFamilyGardenService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 家族园地
+ * 
+ * @author liuhj
+ * @date 2020-10-14
+ */
+@Api(value = "家族园地", tags = "家族园地")
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/system/garden" )
+public class TbFamilyGardenController extends BaseController {
+
+    private final ITbFamilyGardenService iTbFamilyGardenService;
+
+    /**
+     * 查询家族园地列表
+     */
+    @ApiOperation("查询家族园地列表")
+    @PreAuthorize("@ss.hasPermi('system:garden:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(TbFamilyGarden tbFamilyGarden)
+    {
+        startPage();
+        List<TbFamilyGarden> list = iTbFamilyGardenService.queryList(tbFamilyGarden);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出家族园地列表
+     */
+    @ApiOperation("导出家族园地列表")
+    @PreAuthorize("@ss.hasPermi('system:garden:export')" )
+    @Log(title = "家族园地" , businessType = BusinessType.EXPORT)
+    @GetMapping("/export" )
+    public AjaxResult export(TbFamilyGarden tbFamilyGarden) {
+        LambdaQueryWrapper<TbFamilyGarden> lqw = new LambdaQueryWrapper<TbFamilyGarden>(tbFamilyGarden);
+        List<TbFamilyGarden> list = iTbFamilyGardenService.list(lqw);
+        ExcelUtil<TbFamilyGarden> util = new ExcelUtil<TbFamilyGarden>(TbFamilyGarden. class);
+        return util.exportExcel(list, "garden" );
+    }
+
+    /**
+     * 获取家族园地详细信息
+     */
+    @ApiOperation("获取家族园地详细信息")
+    @PreAuthorize("@ss.hasPermi('system:garden:query')" )
+    @GetMapping(value = "/{id}" )
+    public AjaxResult getInfo(@PathVariable("id" ) Long id) {
+        return AjaxResult.success(iTbFamilyGardenService.getById(id));
+    }
+
+    /**
+     * 新增家族园地
+     */
+    @ApiOperation("新增家族园地")
+    @PreAuthorize("@ss.hasPermi('system:garden:add')" )
+    @Log(title = "家族园地" , businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody TbFamilyGarden tbFamilyGarden) {
+        return toAjax(iTbFamilyGardenService.save(tbFamilyGarden) ? 1 : 0);
+    }
+
+    /**
+     * 修改家族园地
+     */
+    @ApiOperation("修改家族园地")
+    @PreAuthorize("@ss.hasPermi('system:garden:edit')" )
+    @Log(title = "家族园地" , businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TbFamilyGarden tbFamilyGarden) {
+        return toAjax(iTbFamilyGardenService.updateById(tbFamilyGarden) ? 1 : 0);
+    }
+
+    /**
+     * 删除家族园地
+     */
+    @ApiOperation("删除家族园地")
+    @PreAuthorize("@ss.hasPermi('system:garden:remove')" )
+    @Log(title = "家族园地" , businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}" )
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(iTbFamilyGardenService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
+    }
+}

+ 84 - 0
ruoyi-system/src/main/java/com/ruoyi/app/domain/TbFamilyEvents.java

@@ -0,0 +1,84 @@
+package com.ruoyi.app.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+import com.ruoyi.common.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.io.Serializable;
+import java.util.Date;
+import java.math.BigDecimal;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 家族大事件
+ * 
+ * @author liuhj
+ * @date 2020-10-14
+ */
+@Data
+@ApiModel(value = "家族大事件")
+@ToString
+@EqualsAndHashCode
+@NoArgsConstructor
+@Accessors(chain = true)
+@TableName("tb_family_events")
+public class TbFamilyEvents implements Serializable {
+
+    private static final long serialVersionUID=1L;
+
+
+    /** ID */
+    @ApiModelProperty(value="ID")
+    @TableId(value = "id")
+    private Long id;
+
+    /** 家族id */
+    @ApiModelProperty(value="家族id")
+    @Excel(name = "家族id")
+    private Long familyId;
+
+    /** 事件标题 */
+    @ApiModelProperty(value="事件标题")
+    @Excel(name = "事件标题")
+    private String title;
+
+    /** 事件内容 */
+    @ApiModelProperty(value="事件内容")
+    @Excel(name = "事件内容")
+    private String contents;
+
+    /** 创建者 */
+    @ApiModelProperty(value="创建者")
+    private Long createBy;
+
+    /** 创建时间 */
+    @ApiModelProperty(value="创建时间")
+    @Excel(name = "创建时间" , width = 30, dateFormat = "yyyy-MM-dd")
+    @JsonFormat(locale="zh", timezone="GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    /** 更新者 */
+    @ApiModelProperty(value="更新者")
+    private Long updateBy;
+
+    /** 更新时间 */
+    @ApiModelProperty(value="更新时间")
+    private Date updateTime;
+
+    /** 备注 */
+    @ApiModelProperty(value="备注")
+    private String remark;
+
+    @ApiModelProperty(value = "家族信息")
+    @TableField(exist = false)
+    private TbFamily family;
+}

+ 87 - 0
ruoyi-system/src/main/java/com/ruoyi/app/domain/TbFamilyGarden.java

@@ -0,0 +1,87 @@
+package com.ruoyi.app.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+import com.ruoyi.common.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.io.Serializable;
+import java.util.Date;
+import java.math.BigDecimal;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 家族园地
+ * 
+ * @author liuhj
+ * @date 2020-10-14
+ */
+@Data
+@ApiModel(value = "家族园地")
+@ToString
+@EqualsAndHashCode
+@NoArgsConstructor
+@Accessors(chain = true)
+@TableName("tb_family_garden")
+public class TbFamilyGarden implements Serializable {
+
+    private static final long serialVersionUID=1L;
+
+
+    /** ID */
+    @ApiModelProperty(value="ID")
+    @TableId(value = "id")
+    private Long id;
+
+    /** 家族id */
+    @ApiModelProperty(value="家族id")
+    @Excel(name = "家族id")
+    private Long familyId;
+
+    /** 园地标题 */
+    @ApiModelProperty(value="园地标题")
+    @Excel(name = "园地标题")
+    private String title;
+
+    /** 园地内容 */
+    @ApiModelProperty(value="园地内容")
+    @Excel(name = "园地内容")
+    private String contents;
+
+    /** 排序号 */
+    @ApiModelProperty(value="排序号")
+    @Excel(name = "排序号")
+    private Long sort;
+
+    /** 创建者 */
+    @ApiModelProperty(value="创建者")
+    private Long createBy;
+
+    /** 创建时间 */
+    @ApiModelProperty(value="创建时间")
+    private Date createTime;
+
+    /** 更新者 */
+    @ApiModelProperty(value="更新者")
+    private Long updateBy;
+
+    /** 更新时间 */
+    @ApiModelProperty(value="更新时间")
+    private Date updateTime;
+
+    /** 备注 */
+    @ApiModelProperty(value="备注")
+    private String remark;
+
+    @ApiModelProperty(value = "家族信息")
+    @TableField(exist = false)
+    private TbFamily family;
+}

+ 14 - 0
ruoyi-system/src/main/java/com/ruoyi/app/mapper/TbFamilyEventsMapper.java

@@ -0,0 +1,14 @@
+package com.ruoyi.app.mapper;
+
+import com.ruoyi.app.domain.TbFamilyEvents;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 家族大事件
+ *
+ * @author liuhj
+ * @date 2020-10-14
+ */
+public interface TbFamilyEventsMapper extends BaseMapper<TbFamilyEvents> {
+
+}

+ 14 - 0
ruoyi-system/src/main/java/com/ruoyi/app/mapper/TbFamilyGardenMapper.java

@@ -0,0 +1,14 @@
+package com.ruoyi.app.mapper;
+
+import com.ruoyi.app.domain.TbFamilyGarden;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 家族园地
+ *
+ * @author liuhj
+ * @date 2020-10-14
+ */
+public interface TbFamilyGardenMapper extends BaseMapper<TbFamilyGarden> {
+
+}

+ 18 - 0
ruoyi-system/src/main/java/com/ruoyi/app/service/ITbFamilyEventsService.java

@@ -0,0 +1,18 @@
+package com.ruoyi.app.service;
+
+import com.ruoyi.app.domain.TbFamilyAlbum;
+import com.ruoyi.app.domain.TbFamilyEvents;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 家族大事件
+ *
+ * @author liuhj
+ * @date 2020-10-14
+ */
+public interface ITbFamilyEventsService extends IService<TbFamilyEvents> {
+    List<TbFamilyEvents> queryList(TbFamilyEvents entity);
+
+}

+ 18 - 0
ruoyi-system/src/main/java/com/ruoyi/app/service/ITbFamilyGardenService.java

@@ -0,0 +1,18 @@
+package com.ruoyi.app.service;
+
+import com.ruoyi.app.domain.TbFamilyEvents;
+import com.ruoyi.app.domain.TbFamilyGarden;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 家族园地
+ *
+ * @author liuhj
+ * @date 2020-10-14
+ */
+public interface ITbFamilyGardenService extends IService<TbFamilyGarden> {
+    List<TbFamilyGarden> queryList(TbFamilyGarden entity);
+
+}

+ 47 - 0
ruoyi-system/src/main/java/com/ruoyi/app/service/impl/TbFamilyEventsServiceImpl.java

@@ -0,0 +1,47 @@
+package com.ruoyi.app.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ruoyi.app.domain.TbFamily;
+import com.ruoyi.app.domain.TbFamilyAlbum;
+import com.ruoyi.app.service.ITbFamilyService;
+import com.ruoyi.common.utils.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.app.mapper.TbFamilyEventsMapper;
+import com.ruoyi.app.domain.TbFamilyEvents;
+import com.ruoyi.app.service.ITbFamilyEventsService;
+
+import java.util.List;
+
+/**
+ * 家族大事件
+ *
+ * @author liuhj
+ * @date 2020-10-14
+ */
+@Service
+public class TbFamilyEventsServiceImpl extends ServiceImpl<TbFamilyEventsMapper, TbFamilyEvents> implements ITbFamilyEventsService {
+    @Autowired
+    private ITbFamilyService familyService;
+
+
+    @Override
+    public List<TbFamilyEvents> queryList(TbFamilyEvents  entity) {
+        LambdaQueryWrapper<TbFamilyEvents> lqw = new LambdaQueryWrapper<TbFamilyEvents>();
+        if (entity.getFamilyId() != null){
+            lqw.eq(TbFamilyEvents::getFamilyId ,entity.getFamilyId());
+        }
+        if (StringUtils.isNotBlank(entity.getTitle())){
+            lqw.eq(TbFamilyEvents::getTitle ,entity.getTitle());
+        }
+        List<TbFamilyEvents> list = this.list(lqw);
+        list.forEach(item->{
+            TbFamily family = familyService.getById(item.getFamilyId());
+            item.setFamily(family);
+        });
+
+        return list;
+    }
+
+}

+ 45 - 0
ruoyi-system/src/main/java/com/ruoyi/app/service/impl/TbFamilyGardenServiceImpl.java

@@ -0,0 +1,45 @@
+package com.ruoyi.app.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ruoyi.app.domain.TbFamily;
+import com.ruoyi.app.service.ITbFamilyService;
+import com.ruoyi.common.utils.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.app.mapper.TbFamilyGardenMapper;
+import com.ruoyi.app.domain.TbFamilyGarden;
+import com.ruoyi.app.service.ITbFamilyGardenService;
+
+import java.util.List;
+
+/**
+ * 家族园地
+ *
+ * @author liuhj
+ * @date 2020-10-14
+ */
+@Service
+public class TbFamilyGardenServiceImpl extends ServiceImpl<TbFamilyGardenMapper, TbFamilyGarden> implements ITbFamilyGardenService {
+    @Autowired
+    private ITbFamilyService familyService;
+
+
+    @Override
+    public List<TbFamilyGarden> queryList(TbFamilyGarden  entity) {
+        LambdaQueryWrapper<TbFamilyGarden> lqw = new LambdaQueryWrapper<TbFamilyGarden>();
+        if (entity.getFamilyId() != null){
+            lqw.eq(TbFamilyGarden::getFamilyId ,entity.getFamilyId());
+        }
+        if (StringUtils.isNotBlank(entity.getTitle())){
+            lqw.eq(TbFamilyGarden::getTitle ,entity.getTitle());
+        }
+        List<TbFamilyGarden> list = this.list(lqw);
+        list.forEach(item->{
+            TbFamily family = familyService.getById(item.getFamilyId());
+            item.setFamily(family);
+        });
+
+        return list;
+    }
+}

+ 20 - 0
ruoyi-system/src/main/resources/mapper/app/TbFamilyEventsMapper.xml

@@ -0,0 +1,20 @@
+<?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.ruoyi.app.mapper.TbFamilyEventsMapper">
+    
+    <resultMap type="TbFamilyEvents" id="TbFamilyEventsResult">
+        <result property="id"    column="id"    />
+        <result property="familyId"    column="family_id"    />
+        <result property="title"    column="title"    />
+        <result property="contents"    column="contents"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+
+</mapper>

+ 21 - 0
ruoyi-system/src/main/resources/mapper/app/TbFamilyGardenMapper.xml

@@ -0,0 +1,21 @@
+<?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.ruoyi.app.mapper.TbFamilyGardenMapper">
+    
+    <resultMap type="TbFamilyGarden" id="TbFamilyGardenResult">
+        <result property="id"    column="id"    />
+        <result property="familyId"    column="family_id"    />
+        <result property="title"    column="title"    />
+        <result property="contents"    column="contents"    />
+        <result property="sort"    column="sort"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+
+</mapper>