20200420-zlp-1

园历创建
This commit is contained in:
paidaxing444 2020-04-20 17:27:52 +08:00
parent 57113cd443
commit b54c6c8749
8 changed files with 640 additions and 3 deletions

View File

@ -17,6 +17,28 @@
</div>
</el-col>
</el-row>
<el-row :gutter="32">
<el-calendar v-model="value" id="calendar">
<!-- 这里使用的是 2.5 slot 语法对于新项目请使用 2.6 slot 语法-->
<template slot="dateCell" slot-scope="{date, data}">
<!--自定义内容-->
<div>
<div class="calendar-day">{{ data.day.split('-').slice(2).join('-') }}</div>
<div v-for="item in calendarData">
<div v-if="(item.months).indexOf(data.day.split('-').slice(1)[0])!=-1">
<div v-if="(item.days).indexOf(data.day.split('-').slice(2).join('-'))!=-1">
<el-tooltip class="item" effect="dark" :content="item.things" placement="right">
<div class="is-selected">{{item.things}}</div>
</el-tooltip>
</div>
<div v-else></div>
</div>
<div v-else></div>
</div>
</div>
</template>
</el-calendar>
</el-row>
</div>
</template>
@ -27,13 +49,21 @@ import BarChart from "./dashboard/BarChart";
export default {
name: "Index",
name: "calendar",
components: {
RaddarChart,
PieChart,
BarChart
},
data() {
return {};
return {calendarData: [
{ months: ['09', '11'],days: ['15'],things: '看电影' },
{ months: ['10', '11'], days: ['02'],things: '去公园野炊' },
{ months: ['11'], days: ['02'],things: '看星星' },
{ months: ['11'], days: ['02'],things: '看月亮' }
],
value: new Date()
};
},
methods: {}
};

View File

@ -0,0 +1,122 @@
package com.ruoyi.project.benyi.controller;
import java.util.Date;
import java.util.List;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.project.common.SchoolCommon;
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.BySchoolcalendar;
import com.ruoyi.project.benyi.service.IBySchoolcalendarService;
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 2020-04-20
*/
@RestController
@RequestMapping("/benyi/schoolcalendar")
public class BySchoolcalendarController extends BaseController {
@Autowired
private IBySchoolcalendarService bySchoolcalendarService;
@Autowired
private SchoolCommon schoolCommon;
/**
* 查询园历管理列表
*/
@PreAuthorize("@ss.hasPermi('benyi:schoolcalendar:list')")
@GetMapping("/list")
public TableDataInfo list(BySchoolcalendar bySchoolcalendar) {
startPage();
List<BySchoolcalendar> list = bySchoolcalendarService.selectBySchoolcalendarList(bySchoolcalendar);
return getDataTable(list);
}
/**
* 导出园历管理列表
*/
@PreAuthorize("@ss.hasPermi('benyi:schoolcalendar:export')")
@Log(title = "园历管理", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(BySchoolcalendar bySchoolcalendar) {
List<BySchoolcalendar> list = bySchoolcalendarService.selectBySchoolcalendarList(bySchoolcalendar);
ExcelUtil<BySchoolcalendar> util = new ExcelUtil<BySchoolcalendar>(BySchoolcalendar.class);
return util.exportExcel(list, "schoolcalendar");
}
/**
* 获取园历管理详细信息
*/
@PreAuthorize("@ss.hasPermi('benyi:schoolcalendar:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(bySchoolcalendarService.selectBySchoolcalendarById(id));
}
/**
* 新增园历管理
*/
@PreAuthorize("@ss.hasPermi('benyi:schoolcalendar:add')")
@Log(title = "园历管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BySchoolcalendar bySchoolcalendar) {
//首先判断 当前用户是否为学校
if (schoolCommon.isSchool()) {
bySchoolcalendar.setCreatetime(new Date());
String strXnxq = schoolCommon.getCurrentXnXq(bySchoolcalendar.getActivitytime());
bySchoolcalendar.setXnxq(strXnxq);
bySchoolcalendar.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
bySchoolcalendar.setDeptid(SecurityUtils.getLoginUser().getUser().getDept().getDeptId());
return toAjax(bySchoolcalendarService.insertBySchoolcalendar(bySchoolcalendar));
} else {
return AjaxResult.error("当前用户非幼儿园,无法创建园历");
}
}
/**
* 修改园历管理
*/
@PreAuthorize("@ss.hasPermi('benyi:schoolcalendar:edit')")
@Log(title = "园历管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BySchoolcalendar bySchoolcalendar) {
//首先判断 当前用户是否为学校
if (schoolCommon.isSchool()) {
return toAjax(bySchoolcalendarService.updateBySchoolcalendar(bySchoolcalendar));
} else {
return AjaxResult.error("当前用户非幼儿园,无法编辑园历");
}
}
/**
* 删除园历管理
*/
@PreAuthorize("@ss.hasPermi('benyi:schoolcalendar:remove')")
@Log(title = "园历管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
//首先判断 当前用户是否为学校
if (schoolCommon.isSchool()) {
return toAjax(bySchoolcalendarService.deleteBySchoolcalendarByIds(ids));
} else {
return AjaxResult.error("当前用户非幼儿园,无法删除园历");
}
}
}

View File

@ -0,0 +1,151 @@
package com.ruoyi.project.benyi.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
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;
import java.util.Date;
/**
* 园历管理对象 by_schoolcalendar
*
* @author tsbz
* @date 2020-04-20
*/
public class BySchoolcalendar extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 标识 */
private Long id;
/** 名称 */
@Excel(name = "名称")
private String name;
/** 活动类型 */
@Excel(name = "活动类型")
private String type;
/** 适用范围:大班、中班、小班、全园 */
@Excel(name = "适用范围:大班、中班、小班、全园")
private String scope;
/** 学年学期 */
@Excel(name = "学年学期")
private String xnxq;
/** 所属学校 */
@Excel(name = "所属学校")
private Long deptid;
/** 活动时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date activitytime;
/** 创建人 */
@Excel(name = "创建人")
private Long createuserid;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createtime;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setType(String type)
{
this.type = type;
}
public String getType()
{
return type;
}
public void setScope(String scope)
{
this.scope = scope;
}
public String getScope()
{
return scope;
}
public void setXnxq(String xnxq)
{
this.xnxq = xnxq;
}
public String getXnxq()
{
return xnxq;
}
public void setDeptid(Long deptid)
{
this.deptid = deptid;
}
public Long getDeptid()
{
return deptid;
}
public void setActivitytime(Date activitytime)
{
this.activitytime = activitytime;
}
public Date getActivitytime()
{
return activitytime;
}
public void setCreateuserid(Long createuserid)
{
this.createuserid = createuserid;
}
public Long getCreateuserid()
{
return createuserid;
}
public void setCreatetime(Date createtime) {
this.createtime = createtime;
}
public Date getCreatetime() {
return createtime;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("type", getType())
.append("scope", getScope())
.append("xnxq", getXnxq())
.append("deptid", getDeptid())
.append("activitytime", getActivitytime())
.append("createuserid", getCreateuserid())
.append("createtime", getCreatetime())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.project.benyi.mapper;
import java.util.List;
import com.ruoyi.project.benyi.domain.BySchoolcalendar;
/**
* 园历管理Mapper接口
*
* @author tsbz
* @date 2020-04-20
*/
public interface BySchoolcalendarMapper
{
/**
* 查询园历管理
*
* @param id 园历管理ID
* @return 园历管理
*/
public BySchoolcalendar selectBySchoolcalendarById(Long id);
/**
* 查询园历管理列表
*
* @param bySchoolcalendar 园历管理
* @return 园历管理集合
*/
public List<BySchoolcalendar> selectBySchoolcalendarList(BySchoolcalendar bySchoolcalendar);
/**
* 新增园历管理
*
* @param bySchoolcalendar 园历管理
* @return 结果
*/
public int insertBySchoolcalendar(BySchoolcalendar bySchoolcalendar);
/**
* 修改园历管理
*
* @param bySchoolcalendar 园历管理
* @return 结果
*/
public int updateBySchoolcalendar(BySchoolcalendar bySchoolcalendar);
/**
* 删除园历管理
*
* @param id 园历管理ID
* @return 结果
*/
public int deleteBySchoolcalendarById(Long id);
/**
* 批量删除园历管理
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteBySchoolcalendarByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.project.benyi.service;
import java.util.List;
import com.ruoyi.project.benyi.domain.BySchoolcalendar;
/**
* 园历管理Service接口
*
* @author tsbz
* @date 2020-04-20
*/
public interface IBySchoolcalendarService
{
/**
* 查询园历管理
*
* @param id 园历管理ID
* @return 园历管理
*/
public BySchoolcalendar selectBySchoolcalendarById(Long id);
/**
* 查询园历管理列表
*
* @param bySchoolcalendar 园历管理
* @return 园历管理集合
*/
public List<BySchoolcalendar> selectBySchoolcalendarList(BySchoolcalendar bySchoolcalendar);
/**
* 新增园历管理
*
* @param bySchoolcalendar 园历管理
* @return 结果
*/
public int insertBySchoolcalendar(BySchoolcalendar bySchoolcalendar);
/**
* 修改园历管理
*
* @param bySchoolcalendar 园历管理
* @return 结果
*/
public int updateBySchoolcalendar(BySchoolcalendar bySchoolcalendar);
/**
* 批量删除园历管理
*
* @param ids 需要删除的园历管理ID
* @return 结果
*/
public int deleteBySchoolcalendarByIds(Long[] ids);
/**
* 删除园历管理信息
*
* @param id 园历管理ID
* @return 结果
*/
public int deleteBySchoolcalendarById(Long id);
}

View File

@ -0,0 +1,96 @@
package com.ruoyi.project.benyi.service.impl;
import java.util.List;
import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.benyi.mapper.BySchoolcalendarMapper;
import com.ruoyi.project.benyi.domain.BySchoolcalendar;
import com.ruoyi.project.benyi.service.IBySchoolcalendarService;
/**
* 园历管理Service业务层处理
*
* @author tsbz
* @date 2020-04-20
*/
@Service
public class BySchoolcalendarServiceImpl implements IBySchoolcalendarService
{
@Autowired
private BySchoolcalendarMapper bySchoolcalendarMapper;
/**
* 查询园历管理
*
* @param id 园历管理ID
* @return 园历管理
*/
@Override
public BySchoolcalendar selectBySchoolcalendarById(Long id)
{
return bySchoolcalendarMapper.selectBySchoolcalendarById(id);
}
/**
* 查询园历管理列表
*
* @param bySchoolcalendar 园历管理
* @return 园历管理
*/
@Override
@DataScope(deptAlias = "d")
public List<BySchoolcalendar> selectBySchoolcalendarList(BySchoolcalendar bySchoolcalendar)
{
return bySchoolcalendarMapper.selectBySchoolcalendarList(bySchoolcalendar);
}
/**
* 新增园历管理
*
* @param bySchoolcalendar 园历管理
* @return 结果
*/
@Override
public int insertBySchoolcalendar(BySchoolcalendar bySchoolcalendar)
{
return bySchoolcalendarMapper.insertBySchoolcalendar(bySchoolcalendar);
}
/**
* 修改园历管理
*
* @param bySchoolcalendar 园历管理
* @return 结果
*/
@Override
public int updateBySchoolcalendar(BySchoolcalendar bySchoolcalendar)
{
return bySchoolcalendarMapper.updateBySchoolcalendar(bySchoolcalendar);
}
/**
* 批量删除园历管理
*
* @param ids 需要删除的园历管理ID
* @return 结果
*/
@Override
public int deleteBySchoolcalendarByIds(Long[] ids)
{
return bySchoolcalendarMapper.deleteBySchoolcalendarByIds(ids);
}
/**
* 删除园历管理信息
*
* @param id 园历管理ID
* @return 结果
*/
@Override
public int deleteBySchoolcalendarById(Long id)
{
return bySchoolcalendarMapper.deleteBySchoolcalendarById(id);
}
}

View File

@ -6,10 +6,12 @@ import com.ruoyi.project.system.domain.BySchool;
import com.ruoyi.project.system.domain.SysDept;
import com.ruoyi.project.system.service.IBySchoolService;
import com.ruoyi.project.system.service.ISysDeptService;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@RestController
@ -83,9 +85,28 @@ public class SchoolCommon {
String strNxNq = "";
if (iMonth < 9) {
strNxNq = (iYear - 1) + "-" + iYear + "2";
strNxNq = (iYear - 1) + "" + iYear + "2";
} else {
strNxNq = iYear + "-" + (iYear + 1) + "1";
strNxNq = iYear + "" + (iYear + 1) + "1";
}
return strNxNq;
}
//根据时间 生成学年学期
public String getCurrentXnXq(Date date) {
String year=String.format("%tY", date);
Integer iYear = Integer.parseInt(year);
System.out.println("当前年======:" + iYear);
String mon=String.format("%tm", date);
Integer iMonth = Integer.parseInt(mon);
System.out.println("当前月======:" + iMonth);
String strNxNq = "";
if (iMonth < 9) {
strNxNq = (iYear - 1) + "" + iYear + "2";
} else {
strNxNq = iYear + "" + (iYear + 1) + "1";
}
return strNxNq;

View File

@ -0,0 +1,95 @@
<?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.project.benyi.mapper.BySchoolcalendarMapper">
<resultMap type="BySchoolcalendar" id="BySchoolcalendarResult">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="type" column="type"/>
<result property="scope" column="scope"/>
<result property="xnxq" column="xnxq"/>
<result property="deptid" column="dept_id"/>
<result property="activitytime" column="activitytime"/>
<result property="createuserid" column="createuserid"/>
<result property="createtime" column="createtime"/>
</resultMap>
<sql id="selectBySchoolcalendarVo">
select id, name, type, scope, xnxq, dept_id, activitytime, createuserid, createtime from by_schoolcalendar d
</sql>
<select id="selectBySchoolcalendarList" parameterType="BySchoolcalendar" resultMap="BySchoolcalendarResult">
<include refid="selectBySchoolcalendarVo"/>
where 1=1
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
<if test="type != null and type != ''">and type = #{type}</if>
<if test="scope != null and scope != ''">and scope like concat('%', #{scope}, '%')</if>
<if test="xnxq != null and xnxq != ''">and xnxq = #{xnxq}</if>
<if test="deptid != null ">and dept_id = #{deptid}</if>
<if test="activitytime != null ">and activitytime = #{activitytime}</if>
<if test="createuserid != null ">and createuserid = #{createuserid}</if>
<if test="createtime != null ">and createtime = #{createtime}</if>
<!-- 数据范围过滤 -->
${dataScope}
order by activitytime
</select>
<select id="selectBySchoolcalendarById" parameterType="Long" resultMap="BySchoolcalendarResult">
<include refid="selectBySchoolcalendarVo"/>
where id = #{id}
</select>
<insert id="insertBySchoolcalendar" parameterType="BySchoolcalendar" useGeneratedKeys="true" keyProperty="id">
insert into by_schoolcalendar
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,</if>
<if test="type != null and type != ''">type,</if>
<if test="scope != null and scope != ''">scope,</if>
<if test="xnxq != null and xnxq != ''">xnxq,</if>
<if test="deptid != null ">dept_id,</if>
<if test="activitytime != null ">activitytime,</if>
<if test="createuserid != null ">createuserid,</if>
<if test="createtime != null ">createtime,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
<if test="type != null and type != ''">#{type},</if>
<if test="scope != null and scope != ''">#{scope},</if>
<if test="xnxq != null and xnxq != ''">#{xnxq},</if>
<if test="deptid != null ">#{deptid},</if>
<if test="activitytime != null ">#{activitytime},</if>
<if test="createuserid != null ">#{createuserid},</if>
<if test="createtime != null ">#{createtime},</if>
</trim>
</insert>
<update id="updateBySchoolcalendar" parameterType="BySchoolcalendar">
update by_schoolcalendar
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="type != null and type != ''">type = #{type},</if>
<if test="scope != null and scope != ''">scope = #{scope},</if>
<if test="xnxq != null and xnxq != ''">xnxq = #{xnxq},</if>
<if test="deptid != null ">dept_id = #{deptid},</if>
<if test="activitytime != null ">activitytime = #{activitytime},</if>
<if test="createuserid != null ">createuserid = #{createuserid},</if>
<if test="createtime != null ">createtime = #{createtime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBySchoolcalendarById" parameterType="Long">
delete from by_schoolcalendar where id = #{id}
</delete>
<delete id="deleteBySchoolcalendarByIds" parameterType="String">
delete from by_schoolcalendar where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>