提交 d0acd5f5 作者: Administrator

添加编辑专业信息的功能

上级 7a1ddf76
......@@ -193,6 +193,7 @@ public class SysIndexController extends BaseController
}else{
try {
response.sendRedirect("http://39.105.118.63:8080/login");
// response.sendRedirect("http://localhost:8080/login");
} catch (IOException e) {
e.printStackTrace();
}
......
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增专业介绍')" />
<th:block th:include="include :: summernote-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-introduce-add">
<div class="form-group">
<label class="col-sm-3 control-label is-required">${comment}:</label>
<div class="col-sm-8">
<input name="majorId" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">标题:</label>
<div class="col-sm-8">
<input name="titile" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">内容:</label>
<div class="col-sm-8">
<script id="contentEditor" name="content" type="text/plain" style="height:300px;width:1000px;" required></script>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<!-- <th:block th:include="include :: summernote-js" />-->
<th:block th:include="include :: ueditor-js" />
<script th:inline="javascript">
var ue = UE.getEditor('contentEditor',{autoHeightEnabled:false});
var prefix = ctx + "system/introduce"
$("#form-introduce-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-introduce-add').serialize());
}
}
$(function() {
$('.summernote').summernote({
lang: 'zh-CN',
dialogsInBody: true,
callbacks: {
onChange: function(contents, $edittable) {
$("input[name='" + this.id + "']").val(contents);
},
onImageUpload: function(files) {
var obj = this;
var data = new FormData();
data.append("file", files[0]);
$.ajax({
type: "post",
url: ctx + "common/upload",
data: data,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function(result) {
if (result.code == web_status.SUCCESS) {
$('#' + obj.id).summernote('insertImage', result.url);
} else {
$.modal.alertError(result.msg);
}
},
error: function(error) {
$.modal.alertWarning("图片上传失败。");
}
});
}
}
});
});
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改专业介绍')" />
<th:block th:include="include :: summernote-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-introduce-edit" th:object="${tbSchoolMajorIntroduce}">
<input name="id" th:field="*{id}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label is-required">${comment}:</label>
<div class="col-sm-8">
<input name="majorId" th:field="*{majorId}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">标题:</label>
<div class="col-sm-8">
<input name="titile" th:field="*{titile}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">内容:</label>
<div class="col-sm-8">
<input type="hidden" class="form-control" th:field="*{content}">
<div class="summernote" id="content"></div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: summernote-js" />
<script th:inline="javascript">
var prefix = ctx + "system/introduce";
$("#form-introduce-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-introduce-edit').serialize());
}
}
$(function() {
$('.summernote').each(function(i) {
$('#' + this.id).summernote({
lang: 'zh-CN',
dialogsInBody: true,
callbacks: {
onChange: function(contents, $edittable) {
$("input[name='" + this.id + "']").val(contents);
},
onImageUpload: function(files) {
var obj = this;
var data = new FormData();
data.append("file", files[0]);
$.ajax({
type: "post",
url: ctx + "common/upload",
data: data,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function(result) {
if (result.code == web_status.SUCCESS) {
$('#' + obj.id).summernote('insertImage', result.url);
} else {
$.modal.alertError(result.msg);
}
},
error: function(error) {
$.modal.alertWarning("图片上传失败。");
}
});
}
}
});
var content = $("input[name='" + this.id + "']").val();
$('#' + this.id).summernote('code', content);
})
});
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('专业介绍列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>${comment}:</label>
<input type="text" name="majorId"/>
</li>
<li>
<label>标题:</label>
<input type="text" name="titile"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:introduce:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:introduce:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:introduce:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:introduce:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('system:introduce:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:introduce:remove')}]];
var prefix = ctx + "system/introduce";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "专业介绍",
columns: [{
checkbox: true
},
{
field: 'id',
title: '${comment}',
visible: false
},
{
field: 'majorId',
title: '${comment}'
},
{
field: 'titile',
title: '标题'
},
{
field: 'content',
title: '内容'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>
\ No newline at end of file
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 专业介绍对象 tb_school_major_introduce
*
* @author ruoyi
* @date 2025-06-15
*/
public class TbSchoolMajorIntroduce extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long majorId;
/** 标题 */
@Excel(name = "标题")
private String titile;
/** 内容 */
@Excel(name = "内容")
private String content;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setMajorId(Long majorId)
{
this.majorId = majorId;
}
public Long getMajorId()
{
return majorId;
}
public void setTitile(String titile)
{
this.titile = titile;
}
public String getTitile()
{
return titile;
}
public void setContent(String content)
{
this.content = content;
}
public String getContent()
{
return content;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("majorId", getMajorId())
.append("titile", getTitile())
.append("content", getContent())
.toString();
}
}
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.TbSchoolMajorIntroduce;
/**
* 专业介绍Mapper接口
*
* @author ruoyi
* @date 2025-06-15
*/
public interface TbSchoolMajorIntroduceMapper
{
/**
* 查询专业介绍
*
* @param id 专业介绍主键
* @return 专业介绍
*/
public TbSchoolMajorIntroduce selectTbSchoolMajorIntroduceById(Long id);
/**
* 查询专业介绍列表
*
* @param tbSchoolMajorIntroduce 专业介绍
* @return 专业介绍集合
*/
public List<TbSchoolMajorIntroduce> selectTbSchoolMajorIntroduceList(TbSchoolMajorIntroduce tbSchoolMajorIntroduce);
/**
* 新增专业介绍
*
* @param tbSchoolMajorIntroduce 专业介绍
* @return 结果
*/
public int insertTbSchoolMajorIntroduce(TbSchoolMajorIntroduce tbSchoolMajorIntroduce);
/**
* 修改专业介绍
*
* @param tbSchoolMajorIntroduce 专业介绍
* @return 结果
*/
public int updateTbSchoolMajorIntroduce(TbSchoolMajorIntroduce tbSchoolMajorIntroduce);
/**
* 删除专业介绍
*
* @param id 专业介绍主键
* @return 结果
*/
public int deleteTbSchoolMajorIntroduceById(Long id);
/**
* 批量删除专业介绍
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteTbSchoolMajorIntroduceByIds(String[] ids);
}
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.TbSchoolMajorIntroduce;
/**
* 专业介绍Service接口
*
* @author ruoyi
* @date 2025-06-15
*/
public interface ITbSchoolMajorIntroduceService
{
/**
* 查询专业介绍
*
* @param id 专业介绍主键
* @return 专业介绍
*/
public TbSchoolMajorIntroduce selectTbSchoolMajorIntroduceById(Long id);
/**
* 查询专业介绍列表
*
* @param tbSchoolMajorIntroduce 专业介绍
* @return 专业介绍集合
*/
public List<TbSchoolMajorIntroduce> selectTbSchoolMajorIntroduceList(TbSchoolMajorIntroduce tbSchoolMajorIntroduce);
/**
* 新增专业介绍
*
* @param tbSchoolMajorIntroduce 专业介绍
* @return 结果
*/
public int insertTbSchoolMajorIntroduce(TbSchoolMajorIntroduce tbSchoolMajorIntroduce);
/**
* 修改专业介绍
*
* @param tbSchoolMajorIntroduce 专业介绍
* @return 结果
*/
public int updateTbSchoolMajorIntroduce(TbSchoolMajorIntroduce tbSchoolMajorIntroduce);
/**
* 批量删除专业介绍
*
* @param ids 需要删除的专业介绍主键集合
* @return 结果
*/
public int deleteTbSchoolMajorIntroduceByIds(String ids);
/**
* 删除专业介绍信息
*
* @param id 专业介绍主键
* @return 结果
*/
public int deleteTbSchoolMajorIntroduceById(Long id);
}
package com.ruoyi.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TbSchoolMajorIntroduceMapper;
import com.ruoyi.system.domain.TbSchoolMajorIntroduce;
import com.ruoyi.system.service.ITbSchoolMajorIntroduceService;
import com.ruoyi.common.core.text.Convert;
/**
* 专业介绍Service业务层处理
*
* @author ruoyi
* @date 2025-06-15
*/
@Service
public class TbSchoolMajorIntroduceServiceImpl implements ITbSchoolMajorIntroduceService
{
@Autowired
private TbSchoolMajorIntroduceMapper tbSchoolMajorIntroduceMapper;
/**
* 查询专业介绍
*
* @param id 专业介绍主键
* @return 专业介绍
*/
@Override
public TbSchoolMajorIntroduce selectTbSchoolMajorIntroduceById(Long id)
{
return tbSchoolMajorIntroduceMapper.selectTbSchoolMajorIntroduceById(id);
}
/**
* 查询专业介绍列表
*
* @param tbSchoolMajorIntroduce 专业介绍
* @return 专业介绍
*/
@Override
public List<TbSchoolMajorIntroduce> selectTbSchoolMajorIntroduceList(TbSchoolMajorIntroduce tbSchoolMajorIntroduce)
{
return tbSchoolMajorIntroduceMapper.selectTbSchoolMajorIntroduceList(tbSchoolMajorIntroduce);
}
/**
* 新增专业介绍
*
* @param tbSchoolMajorIntroduce 专业介绍
* @return 结果
*/
@Override
public int insertTbSchoolMajorIntroduce(TbSchoolMajorIntroduce tbSchoolMajorIntroduce)
{
return tbSchoolMajorIntroduceMapper.insertTbSchoolMajorIntroduce(tbSchoolMajorIntroduce);
}
/**
* 修改专业介绍
*
* @param tbSchoolMajorIntroduce 专业介绍
* @return 结果
*/
@Override
public int updateTbSchoolMajorIntroduce(TbSchoolMajorIntroduce tbSchoolMajorIntroduce)
{
return tbSchoolMajorIntroduceMapper.updateTbSchoolMajorIntroduce(tbSchoolMajorIntroduce);
}
/**
* 批量删除专业介绍
*
* @param ids 需要删除的专业介绍主键
* @return 结果
*/
@Override
public int deleteTbSchoolMajorIntroduceByIds(String ids)
{
return tbSchoolMajorIntroduceMapper.deleteTbSchoolMajorIntroduceByIds(Convert.toStrArray(ids));
}
/**
* 删除专业介绍信息
*
* @param id 专业介绍主键
* @return 结果
*/
@Override
public int deleteTbSchoolMajorIntroduceById(Long id)
{
return tbSchoolMajorIntroduceMapper.deleteTbSchoolMajorIntroduceById(id);
}
}
<?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.system.mapper.TbSchoolMajorIntroduceMapper">
<resultMap type="TbSchoolMajorIntroduce" id="TbSchoolMajorIntroduceResult">
<result property="id" column="id" />
<result property="majorId" column="major_id" />
<result property="titile" column="titile" />
<result property="content" column="content" />
</resultMap>
<sql id="selectTbSchoolMajorIntroduceVo">
select id, major_id, titile, content from tb_school_major_introduce
</sql>
<select id="selectTbSchoolMajorIntroduceList" parameterType="TbSchoolMajorIntroduce" resultMap="TbSchoolMajorIntroduceResult">
<include refid="selectTbSchoolMajorIntroduceVo"/>
<where>
<if test="majorId != null "> and major_id = #{majorId}</if>
<if test="titile != null and titile != ''"> and titile = #{titile}</if>
<if test="content != null and content != ''"> and content = #{content}</if>
</where>
</select>
<select id="selectTbSchoolMajorIntroduceById" parameterType="Long" resultMap="TbSchoolMajorIntroduceResult">
<include refid="selectTbSchoolMajorIntroduceVo"/>
where id = #{id}
</select>
<insert id="insertTbSchoolMajorIntroduce" parameterType="TbSchoolMajorIntroduce" useGeneratedKeys="true" keyProperty="id">
insert into tb_school_major_introduce
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="majorId != null">major_id,</if>
<if test="titile != null and titile != ''">titile,</if>
<if test="content != null and content != ''">content,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="majorId != null">#{majorId},</if>
<if test="titile != null and titile != ''">#{titile},</if>
<if test="content != null and content != ''">#{content},</if>
</trim>
</insert>
<update id="updateTbSchoolMajorIntroduce" parameterType="TbSchoolMajorIntroduce">
update tb_school_major_introduce
<trim prefix="SET" suffixOverrides=",">
<if test="majorId != null">major_id = #{majorId},</if>
<if test="titile != null and titile != ''">titile = #{titile},</if>
<if test="content != null and content != ''">content = #{content},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTbSchoolMajorIntroduceById" parameterType="Long">
delete from tb_school_major_introduce where id = #{id}
</delete>
<delete id="deleteTbSchoolMajorIntroduceByIds" parameterType="String">
delete from tb_school_major_introduce where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论