add游戏数学学期计划详细功能

This commit is contained in:
sk1551
2020-10-30 15:27:40 +08:00
parent 09ca6827c4
commit def67e67c0
10 changed files with 1049 additions and 10 deletions

View File

@ -1,8 +1,11 @@
package com.ruoyi.project.benyi.controller;
import java.util.Date;
import java.util.List;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.project.benyi.domain.ByMathTermplanitem;
import com.ruoyi.project.benyi.service.IByMathTermplanitemService;
import com.ruoyi.project.common.SchoolCommon;
import com.ruoyi.project.system.service.IByClassService;
import org.springframework.security.access.prepost.PreAuthorize;
@ -40,6 +43,8 @@ public class ByMathTermplanController extends BaseController
private SchoolCommon schoolCommon;
@Autowired
private IByClassService byClassService;
@Autowired
private IByMathTermplanitemService byMathTermplanitemService;
/**
* 查询游戏数学学期计划列表
@ -49,7 +54,13 @@ public class ByMathTermplanController extends BaseController
public TableDataInfo list(ByMathTermplan byMathTermplan)
{
startPage();
List<ByMathTermplan> list = byMathTermplanService.selectByMathTermplanList(byMathTermplan);
byMathTermplan.setSchoolid(SecurityUtils.getLoginUser().getUser().getDept().getDeptId());
String classId = schoolCommon.getClassId();
List<ByMathTermplan> list = null;
if (schoolCommon.isSchool() && !schoolCommon.isStringEmpty(classId)) {
byMathTermplan.setClassid(classId);
}
list = byMathTermplanService.selectByMathTermplanList(byMathTermplan);
return getDataTable(list);
}
@ -86,15 +97,32 @@ public class ByMathTermplanController extends BaseController
{
String classId = schoolCommon.getClassId();
int iCount = schoolCommon.getDifMonth(byMathTermplan.getStartmonth(), byMathTermplan.getEndmonth());
System.out.println("月份差=" + iCount);
String uuid = schoolCommon.getUuid();
byMathTermplan.setId(uuid);
byMathTermplan.setSchoolid(SecurityUtils.getLoginUser().getUser().getDept().getDeptId());
byMathTermplan.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
byMathTermplan.setClassid(classId);
byMathTermplan.setName(byClassService.selectByClassById(classId).getBjmc() + "-主题整合学期计划");
return toAjax(byMathTermplanService.insertByMathTermplan(byMathTermplan));
if (schoolCommon.isSchool() && !schoolCommon.isStringEmpty(classId)) {
int iCount = schoolCommon.getDifMonth(byMathTermplan.getStartmonth(), byMathTermplan.getEndmonth());
System.out.println("月份差=" + iCount);
String uuid = schoolCommon.getUuid();
byMathTermplan.setId(uuid);
byMathTermplan.setSchoolid(SecurityUtils.getLoginUser().getUser().getDept().getDeptId());
byMathTermplan.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
byMathTermplan.setClassid(classId);
byMathTermplan.setName(byClassService.selectByClassById(classId).getBjmc() + "-主题整合学期计划");
// 自动创建游戏数学学期计划明细
ByMathTermplanitem byMathTermplanitem = null;
for (int i = 0; i <= iCount; i++) {
byMathTermplanitem = new ByMathTermplanitem();
byMathTermplanitem.setTpid(uuid);
byMathTermplanitem.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
byMathTermplanitem.setMonth(schoolCommon.DateAddMonths(i, byMathTermplan.getStartmonth()));
//创建时间
byMathTermplanitem.setCreateTime(new Date());
//新增每月计划
byMathTermplanitemService.insertByMathTermplanitem(byMathTermplanitem);
}
return toAjax(byMathTermplanService.insertByMathTermplan(byMathTermplan));
}else {
return AjaxResult.error("当前用户非幼儿园教师,无法创建计划");
}
}
/**
@ -116,6 +144,15 @@ public class ByMathTermplanController extends BaseController
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
//首先判断当前id下是否存在子目录
for (int i = 0; i < ids.length; i++) {
ByMathTermplanitem byMathTermplanitem = new ByMathTermplanitem();
byMathTermplanitem.setTpid(ids[i]);
List<ByMathTermplanitem> list = byMathTermplanitemService.selectByMathTermplanitemList(byMathTermplanitem);
if (list != null && list.size() > 0) {
return AjaxResult.error("选中的计划下存在计划明细,无法删除");
}
}
return toAjax(byMathTermplanService.deleteByMathTermplanByIds(ids));
}

View File

@ -0,0 +1,103 @@
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.ByMathTermplanitem;
import com.ruoyi.project.benyi.service.IByMathTermplanitemService;
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-10-29
*/
@RestController
@RequestMapping("/benyi/mathtermplanitem")
public class ByMathTermplanitemController extends BaseController
{
@Autowired
private IByMathTermplanitemService byMathTermplanitemService;
/**
* 查询游戏数学学期计划明细列表
*/
@PreAuthorize("@ss.hasPermi('benyi:mathtermplan:list')")
@GetMapping("/list")
public TableDataInfo list(ByMathTermplanitem byMathTermplanitem)
{
startPage();
List<ByMathTermplanitem> list = byMathTermplanitemService.selectByMathTermplanitemList(byMathTermplanitem);
return getDataTable(list);
}
/**
* 导出游戏数学学期计划明细列表
*/
@PreAuthorize("@ss.hasPermi('benyi:mathtermplan:export')")
@Log(title = "游戏数学学期计划明细", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(ByMathTermplanitem byMathTermplanitem)
{
List<ByMathTermplanitem> list = byMathTermplanitemService.selectByMathTermplanitemList(byMathTermplanitem);
ExcelUtil<ByMathTermplanitem> util = new ExcelUtil<ByMathTermplanitem>(ByMathTermplanitem.class);
return util.exportExcel(list, "mathtermplanitem");
}
/**
* 获取游戏数学学期计划明细详细信息
*/
@PreAuthorize("@ss.hasPermi('benyi:mathtermplan:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(byMathTermplanitemService.selectByMathTermplanitemById(id));
}
/**
* 新增游戏数学学期计划明细
*/
@PreAuthorize("@ss.hasPermi('benyi:mathtermplan:add')")
@Log(title = "游戏数学学期计划明细", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ByMathTermplanitem byMathTermplanitem)
{
return toAjax(byMathTermplanitemService.insertByMathTermplanitem(byMathTermplanitem));
}
/**
* 修改游戏数学学期计划明细
*/
@PreAuthorize("@ss.hasPermi('benyi:mathtermplan:edit')")
@Log(title = "游戏数学学期计划明细", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ByMathTermplanitem byMathTermplanitem)
{
return toAjax(byMathTermplanitemService.updateByMathTermplanitem(byMathTermplanitem));
}
/**
* 删除游戏数学学期计划明细
*/
@PreAuthorize("@ss.hasPermi('benyi:mathtermplan:remove')")
@Log(title = "游戏数学学期计划明细", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(byMathTermplanitemService.deleteByMathTermplanitemByIds(ids));
}
}

View File

@ -0,0 +1,118 @@
package com.ruoyi.project.benyi.domain;
import java.util.Date;
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;
/**
* 游戏数学学期计划明细对象 by_math_termplanitem
*
* @author tsbz
* @date 2020-10-29
*/
public class ByMathTermplanitem extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 编号
*/
private Long id;
/**
* 所属计划
*/
@Excel(name = "所属计划")
private String tpid;
/**
* 月份
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "月份", width = 30, dateFormat = "yyyy-MM-dd")
private Date month;
/**
* 游戏数学内容
*/
@Excel(name = "游戏数学内容")
private String mathconent;
/**
* 创建人
*/
@Excel(name = "创建人")
private Long createuserid;
/**
* 修改人
*/
@Excel(name = "修改人")
private Long updateuserid;
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setTpid(String tpid) {
this.tpid = tpid;
}
public String getTpid() {
return tpid;
}
public void setMonth(Date month) {
this.month = month;
}
public Date getMonth() {
return month;
}
public void setMathconent(String mathconent) {
this.mathconent = mathconent;
}
public String getMathconent() {
return mathconent;
}
public void setCreateuserid(Long createuserid) {
this.createuserid = createuserid;
}
public Long getCreateuserid() {
return createuserid;
}
public void setUpdateuserid(Long updateuserid) {
this.updateuserid = updateuserid;
}
public Long getUpdateuserid() {
return updateuserid;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("tpid", getTpid())
.append("month", getMonth())
.append("mathconent", getMathconent())
.append("remark", getRemark())
.append("createuserid", getCreateuserid())
.append("createTime", getCreateTime())
.append("updateuserid", getUpdateuserid())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.project.benyi.mapper;
import java.util.List;
import com.ruoyi.project.benyi.domain.ByMathTermplanitem;
/**
* 游戏数学学期计划明细Mapper接口
*
* @author tsbz
* @date 2020-10-29
*/
public interface ByMathTermplanitemMapper
{
/**
* 查询游戏数学学期计划明细
*
* @param id 游戏数学学期计划明细ID
* @return 游戏数学学期计划明细
*/
public ByMathTermplanitem selectByMathTermplanitemById(Long id);
/**
* 查询游戏数学学期计划明细列表
*
* @param byMathTermplanitem 游戏数学学期计划明细
* @return 游戏数学学期计划明细集合
*/
public List<ByMathTermplanitem> selectByMathTermplanitemList(ByMathTermplanitem byMathTermplanitem);
/**
* 新增游戏数学学期计划明细
*
* @param byMathTermplanitem 游戏数学学期计划明细
* @return 结果
*/
public int insertByMathTermplanitem(ByMathTermplanitem byMathTermplanitem);
/**
* 修改游戏数学学期计划明细
*
* @param byMathTermplanitem 游戏数学学期计划明细
* @return 结果
*/
public int updateByMathTermplanitem(ByMathTermplanitem byMathTermplanitem);
/**
* 删除游戏数学学期计划明细
*
* @param id 游戏数学学期计划明细ID
* @return 结果
*/
public int deleteByMathTermplanitemById(Long id);
/**
* 批量删除游戏数学学期计划明细
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteByMathTermplanitemByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.project.benyi.service;
import java.util.List;
import com.ruoyi.project.benyi.domain.ByMathTermplanitem;
/**
* 游戏数学学期计划明细Service接口
*
* @author tsbz
* @date 2020-10-29
*/
public interface IByMathTermplanitemService
{
/**
* 查询游戏数学学期计划明细
*
* @param id 游戏数学学期计划明细ID
* @return 游戏数学学期计划明细
*/
public ByMathTermplanitem selectByMathTermplanitemById(Long id);
/**
* 查询游戏数学学期计划明细列表
*
* @param byMathTermplanitem 游戏数学学期计划明细
* @return 游戏数学学期计划明细集合
*/
public List<ByMathTermplanitem> selectByMathTermplanitemList(ByMathTermplanitem byMathTermplanitem);
/**
* 新增游戏数学学期计划明细
*
* @param byMathTermplanitem 游戏数学学期计划明细
* @return 结果
*/
public int insertByMathTermplanitem(ByMathTermplanitem byMathTermplanitem);
/**
* 修改游戏数学学期计划明细
*
* @param byMathTermplanitem 游戏数学学期计划明细
* @return 结果
*/
public int updateByMathTermplanitem(ByMathTermplanitem byMathTermplanitem);
/**
* 批量删除游戏数学学期计划明细
*
* @param ids 需要删除的游戏数学学期计划明细ID
* @return 结果
*/
public int deleteByMathTermplanitemByIds(Long[] ids);
/**
* 删除游戏数学学期计划明细信息
*
* @param id 游戏数学学期计划明细ID
* @return 结果
*/
public int deleteByMathTermplanitemById(Long id);
}

View File

@ -0,0 +1,96 @@
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.ByMathTermplanitemMapper;
import com.ruoyi.project.benyi.domain.ByMathTermplanitem;
import com.ruoyi.project.benyi.service.IByMathTermplanitemService;
/**
* 游戏数学学期计划明细Service业务层处理
*
* @author tsbz
* @date 2020-10-29
*/
@Service
public class ByMathTermplanitemServiceImpl implements IByMathTermplanitemService
{
@Autowired
private ByMathTermplanitemMapper byMathTermplanitemMapper;
/**
* 查询游戏数学学期计划明细
*
* @param id 游戏数学学期计划明细ID
* @return 游戏数学学期计划明细
*/
@Override
public ByMathTermplanitem selectByMathTermplanitemById(Long id)
{
return byMathTermplanitemMapper.selectByMathTermplanitemById(id);
}
/**
* 查询游戏数学学期计划明细列表
*
* @param byMathTermplanitem 游戏数学学期计划明细
* @return 游戏数学学期计划明细
*/
@Override
public List<ByMathTermplanitem> selectByMathTermplanitemList(ByMathTermplanitem byMathTermplanitem)
{
return byMathTermplanitemMapper.selectByMathTermplanitemList(byMathTermplanitem);
}
/**
* 新增游戏数学学期计划明细
*
* @param byMathTermplanitem 游戏数学学期计划明细
* @return 结果
*/
@Override
public int insertByMathTermplanitem(ByMathTermplanitem byMathTermplanitem)
{
byMathTermplanitem.setCreateTime(DateUtils.getNowDate());
return byMathTermplanitemMapper.insertByMathTermplanitem(byMathTermplanitem);
}
/**
* 修改游戏数学学期计划明细
*
* @param byMathTermplanitem 游戏数学学期计划明细
* @return 结果
*/
@Override
public int updateByMathTermplanitem(ByMathTermplanitem byMathTermplanitem)
{
byMathTermplanitem.setUpdateTime(DateUtils.getNowDate());
return byMathTermplanitemMapper.updateByMathTermplanitem(byMathTermplanitem);
}
/**
* 批量删除游戏数学学期计划明细
*
* @param ids 需要删除的游戏数学学期计划明细ID
* @return 结果
*/
@Override
public int deleteByMathTermplanitemByIds(Long[] ids)
{
return byMathTermplanitemMapper.deleteByMathTermplanitemByIds(ids);
}
/**
* 删除游戏数学学期计划明细信息
*
* @param id 游戏数学学期计划明细ID
* @return 结果
*/
@Override
public int deleteByMathTermplanitemById(Long id)
{
return byMathTermplanitemMapper.deleteByMathTermplanitemById(id);
}
}

View File

@ -0,0 +1,89 @@
<?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.ByMathTermplanitemMapper">
<resultMap type="ByMathTermplanitem" id="ByMathTermplanitemResult">
<result property="id" column="id" />
<result property="tpid" column="tpid" />
<result property="month" column="month" />
<result property="mathconent" column="mathconent" />
<result property="remark" column="remark" />
<result property="createuserid" column="createuserid" />
<result property="createTime" column="create_time" />
<result property="updateuserid" column="updateuserid" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectByMathTermplanitemVo">
select id, tpid, month, mathconent, remark, createuserid, create_time, updateuserid, update_time from by_math_termplanitem
</sql>
<select id="selectByMathTermplanitemList" parameterType="ByMathTermplanitem" resultMap="ByMathTermplanitemResult">
<include refid="selectByMathTermplanitemVo"/>
<where>
<if test="tpid != null and tpid != ''"> and tpid = #{tpid}</if>
<if test="month != null "> and month = #{month}</if>
<if test="mathconent != null and mathconent != ''"> and mathconent = #{mathconent}</if>
<if test="createuserid != null "> and createuserid = #{createuserid}</if>
<if test="updateuserid != null "> and updateuserid = #{updateuserid}</if>
</where>
</select>
<select id="selectByMathTermplanitemById" parameterType="Long" resultMap="ByMathTermplanitemResult">
<include refid="selectByMathTermplanitemVo"/>
where id = #{id}
</select>
<insert id="insertByMathTermplanitem" parameterType="ByMathTermplanitem" useGeneratedKeys="true" keyProperty="id">
insert into by_math_termplanitem
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tpid != null and tpid != ''">tpid,</if>
<if test="month != null ">month,</if>
<if test="mathconent != null and mathconent != ''">mathconent,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createuserid != null ">createuserid,</if>
<if test="createTime != null ">create_time,</if>
<if test="updateuserid != null ">updateuserid,</if>
<if test="updateTime != null ">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tpid != null and tpid != ''">#{tpid},</if>
<if test="month != null ">#{month},</if>
<if test="mathconent != null and mathconent != ''">#{mathconent},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createuserid != null ">#{createuserid},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="updateuserid != null ">#{updateuserid},</if>
<if test="updateTime != null ">#{updateTime},</if>
</trim>
</insert>
<update id="updateByMathTermplanitem" parameterType="ByMathTermplanitem">
update by_math_termplanitem
<trim prefix="SET" suffixOverrides=",">
<if test="tpid != null and tpid != ''">tpid = #{tpid},</if>
<if test="month != null ">month = #{month},</if>
<if test="mathconent != null and mathconent != ''">mathconent = #{mathconent},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="createuserid != null ">createuserid = #{createuserid},</if>
<if test="createTime != null ">create_time = #{createTime},</if>
<if test="updateuserid != null ">updateuserid = #{updateuserid},</if>
<if test="updateTime != null ">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteByMathTermplanitemById" parameterType="Long">
delete from by_math_termplanitem where id = #{id}
</delete>
<delete id="deleteByMathTermplanitemByIds" parameterType="String">
delete from by_math_termplanitem where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>