20200414-zlp-1

班级管理
This commit is contained in:
paidaxing444
2020-04-14 18:12:03 +08:00
parent 64a6caf923
commit c56fbfd8bf
8 changed files with 1091 additions and 0 deletions

View File

@ -0,0 +1,103 @@
package com.ruoyi.project.system.controller;
import java.util.Date;
import java.util.List;
import java.util.UUID;
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.system.domain.ByClass;
import com.ruoyi.project.system.service.IByClassService;
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-14
*/
@RestController
@RequestMapping("/system/class")
public class ByClassController extends BaseController {
@Autowired
private IByClassService byClassService;
/**
* 查询班级信息列表
*/
@PreAuthorize("@ss.hasPermi('system:class:list')")
@GetMapping("/list")
public TableDataInfo list(ByClass byClass) {
startPage();
List<ByClass> list = byClassService.selectByClassList(byClass);
return getDataTable(list);
}
/**
* 导出班级信息列表
*/
@PreAuthorize("@ss.hasPermi('system:class:export')")
@Log(title = "班级信息", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(ByClass byClass) {
List<ByClass> list = byClassService.selectByClassList(byClass);
ExcelUtil<ByClass> util = new ExcelUtil<ByClass>(ByClass.class);
return util.exportExcel(list, "class");
}
/**
* 获取班级信息详细信息
*/
@PreAuthorize("@ss.hasPermi('system:class:query')")
@GetMapping(value = "/{bjbh}")
public AjaxResult getInfo(@PathVariable("bjbh") String bjbh) {
return AjaxResult.success(byClassService.selectByClassById(bjbh));
}
/**
* 新增班级信息
*/
@PreAuthorize("@ss.hasPermi('system:class:add')")
@Log(title = "班级信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ByClass byClass) {
String strBjbh = UUID.randomUUID().toString().replace("-","");
System.out.println("bjbh:==" + strBjbh);
byClass.setBjbh(strBjbh);
byClass.setCreatetime(new Date());
return toAjax(byClassService.insertByClass(byClass));
}
/**
* 修改班级信息
*/
@PreAuthorize("@ss.hasPermi('system:class:edit')")
@Log(title = "班级信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ByClass byClass) {
return toAjax(byClassService.updateByClass(byClass));
}
/**
* 删除班级信息
*/
@PreAuthorize("@ss.hasPermi('system:class:remove')")
@Log(title = "班级信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{bjbhs}")
public AjaxResult remove(@PathVariable String[] bjbhs) {
return toAjax(byClassService.deleteByClassByIds(bjbhs));
}
}

View File

@ -0,0 +1,219 @@
package com.ruoyi.project.system.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;
import java.util.Date;
/**
* 班级信息对象 by_class
*
* @author tsbz
* @date 2020-04-14
*/
public class ByClass extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 班级编号
*/
private String bjbh;
/**
* 学校代码
*/
@Excel(name = "学校代码")
private String schoolid;
/**
* 班级类型
*/
@Excel(name = "班级类型")
private String bjtype;
/**
* 班级序号
*/
@Excel(name = "班级序号")
private Long bhxh;
/**
* 学年
*/
@Excel(name = "学年")
private String xn;
/**
* 班级名称
*/
@Excel(name = "班级名称")
private String bjmc;
/**
* 班级荣誉称号
*/
@Excel(name = "班级荣誉称号")
private String bjrych;
/**
* 建班年月
*/
@Excel(name = "建班年月", width = 30, dateFormat = "yyyy-MM-dd")
private Date jbny;
/**
* 主班教师
*/
@Excel(name = "主班教师")
private Long zbjs;
/**
* 配班教师
*/
@Excel(name = "配班教师")
private Long pbjs;
/**
* 助理教师
*/
@Excel(name = "助理教师")
private Long zljs;
/**
* 是否删除
* 1:删除
* 0:正常
*/
@Excel(name = "是否删除 1:删除 0:正常")
private String isdel;
/**
* 创建时间
*/
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createtime;
public void setBjbh(String bjbh) {
this.bjbh = bjbh;
}
public String getBjbh() {
return bjbh;
}
public void setSchoolid(String schoolid) {
this.schoolid = schoolid;
}
public String getSchoolid() {
return schoolid;
}
public void setBjtype(String bjtype) {
this.bjtype = bjtype;
}
public String getBjtype() {
return bjtype;
}
public void setBhxh(Long bhxh) {
this.bhxh = bhxh;
}
public Long getBhxh() {
return bhxh;
}
public void setXn(String xn) {
this.xn = xn;
}
public String getXn() {
return xn;
}
public void setBjmc(String bjmc) {
this.bjmc = bjmc;
}
public String getBjmc() {
return bjmc;
}
public void setBjrych(String bjrych) {
this.bjrych = bjrych;
}
public String getBjrych() {
return bjrych;
}
public void setJbny(Date jbny) {
this.jbny = jbny;
}
public Date getJbny() {
return jbny;
}
public void setZbjs(Long zbjs) {
this.zbjs = zbjs;
}
public Long getZbjs() {
return zbjs;
}
public void setPbjs(Long pbjs) {
this.pbjs = pbjs;
}
public Long getPbjs() {
return pbjs;
}
public void setZljs(Long zljs) {
this.zljs = zljs;
}
public Long getZljs() {
return zljs;
}
public void setIsdel(String isdel) {
this.isdel = isdel;
}
public String getIsdel() {
return isdel;
}
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("bjbh", getBjbh())
.append("schoolid", getSchoolid())
.append("bjtype", getBjtype())
.append("bhxh", getBhxh())
.append("xn", getXn())
.append("bjmc", getBjmc())
.append("bjrych", getBjrych())
.append("jbny", getJbny())
.append("zbjs", getZbjs())
.append("pbjs", getPbjs())
.append("zljs", getZljs())
.append("isdel", getIsdel())
.append("createtime", getCreatetime())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.project.system.mapper;
import java.util.List;
import com.ruoyi.project.system.domain.ByClass;
/**
* 班级信息Mapper接口
*
* @author tsbz
* @date 2020-04-14
*/
public interface ByClassMapper
{
/**
* 查询班级信息
*
* @param bjbh 班级信息ID
* @return 班级信息
*/
public ByClass selectByClassById(String bjbh);
/**
* 查询班级信息列表
*
* @param byClass 班级信息
* @return 班级信息集合
*/
public List<ByClass> selectByClassList(ByClass byClass);
/**
* 新增班级信息
*
* @param byClass 班级信息
* @return 结果
*/
public int insertByClass(ByClass byClass);
/**
* 修改班级信息
*
* @param byClass 班级信息
* @return 结果
*/
public int updateByClass(ByClass byClass);
/**
* 删除班级信息
*
* @param bjbh 班级信息ID
* @return 结果
*/
public int deleteByClassById(String bjbh);
/**
* 批量删除班级信息
*
* @param bjbhs 需要删除的数据ID
* @return 结果
*/
public int deleteByClassByIds(String[] bjbhs);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.project.system.service;
import java.util.List;
import com.ruoyi.project.system.domain.ByClass;
/**
* 班级信息Service接口
*
* @author tsbz
* @date 2020-04-14
*/
public interface IByClassService
{
/**
* 查询班级信息
*
* @param bjbh 班级信息ID
* @return 班级信息
*/
public ByClass selectByClassById(String bjbh);
/**
* 查询班级信息列表
*
* @param byClass 班级信息
* @return 班级信息集合
*/
public List<ByClass> selectByClassList(ByClass byClass);
/**
* 新增班级信息
*
* @param byClass 班级信息
* @return 结果
*/
public int insertByClass(ByClass byClass);
/**
* 修改班级信息
*
* @param byClass 班级信息
* @return 结果
*/
public int updateByClass(ByClass byClass);
/**
* 批量删除班级信息
*
* @param bjbhs 需要删除的班级信息ID
* @return 结果
*/
public int deleteByClassByIds(String[] bjbhs);
/**
* 删除班级信息信息
*
* @param bjbh 班级信息ID
* @return 结果
*/
public int deleteByClassById(String bjbh);
}

View File

@ -0,0 +1,93 @@
package com.ruoyi.project.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.system.mapper.ByClassMapper;
import com.ruoyi.project.system.domain.ByClass;
import com.ruoyi.project.system.service.IByClassService;
/**
* 班级信息Service业务层处理
*
* @author tsbz
* @date 2020-04-14
*/
@Service
public class ByClassServiceImpl implements IByClassService
{
@Autowired
private ByClassMapper byClassMapper;
/**
* 查询班级信息
*
* @param bjbh 班级信息ID
* @return 班级信息
*/
@Override
public ByClass selectByClassById(String bjbh)
{
return byClassMapper.selectByClassById(bjbh);
}
/**
* 查询班级信息列表
*
* @param byClass 班级信息
* @return 班级信息
*/
@Override
public List<ByClass> selectByClassList(ByClass byClass)
{
return byClassMapper.selectByClassList(byClass);
}
/**
* 新增班级信息
*
* @param byClass 班级信息
* @return 结果
*/
@Override
public int insertByClass(ByClass byClass)
{
return byClassMapper.insertByClass(byClass);
}
/**
* 修改班级信息
*
* @param byClass 班级信息
* @return 结果
*/
@Override
public int updateByClass(ByClass byClass)
{
return byClassMapper.updateByClass(byClass);
}
/**
* 批量删除班级信息
*
* @param bjbhs 需要删除的班级信息ID
* @return 结果
*/
@Override
public int deleteByClassByIds(String[] bjbhs)
{
return byClassMapper.deleteByClassByIds(bjbhs);
}
/**
* 删除班级信息信息
*
* @param bjbh 班级信息ID
* @return 结果
*/
@Override
public int deleteByClassById(String bjbh)
{
return byClassMapper.deleteByClassById(bjbh);
}
}

View File

@ -0,0 +1,114 @@
<?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.system.mapper.ByClassMapper">
<resultMap type="ByClass" id="ByClassResult">
<result property="bjbh" column="bjbh" />
<result property="schoolid" column="schoolid" />
<result property="bjtype" column="bjtype" />
<result property="bhxh" column="bhxh" />
<result property="xn" column="xn" />
<result property="bjmc" column="bjmc" />
<result property="bjrych" column="bjrych" />
<result property="jbny" column="jbny" />
<result property="zbjs" column="zbjs" />
<result property="pbjs" column="pbjs" />
<result property="zljs" column="zljs" />
<result property="isdel" column="isdel" />
<result property="createtime" column="createtime" />
</resultMap>
<sql id="selectByClassVo">
select bjbh, schoolid, bjtype, bhxh, xn, bjmc, bjrych, jbny, zbjs, pbjs, zljs, isdel, createtime from by_class
</sql>
<select id="selectByClassList" parameterType="ByClass" resultMap="ByClassResult">
<include refid="selectByClassVo"/>
<where>
<if test="schoolid != null and schoolid != ''"> and schoolid = #{schoolid}</if>
<if test="bjtype != null and bjtype != ''"> and bjtype = #{bjtype}</if>
<if test="bhxh != null "> and bhxh = #{bhxh}</if>
<if test="xn != null and xn != ''"> and xn = #{xn}</if>
<if test="bjmc != null and bjmc != ''"> and bjmc = #{bjmc}</if>
<if test="bjrych != null and bjrych != ''"> and bjrych = #{bjrych}</if>
<if test="jbny != null "> and jbny = #{jbny}</if>
<if test="zbjs != null "> and zbjs = #{zbjs}</if>
<if test="pbjs != null "> and pbjs = #{pbjs}</if>
<if test="zljs != null "> and zljs = #{zljs}</if>
<if test="isdel != null and isdel != ''"> and isdel = #{isdel}</if>
<if test="createtime != null "> and createtime = #{createtime}</if>
</where>
</select>
<select id="selectByClassById" parameterType="String" resultMap="ByClassResult">
<include refid="selectByClassVo"/>
where bjbh = #{bjbh}
</select>
<insert id="insertByClass" parameterType="ByClass">
insert into by_class
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="bjbh != null and bjbh != ''">bjbh,</if>
<if test="schoolid != null and schoolid != ''">schoolid,</if>
<if test="bjtype != null and bjtype != ''">bjtype,</if>
<if test="bhxh != null ">bhxh,</if>
<if test="xn != null and xn != ''">xn,</if>
<if test="bjmc != null and bjmc != ''">bjmc,</if>
<if test="bjrych != null and bjrych != ''">bjrych,</if>
<if test="jbny != null ">jbny,</if>
<if test="zbjs != null ">zbjs,</if>
<if test="pbjs != null ">pbjs,</if>
<if test="zljs != null ">zljs,</if>
<if test="isdel != null and isdel != ''">isdel,</if>
<if test="createtime != null ">createtime,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="bjbh != null and bjbh != ''">#{bjbh},</if>
<if test="schoolid != null and schoolid != ''">#{schoolid},</if>
<if test="bjtype != null and bjtype != ''">#{bjtype},</if>
<if test="bhxh != null ">#{bhxh},</if>
<if test="xn != null and xn != ''">#{xn},</if>
<if test="bjmc != null and bjmc != ''">#{bjmc},</if>
<if test="bjrych != null and bjrych != ''">#{bjrych},</if>
<if test="jbny != null ">#{jbny},</if>
<if test="zbjs != null ">#{zbjs},</if>
<if test="pbjs != null ">#{pbjs},</if>
<if test="zljs != null ">#{zljs},</if>
<if test="isdel != null and isdel != ''">#{isdel},</if>
<if test="createtime != null ">#{createtime},</if>
</trim>
</insert>
<update id="updateByClass" parameterType="ByClass">
update by_class
<trim prefix="SET" suffixOverrides=",">
<if test="schoolid != null and schoolid != ''">schoolid = #{schoolid},</if>
<if test="bjtype != null and bjtype != ''">bjtype = #{bjtype},</if>
<if test="bhxh != null ">bhxh = #{bhxh},</if>
<if test="xn != null and xn != ''">xn = #{xn},</if>
<if test="bjmc != null and bjmc != ''">bjmc = #{bjmc},</if>
<if test="bjrych != null and bjrych != ''">bjrych = #{bjrych},</if>
<if test="jbny != null ">jbny = #{jbny},</if>
<if test="zbjs != null ">zbjs = #{zbjs},</if>
<if test="pbjs != null ">pbjs = #{pbjs},</if>
<if test="zljs != null ">zljs = #{zljs},</if>
<if test="isdel != null and isdel != ''">isdel = #{isdel},</if>
<if test="createtime != null ">createtime = #{createtime},</if>
</trim>
where bjbh = #{bjbh}
</update>
<delete id="deleteByClassById" parameterType="String">
delete from by_class where bjbh = #{bjbh}
</delete>
<delete id="deleteByClassByIds" parameterType="String">
delete from by_class where bjbh in
<foreach item="bjbh" collection="array" open="(" separator="," close=")">
#{bjbh}
</foreach>
</delete>
</mapper>