diff --git a/ruoyi-ui/src/views/benyi/schoolcalendar/index.vue b/ruoyi-ui/src/views/benyi/schoolcalendar/index.vue index 20317ddb3..8942bfa81 100644 --- a/ruoyi-ui/src/views/benyi/schoolcalendar/index.vue +++ b/ruoyi-ui/src/views/benyi/schoolcalendar/index.vue @@ -95,7 +95,7 @@ :data="schoolcalendarList" @selection-change="handleSelectionChange" > - <el-table-column type="selection" width="55" align="center" /> + <el-table-column type="selection" width="55" align="center" :selectable="checkSelectable" /> <el-table-column label="编号" align="center" prop="id" /> <el-table-column label="名称" align="center" prop="name" /> <el-table-column @@ -120,6 +120,7 @@ icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['benyi:schoolcalendar:edit']" + :disabled="!checkSelectable(scope.row)" >修改</el-button> <el-button size="mini" @@ -127,6 +128,7 @@ icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['benyi:schoolcalendar:remove']" + :disabled="!checkSelectable(scope.row)" >删除</el-button> </template> </el-table-column> @@ -224,6 +226,8 @@ export default { scopeOptions: [], //学年学期 xnxqOptions: [], + //声明方法 + selectable: Function, // 查询参数 queryParams: { pageNum: 1, @@ -271,6 +275,16 @@ export default { schoolcalendartypeFormat(row, column) { return this.selectDictLabel(this.schoolcalendartypeOptions, row.type); }, + //控制按钮可用 + checkSelectable(row) { + var date = new Date(); + //console.log(date.toLocaleDateString()); + return this.CompareDate(row.activitytime, date.toLocaleDateString()); + }, + //比较日期大小 + CompareDate(d1, d2) { + return new Date(d1.replace(/-/g, "/")) > new Date(d2.replace(/-/g, "/")); + }, // 适用范围类型--字典状态字典翻译 scopeFormat(row, column) { //alert(row.scope.split(';').length); diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByDayFlowDetailController.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByDayFlowDetailController.java new file mode 100644 index 000000000..a7763c013 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByDayFlowDetailController.java @@ -0,0 +1,108 @@ +package com.ruoyi.project.benyi.controller; + +import java.util.Date; +import java.util.List; + +import com.ruoyi.common.utils.SecurityUtils; +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.ByDayFlowDetail; +import com.ruoyi.project.benyi.service.IByDayFlowDetailService; +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-05-07 + */ +@RestController +@RequestMapping("/benyi/dayflowmanger") +public class ByDayFlowDetailController extends BaseController +{ + @Autowired + private IByDayFlowDetailService byDayFlowDetailService; + + /** + * 查询一日流程列表 + */ + @PreAuthorize("@ss.hasPermi('benyi:dayflowmanger:list')") + @GetMapping("/list") + public TableDataInfo list(ByDayFlowDetail byDayFlowDetail) + { + startPage(); + List<ByDayFlowDetail> list = byDayFlowDetailService.selectByDayFlowDetailList(byDayFlowDetail); + return getDataTable(list); + } + + /** + * 导出一日流程列表 + */ + @PreAuthorize("@ss.hasPermi('benyi:dayflowmanger:export')") + @Log(title = "一日流程", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public AjaxResult export(ByDayFlowDetail byDayFlowDetail) + { + List<ByDayFlowDetail> list = byDayFlowDetailService.selectByDayFlowDetailList(byDayFlowDetail); + ExcelUtil<ByDayFlowDetail> util = new ExcelUtil<ByDayFlowDetail>(ByDayFlowDetail.class); + return util.exportExcel(list, "detail"); + } + + /** + * 获取一日流程详细信息 + */ + @PreAuthorize("@ss.hasPermi('benyi:dayflowmanger:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(byDayFlowDetailService.selectByDayFlowDetailById(id)); + } + + /** + * 新增一日流程 + */ + @PreAuthorize("@ss.hasPermi('benyi:dayflowmanger:add')") + @Log(title = "一日流程", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ByDayFlowDetail byDayFlowDetail) + { + byDayFlowDetail.setCreateUser(SecurityUtils.getLoginUser().getUser().getUserId()); + return toAjax(byDayFlowDetailService.insertByDayFlowDetail(byDayFlowDetail)); + } + + /** + * 修改一日流程 + */ + @PreAuthorize("@ss.hasPermi('benyi:dayflowmanger:edit')") + @Log(title = "一日流程", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ByDayFlowDetail byDayFlowDetail) + { + byDayFlowDetail.setUpdateUser(SecurityUtils.getLoginUser().getUser().getUserId()); + return toAjax(byDayFlowDetailService.updateByDayFlowDetail(byDayFlowDetail)); + } + + /** + * 删除一日流程 + */ + @PreAuthorize("@ss.hasPermi('benyi:dayflowmanger:remove')") + @Log(title = "一日流程", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(byDayFlowDetailService.deleteByDayFlowDetailByIds(ids)); + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/BySchoolcalendarController.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/BySchoolcalendarController.java index e270d064c..9ceb56faf 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/BySchoolcalendarController.java +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/BySchoolcalendarController.java @@ -187,6 +187,7 @@ public class BySchoolcalendarController extends BaseController { public AjaxResult edit(@RequestBody BySchoolcalendar bySchoolcalendar) { //首先判断 当前用户是否为学校 if (schoolCommon.isSchool()) { + //应该判断记录是否在修改的时间范围内 return toAjax(bySchoolcalendarService.updateBySchoolcalendar(bySchoolcalendar)); } else { return AjaxResult.error("当前用户非幼儿园,无法编辑园历"); @@ -202,6 +203,7 @@ public class BySchoolcalendarController extends BaseController { public AjaxResult remove(@PathVariable Long[] ids) { //首先判断 当前用户是否为学校 if (schoolCommon.isSchool()) { + //应该判断记录是否在删除的时间范围内 return toAjax(bySchoolcalendarService.deleteBySchoolcalendarByIds(ids)); } else { return AjaxResult.error("当前用户非幼儿园,无法删除园历"); diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByDayFlowDetail.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByDayFlowDetail.java new file mode 100644 index 000000000..fb89b0ff9 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByDayFlowDetail.java @@ -0,0 +1,151 @@ +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_day_flow_detail + * + * @author tsbz + * @date 2020-05-07 + */ +public class ByDayFlowDetail extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 流程ID */ + private Long id; + + /** 流程序号 */ + @Excel(name = "流程序号") + private Long sortNumber; + + /** 标准数量 */ + @Excel(name = "标准数量") + private Long targetCount; + + /** 名称 */ + @Excel(name = "名称") + private String name; + + /** 导言 */ + @Excel(name = "导言") + private String content; + + /** 目的 */ + @Excel(name = "目的") + private String note; + + /** 类型(1标准,2相关) */ + @Excel(name = "类型", readConverterExp = "1=标准,2相关") + private String flowType; + + /** 创建人 */ + @Excel(name = "创建人") + private Long createUser; + + /** 修改人 */ + @Excel(name = "修改人") + private Long updateUser; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setSortNumber(Long sortNumber) + { + this.sortNumber = sortNumber; + } + + public Long getSortNumber() + { + return sortNumber; + } + public void setTargetCount(Long targetCount) + { + this.targetCount = targetCount; + } + + public Long getTargetCount() + { + return targetCount; + } + public void setName(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + public void setContent(String content) + { + this.content = content; + } + + public String getContent() + { + return content; + } + public void setNote(String note) + { + this.note = note; + } + + public String getNote() + { + return note; + } + public void setFlowType(String flowType) + { + this.flowType = flowType; + } + + public String getFlowType() + { + return flowType; + } + public void setCreateUser(Long createUser) + { + this.createUser = createUser; + } + + public Long getCreateUser() + { + return createUser; + } + public void setUpdateUser(Long updateUser) + { + this.updateUser = updateUser; + } + + public Long getUpdateUser() + { + return updateUser; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("sortNumber", getSortNumber()) + .append("targetCount", getTargetCount()) + .append("name", getName()) + .append("content", getContent()) + .append("note", getNote()) + .append("flowType", getFlowType()) + .append("createUser", getCreateUser()) + .append("updateUser", getUpdateUser()) + .append("createTime", getCreateTime()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/ByDayFlowDetailMapper.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/ByDayFlowDetailMapper.java new file mode 100644 index 000000000..4dfd53236 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/ByDayFlowDetailMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.project.benyi.mapper; + +import java.util.List; +import com.ruoyi.project.benyi.domain.ByDayFlowDetail; + +/** + * 一日流程Mapper接口 + * + * @author tsbz + * @date 2020-05-07 + */ +public interface ByDayFlowDetailMapper +{ + /** + * 查询一日流程 + * + * @param id 一日流程ID + * @return 一日流程 + */ + public ByDayFlowDetail selectByDayFlowDetailById(Long id); + + /** + * 查询一日流程列表 + * + * @param byDayFlowDetail 一日流程 + * @return 一日流程集合 + */ + public List<ByDayFlowDetail> selectByDayFlowDetailList(ByDayFlowDetail byDayFlowDetail); + + /** + * 新增一日流程 + * + * @param byDayFlowDetail 一日流程 + * @return 结果 + */ + public int insertByDayFlowDetail(ByDayFlowDetail byDayFlowDetail); + + /** + * 修改一日流程 + * + * @param byDayFlowDetail 一日流程 + * @return 结果 + */ + public int updateByDayFlowDetail(ByDayFlowDetail byDayFlowDetail); + + /** + * 删除一日流程 + * + * @param id 一日流程ID + * @return 结果 + */ + public int deleteByDayFlowDetailById(Long id); + + /** + * 批量删除一日流程 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteByDayFlowDetailByIds(Long[] ids); +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IByDayFlowDetailService.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IByDayFlowDetailService.java new file mode 100644 index 000000000..46aacb8d1 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IByDayFlowDetailService.java @@ -0,0 +1,61 @@ +package com.ruoyi.project.benyi.service; + +import java.util.List; +import com.ruoyi.project.benyi.domain.ByDayFlowDetail; + +/** + * 一日流程Service接口 + * + * @author tsbz + * @date 2020-05-07 + */ +public interface IByDayFlowDetailService +{ + /** + * 查询一日流程 + * + * @param id 一日流程ID + * @return 一日流程 + */ + public ByDayFlowDetail selectByDayFlowDetailById(Long id); + + /** + * 查询一日流程列表 + * + * @param byDayFlowDetail 一日流程 + * @return 一日流程集合 + */ + public List<ByDayFlowDetail> selectByDayFlowDetailList(ByDayFlowDetail byDayFlowDetail); + + /** + * 新增一日流程 + * + * @param byDayFlowDetail 一日流程 + * @return 结果 + */ + public int insertByDayFlowDetail(ByDayFlowDetail byDayFlowDetail); + + /** + * 修改一日流程 + * + * @param byDayFlowDetail 一日流程 + * @return 结果 + */ + public int updateByDayFlowDetail(ByDayFlowDetail byDayFlowDetail); + + /** + * 批量删除一日流程 + * + * @param ids 需要删除的一日流程ID + * @return 结果 + */ + public int deleteByDayFlowDetailByIds(Long[] ids); + + /** + * 删除一日流程信息 + * + * @param id 一日流程ID + * @return 结果 + */ + public int deleteByDayFlowDetailById(Long id); +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/ByDayFlowDetailServiceImpl.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/ByDayFlowDetailServiceImpl.java new file mode 100644 index 000000000..1b7274234 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/ByDayFlowDetailServiceImpl.java @@ -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.ByDayFlowDetailMapper; +import com.ruoyi.project.benyi.domain.ByDayFlowDetail; +import com.ruoyi.project.benyi.service.IByDayFlowDetailService; + +/** + * 一日流程Service业务层处理 + * + * @author tsbz + * @date 2020-05-07 + */ +@Service +public class ByDayFlowDetailServiceImpl implements IByDayFlowDetailService +{ + @Autowired + private ByDayFlowDetailMapper byDayFlowDetailMapper; + + /** + * 查询一日流程 + * + * @param id 一日流程ID + * @return 一日流程 + */ + @Override + public ByDayFlowDetail selectByDayFlowDetailById(Long id) + { + return byDayFlowDetailMapper.selectByDayFlowDetailById(id); + } + + /** + * 查询一日流程列表 + * + * @param byDayFlowDetail 一日流程 + * @return 一日流程 + */ + @Override + public List<ByDayFlowDetail> selectByDayFlowDetailList(ByDayFlowDetail byDayFlowDetail) + { + return byDayFlowDetailMapper.selectByDayFlowDetailList(byDayFlowDetail); + } + + /** + * 新增一日流程 + * + * @param byDayFlowDetail 一日流程 + * @return 结果 + */ + @Override + public int insertByDayFlowDetail(ByDayFlowDetail byDayFlowDetail) + { + byDayFlowDetail.setCreateTime(DateUtils.getNowDate()); + return byDayFlowDetailMapper.insertByDayFlowDetail(byDayFlowDetail); + } + + /** + * 修改一日流程 + * + * @param byDayFlowDetail 一日流程 + * @return 结果 + */ + @Override + public int updateByDayFlowDetail(ByDayFlowDetail byDayFlowDetail) + { + byDayFlowDetail.setUpdateTime(DateUtils.getNowDate()); + return byDayFlowDetailMapper.updateByDayFlowDetail(byDayFlowDetail); + } + + /** + * 批量删除一日流程 + * + * @param ids 需要删除的一日流程ID + * @return 结果 + */ + @Override + public int deleteByDayFlowDetailByIds(Long[] ids) + { + return byDayFlowDetailMapper.deleteByDayFlowDetailByIds(ids); + } + + /** + * 删除一日流程信息 + * + * @param id 一日流程ID + * @return 结果 + */ + @Override + public int deleteByDayFlowDetailById(Long id) + { + return byDayFlowDetailMapper.deleteByDayFlowDetailById(id); + } +} diff --git a/ruoyi/src/main/resources/mybatis/benyi/ByDayFlowDetailMapper.xml b/ruoyi/src/main/resources/mybatis/benyi/ByDayFlowDetailMapper.xml new file mode 100644 index 000000000..81adc2134 --- /dev/null +++ b/ruoyi/src/main/resources/mybatis/benyi/ByDayFlowDetailMapper.xml @@ -0,0 +1,100 @@ +<?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.ByDayFlowDetailMapper"> + + <resultMap type="ByDayFlowDetail" id="ByDayFlowDetailResult"> + <result property="id" column="id" /> + <result property="sortNumber" column="sort_number" /> + <result property="targetCount" column="target_count" /> + <result property="name" column="name" /> + <result property="content" column="content" /> + <result property="note" column="note" /> + <result property="flowType" column="flow_type" /> + <result property="createUser" column="create_user" /> + <result property="updateUser" column="update_user" /> + <result property="createTime" column="create_time" /> + <result property="updateTime" column="update_time" /> + </resultMap> + + <sql id="selectByDayFlowDetailVo"> + select id, sort_number, target_count, name, content, note, flow_type, create_user, update_user, create_time, update_time from by_day_flow_detail + </sql> + + <select id="selectByDayFlowDetailList" parameterType="ByDayFlowDetail" resultMap="ByDayFlowDetailResult"> + <include refid="selectByDayFlowDetailVo"/> + <where> + <if test="sortNumber != null "> and sort_number = #{sortNumber}</if> + <if test="targetCount != null "> and target_count = #{targetCount}</if> + <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> + <if test="content != null and content != ''"> and content = #{content}</if> + <if test="note != null and note != ''"> and note = #{note}</if> + <if test="flowType != null "> and flow_type = #{flowType}</if> + <if test="createUser != null "> and create_user = #{createUser}</if> + <if test="updateUser != null "> and update_user = #{updateUser}</if> + </where> + </select> + + <select id="selectByDayFlowDetailById" parameterType="Long" resultMap="ByDayFlowDetailResult"> + <include refid="selectByDayFlowDetailVo"/> + where id = #{id} + </select> + + <insert id="insertByDayFlowDetail" parameterType="ByDayFlowDetail" useGeneratedKeys="true" keyProperty="id"> + insert into by_day_flow_detail + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="sortNumber != null ">sort_number,</if> + <if test="targetCount != null ">target_count,</if> + <if test="name != null and name != ''">name,</if> + <if test="content != null and content != ''">content,</if> + <if test="note != null and note != ''">note,</if> + <if test="flowType != null ">flow_type,</if> + <if test="createUser != null ">create_user,</if> + <if test="updateUser != null ">update_user,</if> + <if test="createTime != null ">create_time,</if> + <if test="updateTime != null ">update_time,</if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="sortNumber != null ">#{sortNumber},</if> + <if test="targetCount != null ">#{targetCount},</if> + <if test="name != null and name != ''">#{name},</if> + <if test="content != null and content != ''">#{content},</if> + <if test="note != null and note != ''">#{note},</if> + <if test="flowType != null ">#{flowType},</if> + <if test="createUser != null ">#{createUser},</if> + <if test="updateUser != null ">#{updateUser},</if> + <if test="createTime != null ">#{createTime},</if> + <if test="updateTime != null ">#{updateTime},</if> + </trim> + </insert> + + <update id="updateByDayFlowDetail" parameterType="ByDayFlowDetail"> + update by_day_flow_detail + <trim prefix="SET" suffixOverrides=","> + <if test="sortNumber != null ">sort_number = #{sortNumber},</if> + <if test="targetCount != null ">target_count = #{targetCount},</if> + <if test="name != null and name != ''">name = #{name},</if> + <if test="content != null and content != ''">content = #{content},</if> + <if test="note != null and note != ''">note = #{note},</if> + <if test="flowType != null ">flow_type = #{flowType},</if> + <if test="createUser != null ">create_user = #{createUser},</if> + <if test="updateUser != null ">update_user = #{updateUser},</if> + <if test="createTime != null ">create_time = #{createTime},</if> + <if test="updateTime != null ">update_time = #{updateTime},</if> + </trim> + where id = #{id} + </update> + + <delete id="deleteByDayFlowDetailById" parameterType="Long"> + delete from by_day_flow_detail where id = #{id} + </delete> + + <delete id="deleteByDayFlowDetailByIds" parameterType="String"> + delete from by_day_flow_detail where id in + <foreach item="id" collection="array" open="(" separator="," close=")"> + #{id} + </foreach> + </delete> + +</mapper> \ No newline at end of file