新增教师管理部分功能

This commit is contained in:
sk1551
2020-04-22 16:30:28 +08:00
parent 024f4b5617
commit 349e26a032
8 changed files with 1138 additions and 0 deletions

View File

@ -0,0 +1,112 @@
package com.ruoyi.project.system.controller;
import java.util.Date;
import java.util.List;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.project.system.service.ISysUserService;
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.ByTeacherJbxx;
import com.ruoyi.project.system.service.IByTeacherJbxxService;
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-21
*/
@RestController
@RequestMapping("/system/teacher")
public class ByTeacherJbxxController extends BaseController
{
@Autowired
private IByTeacherJbxxService byTeacherJbxxService;
@Autowired
private ISysUserService userService;
/**
* 查询教师基本信息列表
*/
@PreAuthorize("@ss.hasPermi('system:teacher:list')")
@GetMapping("/list")
public TableDataInfo list(ByTeacherJbxx byTeacherJbxx)
{
startPage();
List<ByTeacherJbxx> list = byTeacherJbxxService.selectByTeacherJbxxList(byTeacherJbxx);
return getDataTable(list);
}
/**
* 导出教师基本信息列表
*/
@PreAuthorize("@ss.hasPermi('system:teacher:export')")
@Log(title = "教师基本信息", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(ByTeacherJbxx byTeacherJbxx)
{
List<ByTeacherJbxx> list = byTeacherJbxxService.selectByTeacherJbxxList(byTeacherJbxx);
ExcelUtil<ByTeacherJbxx> util = new ExcelUtil<ByTeacherJbxx>(ByTeacherJbxx.class);
return util.exportExcel(list, "teacher");
}
/**
* 获取教师基本信息详细信息
*/
@PreAuthorize("@ss.hasPermi('system:teacher:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(byTeacherJbxxService.selectByTeacherJbxxById(id));
}
/**
* 新增教师基本信息
*/
@PreAuthorize("@ss.hasPermi('system:teacher:add')")
@Log(title = "教师基本信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ByTeacherJbxx byTeacherJbxx)
{
byTeacherJbxx.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
byTeacherJbxx.setCreatetime(new Date());
return toAjax(byTeacherJbxxService.insertByTeacherJbxx(byTeacherJbxx));
}
/**
* 修改教师基本信息
*/
@PreAuthorize("@ss.hasPermi('system:teacher:edit')")
@Log(title = "教师基本信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ByTeacherJbxx byTeacherJbxx)
{
return toAjax(byTeacherJbxxService.updateByTeacherJbxx(byTeacherJbxx));
}
/**
* 删除教师基本信息
*/
@PreAuthorize("@ss.hasPermi('system:teacher:remove')")
@Log(title = "教师基本信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(byTeacherJbxxService.deleteByTeacherJbxxByIds(ids));
}
}

View File

@ -0,0 +1,206 @@
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_teacher_jbxx
*
* @author tsbz
* @date 2020-04-21
*/
public class ByTeacherJbxx extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 标识 */
private Long id;
/** 用户id */
@Excel(name = "用户id")
private Long userid;
/** 证件号码 */
@Excel(name = "证件号码")
private String zjhm;
/** 出生日期 */
@Excel(name = "出生日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date csrq;
/** 毕业院校 */
@Excel(name = "毕业院校")
private String byyx;
/** 专业 */
@Excel(name = "专业")
private String zy;
/** 学历 */
@Excel(name = "学历")
private String xl;
/** 学位 */
@Excel(name = "学位")
private String xw;
/** 参加工作日期 */
@Excel(name = "参加工作日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date cjgzrq;
/** 资格证书 */
@Excel(name = "资格证书")
private String zgzs;
/** 创建人 */
@Excel(name = "创建人")
private Long createuserid;
//创建时间
@Excel(name = "创建时间")
private Date createtime;
/** user对象 */
@Excel(name = "部门名称", targetAttr = "deptName", type = Excel.Type.EXPORT)
private SysUser user;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setUserid(Long userid)
{
this.userid = userid;
}
public Long getUserid()
{
return userid;
}
public void setZjhm(String zjhm)
{
this.zjhm = zjhm;
}
public String getZjhm()
{
return zjhm;
}
public void setCsrq(Date csrq)
{
this.csrq = csrq;
}
public Date getCsrq()
{
return csrq;
}
public void setByyx(String byyx)
{
this.byyx = byyx;
}
public String getByyx()
{
return byyx;
}
public void setZy(String zy)
{
this.zy = zy;
}
public String getZy()
{
return zy;
}
public void setXl(String xl)
{
this.xl = xl;
}
public String getXl()
{
return xl;
}
public void setXw(String xw)
{
this.xw = xw;
}
public String getXw()
{
return xw;
}
public void setCjgzrq(Date cjgzrq)
{
this.cjgzrq = cjgzrq;
}
public Date getCjgzrq()
{
return cjgzrq;
}
public void setZgzs(String zgzs)
{
this.zgzs = zgzs;
}
public String getZgzs()
{
return zgzs;
}
public void setCreateuserid(Long createuserid)
{
this.createuserid = createuserid;
}
public Long getCreateuserid()
{
return createuserid;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("userid", getUserid())
.append("zjhm", getZjhm())
.append("csrq", getCsrq())
.append("byyx", getByyx())
.append("zy", getZy())
.append("xl", getXl())
.append("xw", getXw())
.append("cjgzrq", getCjgzrq())
.append("zgzs", getZgzs())
.append("createuserid", getCreateuserid())
.append("createtime", getCreatetime())
.append("user", getUser())
.toString();
}
public Date getCreatetime() {
return createtime;
}
public void setCreatetime(Date createtime) {
this.createtime = createtime;
}
public SysUser getUser() {
return user;
}
public void setUser(SysUser user) {
this.user = user;
}
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.project.system.mapper;
import java.util.List;
import com.ruoyi.project.system.domain.ByTeacherJbxx;
/**
* 教师基本信息Mapper接口
*
* @author tsbz
* @date 2020-04-21
*/
public interface ByTeacherJbxxMapper
{
/**
* 查询教师基本信息
*
* @param id 教师基本信息ID
* @return 教师基本信息
*/
public ByTeacherJbxx selectByTeacherJbxxById(Long id);
/**
* 查询教师基本信息列表
*
* @param byTeacherJbxx 教师基本信息
* @return 教师基本信息集合
*/
public List<ByTeacherJbxx> selectByTeacherJbxxList(ByTeacherJbxx byTeacherJbxx);
/**
* 新增教师基本信息
*
* @param byTeacherJbxx 教师基本信息
* @return 结果
*/
public int insertByTeacherJbxx(ByTeacherJbxx byTeacherJbxx);
/**
* 修改教师基本信息
*
* @param byTeacherJbxx 教师基本信息
* @return 结果
*/
public int updateByTeacherJbxx(ByTeacherJbxx byTeacherJbxx);
/**
* 删除教师基本信息
*
* @param id 教师基本信息ID
* @return 结果
*/
public int deleteByTeacherJbxxById(Long id);
/**
* 批量删除教师基本信息
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteByTeacherJbxxByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.project.system.service;
import java.util.List;
import com.ruoyi.project.system.domain.ByTeacherJbxx;
/**
* 教师基本信息Service接口
*
* @author tsbz
* @date 2020-04-21
*/
public interface IByTeacherJbxxService
{
/**
* 查询教师基本信息
*
* @param id 教师基本信息ID
* @return 教师基本信息
*/
public ByTeacherJbxx selectByTeacherJbxxById(Long id);
/**
* 查询教师基本信息列表
*
* @param byTeacherJbxx 教师基本信息
* @return 教师基本信息集合
*/
public List<ByTeacherJbxx> selectByTeacherJbxxList(ByTeacherJbxx byTeacherJbxx);
/**
* 新增教师基本信息
*
* @param byTeacherJbxx 教师基本信息
* @return 结果
*/
public int insertByTeacherJbxx(ByTeacherJbxx byTeacherJbxx);
/**
* 修改教师基本信息
*
* @param byTeacherJbxx 教师基本信息
* @return 结果
*/
public int updateByTeacherJbxx(ByTeacherJbxx byTeacherJbxx);
/**
* 批量删除教师基本信息
*
* @param ids 需要删除的教师基本信息ID
* @return 结果
*/
public int deleteByTeacherJbxxByIds(Long[] ids);
/**
* 删除教师基本信息信息
*
* @param id 教师基本信息ID
* @return 结果
*/
public int deleteByTeacherJbxxById(Long id);
}

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.ByTeacherJbxxMapper;
import com.ruoyi.project.system.domain.ByTeacherJbxx;
import com.ruoyi.project.system.service.IByTeacherJbxxService;
/**
* 教师基本信息Service业务层处理
*
* @author tsbz
* @date 2020-04-21
*/
@Service
public class ByTeacherJbxxServiceImpl implements IByTeacherJbxxService
{
@Autowired
private ByTeacherJbxxMapper byTeacherJbxxMapper;
/**
* 查询教师基本信息
*
* @param id 教师基本信息ID
* @return 教师基本信息
*/
@Override
public ByTeacherJbxx selectByTeacherJbxxById(Long id)
{
return byTeacherJbxxMapper.selectByTeacherJbxxById(id);
}
/**
* 查询教师基本信息列表
*
* @param byTeacherJbxx 教师基本信息
* @return 教师基本信息
*/
@Override
public List<ByTeacherJbxx> selectByTeacherJbxxList(ByTeacherJbxx byTeacherJbxx)
{
return byTeacherJbxxMapper.selectByTeacherJbxxList(byTeacherJbxx);
}
/**
* 新增教师基本信息
*
* @param byTeacherJbxx 教师基本信息
* @return 结果
*/
@Override
public int insertByTeacherJbxx(ByTeacherJbxx byTeacherJbxx)
{
return byTeacherJbxxMapper.insertByTeacherJbxx(byTeacherJbxx);
}
/**
* 修改教师基本信息
*
* @param byTeacherJbxx 教师基本信息
* @return 结果
*/
@Override
public int updateByTeacherJbxx(ByTeacherJbxx byTeacherJbxx)
{
return byTeacherJbxxMapper.updateByTeacherJbxx(byTeacherJbxx);
}
/**
* 批量删除教师基本信息
*
* @param ids 需要删除的教师基本信息ID
* @return 结果
*/
@Override
public int deleteByTeacherJbxxByIds(Long[] ids)
{
return byTeacherJbxxMapper.deleteByTeacherJbxxByIds(ids);
}
/**
* 删除教师基本信息信息
*
* @param id 教师基本信息ID
* @return 结果
*/
@Override
public int deleteByTeacherJbxxById(Long id)
{
return byTeacherJbxxMapper.deleteByTeacherJbxxById(id);
}
}

View File

@ -0,0 +1,136 @@
<?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.ByTeacherJbxxMapper">
<resultMap type="ByTeacherJbxx" id="ByTeacherJbxxResult">
<result property="id" column="id" />
<result property="userid" column="userid" />
<result property="zjhm" column="zjhm" />
<result property="csrq" column="csrq" />
<result property="byyx" column="byyx" />
<result property="zy" column="zy" />
<result property="xl" column="xl" />
<result property="xw" column="xw" />
<result property="cjgzrq" column="cjgzrq" />
<result property="zgzs" column="zgzs" />
<result property="createuserid" column="createuserid" />
<result property="createtime" column="createtime" />
<association property="user" column="user_id" javaType="SysUser" resultMap="SysUserResult" />
</resultMap>
<resultMap type="SysUser" id="SysUserResult">
<id property="userId" column="user_id" />
<result property="deptId" column="dept_id" />
<result property="userName" column="user_name" />
<result property="nickName" column="nick_name" />
<result property="email" column="email" />
<result property="phonenumber" column="phonenumber" />
<result property="sex" column="sex" />
<result property="avatar" column="avatar" />
<result property="password" column="password" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="loginIp" column="login_ip" />
<result property="loginDate" column="login_date" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectByTeacherJbxxVo">
select t.id, t.userid, t.zjhm, t.csrq, t.byyx, t.zy, t.xl, t.xw, t.cjgzrq, t.zgzs, t.createuserid, t.createtime,
u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.sex, u.status as user_status
from by_teacher_jbxx t
left join sys_user u on t.userid = u.user_id
</sql>
<select id="selectByTeacherJbxxList" parameterType="ByTeacherJbxx" resultMap="ByTeacherJbxxResult">
select t.id, t.userid, t.zjhm, t.csrq, t.byyx, t.zy, t.xl, t.xw, t.cjgzrq, t.zgzs, t.createuserid, t.createtime,
u.user_id, u.nick_name
from by_teacher_jbxx t
left join sys_user u on t.userid = u.user_id
<if test="userid != null "> and userid = #{userid}</if>
<if test="zjhm != null and zjhm != ''"> and zjhm = #{zjhm}</if>
<if test="csrq != null "> and csrq = #{csrq}</if>
<if test="byyx != null and byyx != ''"> and byyx = #{byyx}</if>
<if test="zy != null and zy != ''"> and zy = #{zy}</if>
<if test="xl != null and xl != ''"> and xl = #{xl}</if>
<if test="xw != null and xw != ''"> and xw = #{xw}</if>
<if test="cjgzrq != null "> and cjgzrq = #{cjgzrq}</if>
<if test="zgzs != null and zgzs != ''"> and zgzs = #{zgzs}</if>
<if test="createuserid != null "> and createuserid = #{createuserid}</if>
<if test="createtime != null "> and createtime = #{createtime}</if>
<!-- 数据范围过滤 -->
${dataScope}
</select>
<select id="selectByTeacherJbxxById" parameterType="Long" resultMap="ByTeacherJbxxResult">
<include refid="selectByTeacherJbxxVo"/>
where id = #{id}
</select>
<insert id="insertByTeacherJbxx" parameterType="ByTeacherJbxx" useGeneratedKeys="true" keyProperty="id">
insert into by_teacher_jbxx
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userid != null ">userid,</if>
<if test="zjhm != null and zjhm != ''">zjhm,</if>
<if test="csrq != null ">csrq,</if>
<if test="byyx != null and byyx != ''">byyx,</if>
<if test="zy != null and zy != ''">zy,</if>
<if test="xl != null and xl != ''">xl,</if>
<if test="xw != null and xw != ''">xw,</if>
<if test="cjgzrq != null ">cjgzrq,</if>
<if test="zgzs != null and zgzs != ''">zgzs,</if>
<if test="createuserid != null ">createuserid,</if>
<if test="createtime != null ">createtime,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userid != null ">#{userid},</if>
<if test="zjhm != null and zjhm != ''">#{zjhm},</if>
<if test="csrq != null ">#{csrq},</if>
<if test="byyx != null and byyx != ''">#{byyx},</if>
<if test="zy != null and zy != ''">#{zy},</if>
<if test="xl != null and xl != ''">#{xl},</if>
<if test="xw != null and xw != ''">#{xw},</if>
<if test="cjgzrq != null ">#{cjgzrq},</if>
<if test="zgzs != null and zgzs != ''">#{zgzs},</if>
<if test="createuserid != null ">#{createuserid},</if>
<if test="createtime != null ">#{createtime},</if>
</trim>
</insert>
<update id="updateByTeacherJbxx" parameterType="ByTeacherJbxx">
update by_teacher_jbxx
<trim prefix="SET" suffixOverrides=",">
<if test="userid != null ">userid = #{userid},</if>
<if test="zjhm != null and zjhm != ''">zjhm = #{zjhm},</if>
<if test="csrq != null ">csrq = #{csrq},</if>
<if test="byyx != null and byyx != ''">byyx = #{byyx},</if>
<if test="zy != null and zy != ''">zy = #{zy},</if>
<if test="xl != null and xl != ''">xl = #{xl},</if>
<if test="xw != null and xw != ''">xw = #{xw},</if>
<if test="cjgzrq != null ">cjgzrq = #{cjgzrq},</if>
<if test="zgzs != null and zgzs != ''">zgzs = #{zgzs},</if>
<if test="createuserid != null ">createuserid = #{createuserid},</if>
<if test="createtime != null ">createtime = #{createtime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteByTeacherJbxxById" parameterType="Long">
delete from by_teacher_jbxx where id = #{id}
</delete>
<delete id="deleteByTeacherJbxxByIds" parameterType="String">
delete from by_teacher_jbxx where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>