20200728-入园通知书
This commit is contained in:
@ -0,0 +1,136 @@
|
||||
package com.ruoyi.project.benyi.controller;
|
||||
|
||||
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.ByRecruitstudentsNotice;
|
||||
import com.ruoyi.project.benyi.service.IByRecruitstudentsNoticeService;
|
||||
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-07-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/benyi/recruitstudentsnotice")
|
||||
public class ByRecruitstudentsNoticeController extends BaseController {
|
||||
@Autowired
|
||||
private IByRecruitstudentsNoticeService byRecruitstudentsNoticeService;
|
||||
@Autowired
|
||||
private SchoolCommon schoolCommon;
|
||||
|
||||
/**
|
||||
* 查询入园通知书列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:recruitstudentsnotice:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ByRecruitstudentsNotice byRecruitstudentsNotice) {
|
||||
byRecruitstudentsNotice.setSchoolid(SecurityUtils.getLoginUser().getUser().getDept().getDeptId());
|
||||
startPage();
|
||||
List<ByRecruitstudentsNotice> list = byRecruitstudentsNoticeService.selectByRecruitstudentsNoticeList(byRecruitstudentsNotice);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出入园通知书列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:recruitstudentsnotice:export')")
|
||||
@Log(title = "入园通知书", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(ByRecruitstudentsNotice byRecruitstudentsNotice) {
|
||||
List<ByRecruitstudentsNotice> list = byRecruitstudentsNoticeService.selectByRecruitstudentsNoticeList(byRecruitstudentsNotice);
|
||||
ExcelUtil<ByRecruitstudentsNotice> util = new ExcelUtil<ByRecruitstudentsNotice>(ByRecruitstudentsNotice.class);
|
||||
return util.exportExcel(list, "notice");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取入园通知书详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:recruitstudentsnotice:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(byRecruitstudentsNoticeService.selectByRecruitstudentsNoticeById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增入园通知书
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:recruitstudentsnotice:add')")
|
||||
@Log(title = "入园通知书", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ByRecruitstudentsNotice byRecruitstudentsNotice) {
|
||||
//首先判断当前账户是否为幼儿园账号
|
||||
if (schoolCommon.isSchool()) {
|
||||
byRecruitstudentsNotice.setType("2");
|
||||
byRecruitstudentsNotice.setSchoolid(SecurityUtils.getLoginUser().getUser().getDept().getDeptId());
|
||||
} else {
|
||||
byRecruitstudentsNotice.setType("1");
|
||||
}
|
||||
return toAjax(byRecruitstudentsNoticeService.insertByRecruitstudentsNotice(byRecruitstudentsNotice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改入园通知书
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:recruitstudentsnotice:edit')")
|
||||
@Log(title = "入园通知书", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ByRecruitstudentsNotice byRecruitstudentsNotice) {
|
||||
return toAjax(byRecruitstudentsNoticeService.updateByRecruitstudentsNotice(byRecruitstudentsNotice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除入园通知书
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:recruitstudentsnotice:edit')")
|
||||
@Log(title = "入园通知书", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/copy/{id}")
|
||||
public AjaxResult copy(@PathVariable Long id) {
|
||||
System.out.println("id===" + id);
|
||||
ByRecruitstudentsNotice byRecruitstudentsNotice = byRecruitstudentsNoticeService.selectByRecruitstudentsNoticeById(id);
|
||||
ByRecruitstudentsNotice byRecruitstudentsNoticeCopy = new ByRecruitstudentsNotice();
|
||||
byRecruitstudentsNoticeCopy.setType("2");
|
||||
byRecruitstudentsNoticeCopy.setSchoolid(SecurityUtils.getLoginUser().getUser().getDept().getDeptId());
|
||||
byRecruitstudentsNoticeCopy.setContent(byRecruitstudentsNotice.getContent());
|
||||
byRecruitstudentsNoticeCopy.setTitle(byRecruitstudentsNotice.getTitle());
|
||||
|
||||
return toAjax(byRecruitstudentsNoticeService.insertByRecruitstudentsNotice(byRecruitstudentsNoticeCopy));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除入园通知书
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:recruitstudentsnotice:remove')")
|
||||
@Log(title = "入园通知书", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
//判断id是否为系统定义
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
Long id = ids[i];
|
||||
ByRecruitstudentsNotice byRecruitstudentsNotice = byRecruitstudentsNoticeService.selectByRecruitstudentsNoticeById(id);
|
||||
if (byRecruitstudentsNotice.getType() == "1") {
|
||||
return AjaxResult.error("包含系统通知书,无法删除");
|
||||
}
|
||||
}
|
||||
|
||||
return toAjax(byRecruitstudentsNoticeService.deleteByRecruitstudentsNoticeByIds(ids));
|
||||
}
|
||||
}
|
@ -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_recruitstudents_notice
|
||||
*
|
||||
* @author tsbz
|
||||
* @date 2020-07-28
|
||||
*/
|
||||
public class ByRecruitstudentsNotice extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@Excel(name = "标题")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
@Excel(name = "内容")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@Excel(name = "类型")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 所属学校
|
||||
*/
|
||||
@Excel(name = "所属学校")
|
||||
private Long schoolid;
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
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 setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setSchoolid(Long schoolid) {
|
||||
this.schoolid = schoolid;
|
||||
}
|
||||
|
||||
public Long getSchoolid() {
|
||||
return schoolid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("title", getTitle())
|
||||
.append("content", getContent())
|
||||
.append("type", getType())
|
||||
.append("schoolid", getSchoolid())
|
||||
.append("createTime", getCreateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.project.benyi.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.project.benyi.domain.ByRecruitstudentsNotice;
|
||||
|
||||
/**
|
||||
* 入园通知书Mapper接口
|
||||
*
|
||||
* @author tsbz
|
||||
* @date 2020-07-28
|
||||
*/
|
||||
public interface ByRecruitstudentsNoticeMapper
|
||||
{
|
||||
/**
|
||||
* 查询入园通知书
|
||||
*
|
||||
* @param id 入园通知书ID
|
||||
* @return 入园通知书
|
||||
*/
|
||||
public ByRecruitstudentsNotice selectByRecruitstudentsNoticeById(Long id);
|
||||
|
||||
/**
|
||||
* 查询入园通知书列表
|
||||
*
|
||||
* @param byRecruitstudentsNotice 入园通知书
|
||||
* @return 入园通知书集合
|
||||
*/
|
||||
public List<ByRecruitstudentsNotice> selectByRecruitstudentsNoticeList(ByRecruitstudentsNotice byRecruitstudentsNotice);
|
||||
|
||||
/**
|
||||
* 新增入园通知书
|
||||
*
|
||||
* @param byRecruitstudentsNotice 入园通知书
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertByRecruitstudentsNotice(ByRecruitstudentsNotice byRecruitstudentsNotice);
|
||||
|
||||
/**
|
||||
* 修改入园通知书
|
||||
*
|
||||
* @param byRecruitstudentsNotice 入园通知书
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateByRecruitstudentsNotice(ByRecruitstudentsNotice byRecruitstudentsNotice);
|
||||
|
||||
/**
|
||||
* 删除入园通知书
|
||||
*
|
||||
* @param id 入园通知书ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteByRecruitstudentsNoticeById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除入园通知书
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteByRecruitstudentsNoticeByIds(Long[] ids);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.project.benyi.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.project.benyi.domain.ByRecruitstudentsNotice;
|
||||
|
||||
/**
|
||||
* 入园通知书Service接口
|
||||
*
|
||||
* @author tsbz
|
||||
* @date 2020-07-28
|
||||
*/
|
||||
public interface IByRecruitstudentsNoticeService {
|
||||
/**
|
||||
* 查询入园通知书
|
||||
*
|
||||
* @param id 入园通知书ID
|
||||
* @return 入园通知书
|
||||
*/
|
||||
public ByRecruitstudentsNotice selectByRecruitstudentsNoticeById(Long id);
|
||||
|
||||
/**
|
||||
* 查询入园通知书列表
|
||||
*
|
||||
* @param byRecruitstudentsNotice 入园通知书
|
||||
* @return 入园通知书集合
|
||||
*/
|
||||
public List<ByRecruitstudentsNotice> selectByRecruitstudentsNoticeList(ByRecruitstudentsNotice byRecruitstudentsNotice);
|
||||
|
||||
/**
|
||||
* 新增入园通知书
|
||||
*
|
||||
* @param byRecruitstudentsNotice 入园通知书
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertByRecruitstudentsNotice(ByRecruitstudentsNotice byRecruitstudentsNotice);
|
||||
|
||||
/**
|
||||
* 修改入园通知书
|
||||
*
|
||||
* @param byRecruitstudentsNotice 入园通知书
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateByRecruitstudentsNotice(ByRecruitstudentsNotice byRecruitstudentsNotice);
|
||||
|
||||
/**
|
||||
* 批量删除入园通知书
|
||||
*
|
||||
* @param ids 需要删除的入园通知书ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteByRecruitstudentsNoticeByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除入园通知书信息
|
||||
*
|
||||
* @param id 入园通知书ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteByRecruitstudentsNoticeById(Long id);
|
||||
}
|
@ -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.ByRecruitstudentsNoticeMapper;
|
||||
import com.ruoyi.project.benyi.domain.ByRecruitstudentsNotice;
|
||||
import com.ruoyi.project.benyi.service.IByRecruitstudentsNoticeService;
|
||||
|
||||
/**
|
||||
* 入园通知书Service业务层处理
|
||||
*
|
||||
* @author tsbz
|
||||
* @date 2020-07-28
|
||||
*/
|
||||
@Service
|
||||
public class ByRecruitstudentsNoticeServiceImpl implements IByRecruitstudentsNoticeService {
|
||||
@Autowired
|
||||
private ByRecruitstudentsNoticeMapper byRecruitstudentsNoticeMapper;
|
||||
|
||||
/**
|
||||
* 查询入园通知书
|
||||
*
|
||||
* @param id 入园通知书ID
|
||||
* @return 入园通知书
|
||||
*/
|
||||
@Override
|
||||
public ByRecruitstudentsNotice selectByRecruitstudentsNoticeById(Long id) {
|
||||
return byRecruitstudentsNoticeMapper.selectByRecruitstudentsNoticeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询入园通知书列表
|
||||
*
|
||||
* @param byRecruitstudentsNotice 入园通知书
|
||||
* @return 入园通知书
|
||||
*/
|
||||
@Override
|
||||
public List<ByRecruitstudentsNotice> selectByRecruitstudentsNoticeList(ByRecruitstudentsNotice byRecruitstudentsNotice) {
|
||||
return byRecruitstudentsNoticeMapper.selectByRecruitstudentsNoticeList(byRecruitstudentsNotice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增入园通知书
|
||||
*
|
||||
* @param byRecruitstudentsNotice 入园通知书
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertByRecruitstudentsNotice(ByRecruitstudentsNotice byRecruitstudentsNotice) {
|
||||
byRecruitstudentsNotice.setCreateTime(DateUtils.getNowDate());
|
||||
return byRecruitstudentsNoticeMapper.insertByRecruitstudentsNotice(byRecruitstudentsNotice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改入园通知书
|
||||
*
|
||||
* @param byRecruitstudentsNotice 入园通知书
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateByRecruitstudentsNotice(ByRecruitstudentsNotice byRecruitstudentsNotice) {
|
||||
return byRecruitstudentsNoticeMapper.updateByRecruitstudentsNotice(byRecruitstudentsNotice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除入园通知书
|
||||
*
|
||||
* @param ids 需要删除的入园通知书ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteByRecruitstudentsNoticeByIds(Long[] ids) {
|
||||
return byRecruitstudentsNoticeMapper.deleteByRecruitstudentsNoticeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除入园通知书信息
|
||||
*
|
||||
* @param id 入园通知书ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteByRecruitstudentsNoticeById(Long id) {
|
||||
return byRecruitstudentsNoticeMapper.deleteByRecruitstudentsNoticeById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
<?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.ByRecruitstudentsNoticeMapper">
|
||||
|
||||
<resultMap type="ByRecruitstudentsNotice" id="ByRecruitstudentsNoticeResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="title" column="title"/>
|
||||
<result property="content" column="content"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="schoolid" column="schoolid"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectByRecruitstudentsNoticeVo">
|
||||
select id, title, content, type, schoolid, create_time from by_recruitstudents_notice
|
||||
</sql>
|
||||
|
||||
<select id="selectByRecruitstudentsNoticeList" parameterType="ByRecruitstudentsNotice"
|
||||
resultMap="ByRecruitstudentsNoticeResult">
|
||||
<include refid="selectByRecruitstudentsNoticeVo"/>
|
||||
where type='1'
|
||||
<if test="title != null and title != ''">and title like concat('%', #{title}, '%')</if>
|
||||
<if test="content != null and content != ''">and content = #{content}</if>
|
||||
<if test="type != null and type != ''">and type = #{type}</if>
|
||||
<if test="schoolid != null ">or schoolid = #{schoolid}</if>
|
||||
</select>
|
||||
|
||||
<select id="selectByRecruitstudentsNoticeById" parameterType="Long" resultMap="ByRecruitstudentsNoticeResult">
|
||||
<include refid="selectByRecruitstudentsNoticeVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertByRecruitstudentsNotice" parameterType="ByRecruitstudentsNotice" useGeneratedKeys="true"
|
||||
keyProperty="id">
|
||||
insert into by_recruitstudents_notice
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="title != null and title != ''">title,</if>
|
||||
<if test="content != null and content != ''">content,</if>
|
||||
<if test="type != null and type != ''">type,</if>
|
||||
<if test="schoolid != null ">schoolid,</if>
|
||||
<if test="createTime != null ">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="title != null and title != ''">#{title},</if>
|
||||
<if test="content != null and content != ''">#{content},</if>
|
||||
<if test="type != null and type != ''">#{type},</if>
|
||||
<if test="schoolid != null ">#{schoolid},</if>
|
||||
<if test="createTime != null ">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateByRecruitstudentsNotice" parameterType="ByRecruitstudentsNotice">
|
||||
update by_recruitstudents_notice
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="title != null and title != ''">title = #{title},</if>
|
||||
<if test="content != null and content != ''">content = #{content},</if>
|
||||
<if test="type != null and type != ''">type = #{type},</if>
|
||||
<if test="schoolid != null ">schoolid = #{schoolid},</if>
|
||||
<if test="createTime != null ">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteByRecruitstudentsNoticeById" parameterType="Long">
|
||||
delete from by_recruitstudents_notice where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByRecruitstudentsNoticeByIds" parameterType="String">
|
||||
delete from by_recruitstudents_notice where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
Reference in New Issue
Block a user