diff --git a/ruoyi-ui/src/api/benyi/familyedu.js b/ruoyi-ui/src/api/benyi/familyedu.js new file mode 100644 index 000000000..8e0c8a7cc --- /dev/null +++ b/ruoyi-ui/src/api/benyi/familyedu.js @@ -0,0 +1,53 @@ +import request from "@/utils/request"; + +// 查询家庭教育列表 +export function listFamilyedu(query) { + return request({ + url: "/benyi/familyedu/list", + method: "get", + params: query + }); +} + +// 查询家庭教育详细 +export function getFamilyedu(id) { + return request({ + url: "/benyi/familyedu/" + id, + method: "get" + }); +} + +// 新增家庭教育 +export function addFamilyedu(data) { + return request({ + url: "/benyi/familyedu", + method: "post", + data: data + }); +} + +// 修改家庭教育 +export function updateFamilyedu(data) { + return request({ + url: "/benyi/familyedu", + method: "put", + data: data + }); +} + +// 删除家庭教育 +export function delFamilyedu(id) { + return request({ + url: "/benyi/familyedu/" + id, + method: "delete" + }); +} + +// 导出家庭教育 +export function exportFamilyedu(query) { + return request({ + url: "/benyi/familyedu/export", + method: "get", + params: query + }); +} diff --git a/ruoyi-ui/src/views/benyi/familyedu/index.vue b/ruoyi-ui/src/views/benyi/familyedu/index.vue new file mode 100644 index 000000000..a32d8cd10 --- /dev/null +++ b/ruoyi-ui/src/views/benyi/familyedu/index.vue @@ -0,0 +1,293 @@ + + + diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByFamilyeduController.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByFamilyeduController.java new file mode 100644 index 000000000..004b475bb --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByFamilyeduController.java @@ -0,0 +1,97 @@ +package com.ruoyi.project.benyi.controller; + +import java.util.List; + +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.framework.aspectj.lang.annotation.Log; +import com.ruoyi.framework.aspectj.lang.enums.BusinessType; +import com.ruoyi.project.benyi.domain.ByFamilyedu; +import com.ruoyi.project.benyi.service.IByFamilyeduService; +import com.ruoyi.framework.web.controller.BaseController; +import com.ruoyi.framework.web.domain.AjaxResult; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.framework.web.page.TableDataInfo; + +/** + * 家庭教育Controller + * + * @author tsbz + * @date 2021-06-20 + */ +@RestController +@RequestMapping("/benyi/familyedu") +public class ByFamilyeduController extends BaseController { + @Autowired + private IByFamilyeduService byFamilyeduService; + + /** + * 查询家庭教育列表 + */ + @PreAuthorize("@ss.hasPermi('benyi:familyedu:list')") + @GetMapping("/list") + public TableDataInfo list(ByFamilyedu byFamilyedu) { + startPage(); + List list = byFamilyeduService.selectByFamilyeduList(byFamilyedu); + return getDataTable(list); + } + + /** + * 导出家庭教育列表 + */ + @PreAuthorize("@ss.hasPermi('benyi:familyedu:export')") + @Log(title = "家庭教育", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public AjaxResult export(ByFamilyedu byFamilyedu) { + List list = byFamilyeduService.selectByFamilyeduList(byFamilyedu); + ExcelUtil util = new ExcelUtil(ByFamilyedu.class); + return util.exportExcel(list, "familyedu"); + } + + /** + * 获取家庭教育详细信息 + */ + @PreAuthorize("@ss.hasPermi('benyi:familyedu:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return AjaxResult.success(byFamilyeduService.selectByFamilyeduById(id)); + } + + /** + * 新增家庭教育 + */ + @PreAuthorize("@ss.hasPermi('benyi:familyedu:add')") + @Log(title = "家庭教育", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ByFamilyedu byFamilyedu) { + return toAjax(byFamilyeduService.insertByFamilyedu(byFamilyedu)); + } + + /** + * 修改家庭教育 + */ + @PreAuthorize("@ss.hasPermi('benyi:familyedu:edit')") + @Log(title = "家庭教育", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ByFamilyedu byFamilyedu) { + return toAjax(byFamilyeduService.updateByFamilyedu(byFamilyedu)); + } + + /** + * 删除家庭教育 + */ + @PreAuthorize("@ss.hasPermi('benyi:familyedu:remove')") + @Log(title = "家庭教育", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(byFamilyeduService.deleteByFamilyeduByIds(ids)); + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByFamilyedu.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByFamilyedu.java new file mode 100644 index 000000000..8bf100b96 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByFamilyedu.java @@ -0,0 +1,97 @@ +package com.ruoyi.project.benyi.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.framework.aspectj.lang.annotation.Excel; +import com.ruoyi.framework.web.domain.BaseEntity; + +/** + * 家庭教育对象 by_familyedu + * + * @author tsbz + * @date 2021-06-20 + */ +public class ByFamilyedu extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + private Long id; + + /** + * 父节点 + */ + @Excel(name = "父节点") + private Long parentid; + + /** + * 标题 + */ + @Excel(name = "标题") + private String title; + + /** + * 内容 + */ + @Excel(name = "内容") + private String content; + + /** + * 序号 + */ + @Excel(name = "序号") + private Long sort; + + public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + } + + public void setParentid(Long parentid) { + this.parentid = parentid; + } + + public Long getParentid() { + return parentid; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getTitle() { + return title; + } + + public void setContent(String content) { + this.content = content; + } + + public String getContent() { + return content; + } + + public void setSort(Long sort) { + this.sort = sort; + } + + public Long getSort() { + return sort; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("parentid", getParentid()) + .append("title", getTitle()) + .append("content", getContent()) + .append("sort", getSort()) + .append("createTime", getCreateTime()) + .toString(); + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/ByFamilyeduMapper.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/ByFamilyeduMapper.java new file mode 100644 index 000000000..58a906c94 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/ByFamilyeduMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.project.benyi.mapper; + +import java.util.List; + +import com.ruoyi.project.benyi.domain.ByFamilyedu; + +/** + * 家庭教育Mapper接口 + * + * @author tsbz + * @date 2021-06-20 + */ +public interface ByFamilyeduMapper { + /** + * 查询家庭教育 + * + * @param id 家庭教育ID + * @return 家庭教育 + */ + public ByFamilyedu selectByFamilyeduById(Long id); + + /** + * 查询家庭教育列表 + * + * @param byFamilyedu 家庭教育 + * @return 家庭教育集合 + */ + public List selectByFamilyeduList(ByFamilyedu byFamilyedu); + + /** + * 新增家庭教育 + * + * @param byFamilyedu 家庭教育 + * @return 结果 + */ + public int insertByFamilyedu(ByFamilyedu byFamilyedu); + + /** + * 修改家庭教育 + * + * @param byFamilyedu 家庭教育 + * @return 结果 + */ + public int updateByFamilyedu(ByFamilyedu byFamilyedu); + + /** + * 删除家庭教育 + * + * @param id 家庭教育ID + * @return 结果 + */ + public int deleteByFamilyeduById(Long id); + + /** + * 批量删除家庭教育 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteByFamilyeduByIds(Long[] ids); +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IByFamilyeduService.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IByFamilyeduService.java new file mode 100644 index 000000000..f37b95d6f --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IByFamilyeduService.java @@ -0,0 +1,61 @@ +package com.ruoyi.project.benyi.service; + +import java.util.List; + +import com.ruoyi.project.benyi.domain.ByFamilyedu; + +/** + * 家庭教育Service接口 + * + * @author tsbz + * @date 2021-06-20 + */ +public interface IByFamilyeduService { + /** + * 查询家庭教育 + * + * @param id 家庭教育ID + * @return 家庭教育 + */ + public ByFamilyedu selectByFamilyeduById(Long id); + + /** + * 查询家庭教育列表 + * + * @param byFamilyedu 家庭教育 + * @return 家庭教育集合 + */ + public List selectByFamilyeduList(ByFamilyedu byFamilyedu); + + /** + * 新增家庭教育 + * + * @param byFamilyedu 家庭教育 + * @return 结果 + */ + public int insertByFamilyedu(ByFamilyedu byFamilyedu); + + /** + * 修改家庭教育 + * + * @param byFamilyedu 家庭教育 + * @return 结果 + */ + public int updateByFamilyedu(ByFamilyedu byFamilyedu); + + /** + * 批量删除家庭教育 + * + * @param ids 需要删除的家庭教育ID + * @return 结果 + */ + public int deleteByFamilyeduByIds(Long[] ids); + + /** + * 删除家庭教育信息 + * + * @param id 家庭教育ID + * @return 结果 + */ + public int deleteByFamilyeduById(Long id); +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/ByFamilyeduServiceImpl.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/ByFamilyeduServiceImpl.java new file mode 100644 index 000000000..1deed19fe --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/ByFamilyeduServiceImpl.java @@ -0,0 +1,89 @@ +package com.ruoyi.project.benyi.service.impl; + +import java.util.List; + +import com.ruoyi.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.project.benyi.mapper.ByFamilyeduMapper; +import com.ruoyi.project.benyi.domain.ByFamilyedu; +import com.ruoyi.project.benyi.service.IByFamilyeduService; + +/** + * 家庭教育Service业务层处理 + * + * @author tsbz + * @date 2021-06-20 + */ +@Service +public class ByFamilyeduServiceImpl implements IByFamilyeduService { + @Autowired + private ByFamilyeduMapper byFamilyeduMapper; + + /** + * 查询家庭教育 + * + * @param id 家庭教育ID + * @return 家庭教育 + */ + @Override + public ByFamilyedu selectByFamilyeduById(Long id) { + return byFamilyeduMapper.selectByFamilyeduById(id); + } + + /** + * 查询家庭教育列表 + * + * @param byFamilyedu 家庭教育 + * @return 家庭教育 + */ + @Override + public List selectByFamilyeduList(ByFamilyedu byFamilyedu) { + return byFamilyeduMapper.selectByFamilyeduList(byFamilyedu); + } + + /** + * 新增家庭教育 + * + * @param byFamilyedu 家庭教育 + * @return 结果 + */ + @Override + public int insertByFamilyedu(ByFamilyedu byFamilyedu) { + byFamilyedu.setCreateTime(DateUtils.getNowDate()); + return byFamilyeduMapper.insertByFamilyedu(byFamilyedu); + } + + /** + * 修改家庭教育 + * + * @param byFamilyedu 家庭教育 + * @return 结果 + */ + @Override + public int updateByFamilyedu(ByFamilyedu byFamilyedu) { + return byFamilyeduMapper.updateByFamilyedu(byFamilyedu); + } + + /** + * 批量删除家庭教育 + * + * @param ids 需要删除的家庭教育ID + * @return 结果 + */ + @Override + public int deleteByFamilyeduByIds(Long[] ids) { + return byFamilyeduMapper.deleteByFamilyeduByIds(ids); + } + + /** + * 删除家庭教育信息 + * + * @param id 家庭教育ID + * @return 结果 + */ + @Override + public int deleteByFamilyeduById(Long id) { + return byFamilyeduMapper.deleteByFamilyeduById(id); + } +} diff --git a/ruoyi/src/main/resources/mybatis/benyi/ByFamilyeduMapper.xml b/ruoyi/src/main/resources/mybatis/benyi/ByFamilyeduMapper.xml new file mode 100644 index 000000000..00d09d611 --- /dev/null +++ b/ruoyi/src/main/resources/mybatis/benyi/ByFamilyeduMapper.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + select id, parentid, title, content, sort, create_time from by_familyedu + + + + + + + + insert into by_familyedu + + parentid, + title, + content, + sort, + create_time, + + + #{parentid}, + #{title}, + #{content}, + #{sort}, + #{createTime}, + + + + + update by_familyedu + + parentid = #{parentid}, + title = #{title}, + content = #{content}, + sort = #{sort}, + create_time = #{createTime}, + + where id = #{id} + + + + delete from by_familyedu where id = #{id} + + + + delete from by_familyedu where id in + + #{id} + + + + \ No newline at end of file