提交 a6f2664e 作者: dingtalk_nnkplh

增加发布通知功能;修改所有页面的查询功能

上级 0092aba7
package com.ruoyi.web.controller.school;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.TbNotice;
import com.ruoyi.system.service.ITbNoticeService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 通知公告Controller
*
* @author ruoyi
* @date 2022-10-18
*/
@Controller
@RequestMapping("/business/notice")
public class TbNoticeController extends BaseController
{
private String prefix = "business/notice";
@Autowired
private ITbNoticeService tbNoticeService;
@RequiresPermissions("business:notice:view")
@GetMapping()
public String notice()
{
return prefix + "/notice";
}
/**
* 查询通知公告列表
*/
@RequiresPermissions("business:notice:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TbNotice tbNotice)
{
startPage();
List<TbNotice> list = tbNoticeService.selectTbNoticeList(tbNotice);
return getDataTable(list);
}
/**
* 导出通知公告列表
*/
@RequiresPermissions("business:notice:export")
@Log(title = "通知公告", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(TbNotice tbNotice)
{
List<TbNotice> list = tbNoticeService.selectTbNoticeList(tbNotice);
ExcelUtil<TbNotice> util = new ExcelUtil<TbNotice>(TbNotice.class);
return util.exportExcel(list, "通知公告数据");
}
/**
* 新增通知公告
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存通知公告
*/
@RequiresPermissions("business:notice:add")
@Log(title = "通知公告", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(TbNotice tbNotice)
{
tbNotice.setCreator(getUserId());
return toAjax(tbNoticeService.insertTbNotice(tbNotice));
}
/**
* 修改通知公告
*/
@RequiresPermissions("business:notice:edit")
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
TbNotice tbNotice = tbNoticeService.selectTbNoticeById(id);
mmap.put("tbNotice", tbNotice);
return prefix + "/edit";
}
/**
* 修改保存通知公告
*/
@RequiresPermissions("business:notice:edit")
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(TbNotice tbNotice)
{
tbNotice.setModifiedBy(getUserId());
return toAjax(tbNoticeService.updateTbNotice(tbNotice));
}
/**
* 删除通知公告
*/
@RequiresPermissions("business:notice:remove")
@Log(title = "通知公告", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(tbNoticeService.deleteTbNoticeByIds(ids));
}
}
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增通知公告')" />
<th:block th:include="include :: select2-css" />
<th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-notice-add">
<div class="form-group">
<label class="col-sm-3 control-label is-required">通知标题:</label>
<div class="col-sm-8">
<input name="noticeTitle" class="form-control" type="text" required>
</div>
</div>
<input type="hidden" id="noticeType" name="noticeType">
<div class="form-group">
<label class="col-sm-3 control-label is-required">通知类型:</label>
<div class="col-sm-8">
<select id="noticeType1" class="form-control select2-multiple" required>
<option value="1">系统通知</option>
<option value="2">个人通知</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">个人id:</label>
<div class="col-sm-8">
<input name="userId" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">note:</label>
<div class="col-sm-8">
<input name="userId" class="form-control" type="text" value="当类型为个人通知的时候个人id必填" disabled="true">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">通知内容:</label>
<div class="col-sm-8">
<script id="editor" name="noticeContent" type="text/plain" style="height: 300px;"></script>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<input name="remark" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: ueditor-js" />
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: bootstrap-select-js" />
<script th:inline="javascript">
var prefix = ctx + "business/notice"
$("#form-notice-add").validate({
focusCleanup: true
});
var ue = UE.getEditor('editor');
function getContentTxt() {
return UE.getEditor('editor').getContentTxt();
}
// $('#noticeType1').on('select2:select', function (e) {
// var a=$('#noticeType1').val();
// $("#noticeType").val(a);
// });
//
// $('#noticeType1').on('change', function (e) {
// var a=$('#noticeType1').val();
// $("#noticeType").val(a);
// });
function submitHandler() {
if ($.validate.form()) {
var a=$('#noticeType1').val();
$("#noticeType").val(a);
alert($("#noticeType").val());
var text = getContentTxt();
if (text == '' || text.length == 0) {
$.modal.alertWarning("请输入通知内容!");
return;
}
$.operate.save(prefix + "/add", $('#form-notice-add').serialize());
}
}
</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('修改通知公告')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-notice-edit" th:object="${tbNotice}">
<input name="id" th:field="*{id}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label is-required">通知标题:</label>
<div class="col-sm-8">
<input name="noticeTitle" th:field="*{noticeTitle}" class="form-control" type="text" required>
</div>
</div>
<input type="hidden" id="noticeType" th:field="*{noticeType}">
<div class="form-group">
<label class="col-sm-3 control-label is-required">通知类型:</label>
<div class="col-sm-8">
<select id="noticeType1" class="form-control select2-multiple" required>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">个人的id:</label>
<div class="col-sm-8">
<input name="userId" th:field="*{userId}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">通知内容:</label>
<div class="col-sm-8">
<script id="editor" name="noticeContent" type="text/plain" style="height: 300px;"></script>
<textarea id="noticeContent" style="display: none;">[[*{noticeContent}]]</textarea>
</div>
</div>
<input type="hidden" th:field="*{status}" id="status">
<div class="form-group">
<label class="col-sm-3 control-label">通知状态:</label>
<div class="col-sm-8">
<select id="status1" class="form-control select2-multiple" required>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<input name="remark" th:field="*{remark}" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: ueditor-js" />
<script th:inline="javascript">
var prefix = ctx + "business/notice";
$("#form-notice-edit").validate({
focusCleanup: true
});
$(function () {
var text = $("#noticeContent").text();
var ue = UE.getEditor('editor');
ue.ready(function () {
ue.setContent(text);
});
})
function getContentTxt() {
return UE.getEditor('editor').getContentTxt();
}
function submitHandler() {
if ($.validate.form()) {
var text = getContentTxt();
if (text == '' || text.length == 0) {
$.modal.alertWarning("请输入通知内容!");
return;
}
$.operate.save(prefix + "/edit", $('#form-notice-edit').serialize());
}
}
$(document).ready(function() {
var vSele1=$("#status").val();
$("#status1").append("<option value='1'>正常</option>");
$("#status1").append("<option value='2'>关闭</option>");
$("#status1").find("option").each(function(){
if($(this).val() == vSele1) {
$(this).attr("selected",true);
}
});
var var2=$("#noticeType").val();
$("#noticeType1").append("<option value='1'>系统通知</option>");
$("#noticeType1").append("<option value='2'>个人通知</option>");
$("#noticeType1").find("option").each(function(){
if($(this).val() == var2) {
$(this).attr("selected",true);
}
});
});
$('#status1').on('select2:select', function (e) {
var a=$('#status1').val();
$("#status").val(a);
});
$('#noticeType1').on('select2:select', function (e) {
var a=$('#noticeType1').val();
$("#noticeType").val(a);
});
$('#noticeType1').on('change', function (e) {
var a=$('#noticeType1').val();
$("#noticeType").val(a);
});
</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>通知标题:</label>
<input type="text" name="noticeTitle"/>
</li>
<li>
<label>通知类型:</label>
<select id="noticeType" class="form-control select2-multiple">
<option>请选择类型</option>
<option value="1">系统通知</option>
<option value="2">个人通知</option>
</select>
</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="business:notice:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="business:notice:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="business:notice:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="business:notice: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('business:notice:edit')}]];
var removeFlag = [[${@permission.hasPermi('business:notice:remove')}]];
var prefix = ctx + "business/notice";
$(function() {
var options = {
url: prefix + "/list",
queryParams: queryParams,
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "通知公告",
columns: [{
checkbox: true
},
{
field: 'id',
title: '${comment}',
visible: false
},
{
field: 'noticeTitle',
title: '通知标题'
},
{
field: 'noticeTypeDesc',
title: '通知类型'
},
// {
// field: 'userId',
// title: '个人的id,通知类型为2时必填'
// },
{
field: 'statusDesc',
title: '通知状态'
},
{
field: 'creatorDesc',
title: '创建者'
},
{
field: 'createTime',
title: '创建时间'
},
{
field: 'modifiedByDesc',
title: '更新者'
},
{
field: 'updateTime',
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);
});
function queryParams(params) {
var search = $.table.queryParams(params);
var ii=$("#noticeType")[0].value;
if(ii != '请选择类型'){
search.noticeType= ii;
}
return search;
}
</script>
</body>
</html>
\ No newline at end of file
......@@ -18,7 +18,7 @@
</li>
<li>
<label>设施类型:</label>
<input type="text" name="facilities"/>
<input type="text" name="facilitiesType"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
......@@ -57,6 +57,7 @@
$(function() {
var options = {
url: prefix + "/list",
queryParams: queryParams,
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
......@@ -127,6 +128,15 @@
}
});
});
function queryParams(params) {
var search = $.table.queryParams(params);
var ii=$("#schoolId")[0].value;
if(ii != '请选择学校'){
search.schoolId= ii;
}
return search;
}
</script>
</body>
</html>
\ No newline at end of file
......@@ -81,6 +81,7 @@
$(function() {
var options = {
url: prefix + "/list",
queryParams: queryParams,
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
......@@ -246,6 +247,15 @@
$("#needInterview").append("<option value=0>不需要</option>");
$("#needInterview").append("<option value=1>需要</option>");
});
function queryParams(params) {
var search = $.table.queryParams(params);
var ii=$("#schoolId")[0].value;
if(ii != '请选择学校'){
search.schoolId= ii;
}
return search;
}
</script>
</body>
</html>
\ No newline at end of file
......@@ -12,7 +12,9 @@
<ul>
<li>
<label>学校名称:</label>
<input type="text" name="schoolId"/>
<select id="schoolId" class="form-control select2-multiple">
<option>请选择学校</option>
</select>
</li>
<li>
<label>专业名称:</label>
......@@ -74,6 +76,7 @@
$(function() {
var options = {
url: prefix + "/list",
queryParams: queryParams,
// createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
// removeUrl: prefix + "/remove",
......@@ -183,6 +186,15 @@
}
});
});
function queryParams(params) {
var search = $.table.queryParams(params);
var ii=$("#schoolId")[0].value;
if(ii != '请选择学校'){
search.schoolId= ii;
}
return search;
}
</script>
</body>
</html>
\ No newline at end of file
......@@ -57,6 +57,7 @@
$(function() {
var options = {
url: prefix + "/list",
queryParams: queryParams,
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
......@@ -137,6 +138,15 @@
}
});
});
function queryParams(params) {
var search = $.table.queryParams(params);
var ii=$("#schoolId")[0].value;
if(ii != '请选择学校'){
search.schoolId= ii;
}
return search;
}
</script>
</body>
</html>
\ No newline at end of file
......@@ -52,6 +52,7 @@
$(function() {
var options = {
url: prefix + "/list",
queryParams: queryParams,
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
......@@ -131,6 +132,15 @@
}
});
});
function queryParams(params) {
var search = $.table.queryParams(params);
var ii=$("#schoolId")[0].value;
if(ii != '请选择学校'){
search.schoolId= ii;
}
return search;
}
</script>
</body>
</html>
\ No newline at end of file
......@@ -52,6 +52,7 @@
$(function() {
var options = {
url: prefix + "/list",
queryParams: queryParams,
// createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
// removeUrl: prefix + "/remove",
......@@ -131,6 +132,15 @@
}
});
});
function queryParams(params) {
var search = $.table.queryParams(params);
var ii=$("#schoolId")[0].value;
if(ii != '请选择学校'){
search.schoolId= ii;
}
return search;
}
</script>
</body>
</html>
\ No newline at end of file
......@@ -457,8 +457,6 @@
console.log($("#backgroundImage").val())
});
}
</script>
</body>
</html>
\ No newline at end of file
......@@ -179,6 +179,7 @@
<!--前端接收数据成功是执行的该函数-->
success: function (data) {
$("#campusId").empty();
$("#majorId").empty();
$("#campusId").append("<option></option>");
<!--使用循环解析后端传来的数据,并用使用js动态拼接html语言-->
for (var i = 0; i < data.length; i++)
......
......@@ -12,7 +12,6 @@
<ul>
<li>
<label>学校:</label>
<!-- <input type="text" name="schoolId"/>-->
<select id="schoolId" class="form-control select2-multiple">
<option>请选择学校</option>
</select>
......@@ -95,6 +94,7 @@
$(function() {
var options = {
url: prefix + "/list",
queryParams: queryParams,
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
......@@ -208,6 +208,9 @@
dataType: "json",
<!--前端接收数据成功是执行的该函数-->
success: function (data) {
$("#majorId").empty();
$("#campusId").empty();
$("#campusId").append("<option>请选择校区</option>");
<!--使用循环解析后端传来的数据,并用使用js动态拼接html语言-->
for (var i = 0; i < data.length; i++)
$("#campusId").append("<option value='" + data[i].id + "'>" + data[i].schoolCampus + "</option>");
......@@ -226,7 +229,9 @@
dataType: "json",
<!--前端接收数据成功是执行的该函数-->
success: function (data) {
$("#majorId").empty();
<!--使用循环解析后端传来的数据,并用使用js动态拼接html语言-->
$("#majorId").append("<option>请选择专业</option>");
for (var i = 0; i < data.length; i++)
$("#majorId").append("<option value='" + data[i].id + "'>" + data[i].majorCnName + "</option>");
}
......@@ -234,6 +239,22 @@
});
});
function queryParams(params) {
var search = $.table.queryParams(params);
var ii=$("#schoolId")[0].value;
if(ii != '请选择学校'){
search.schoolId= ii;
}
var i=$("#campusId").val();
if(i != '请选择校区'){
search.campusId= i;
}
var ij=$("#majorId").val();
if(ij != '请选择专业'){
search.majorId= ij;
}
return search;
}
</script>
</body>
</html>
\ No newline at end of file
......@@ -89,6 +89,8 @@ public class Constants
public static final String BUSINESS_SCHOOL_TYPE = "business_school_type";
public static final String BUSINESS_CHECK_STATUS = "business_check_status";
public static final String BUSINESS_NOTICE_TYPE = "business_notice_type";
public static final String BUSINESS_NOTICE_STATUS = "business_notice_status";
/**
* 资源映射路径 前缀
......
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_notice
*
* @author ruoyi
* @date 2022-10-18
*/
public class TbNotice extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 通知标题 */
@Excel(name = "通知标题")
private String noticeTitle;
/** 通知类型(1系统通知 2个人通知) */
@Excel(name = "通知类型", readConverterExp = "1=系统通知,2=个人通知")
private Integer noticeType;
private String noticeTypeDesc;
/** 个人的id,通知类型为2时必填 */
@Excel(name = "个人的id,通知类型为2时必填")
private Long userId;
/** 通知内容 */
@Excel(name = "通知内容")
private String noticeContent;
/** 通知状态(1正常 2关闭) */
@Excel(name = "通知状态", readConverterExp = "1=正常,2=关闭")
private Integer status;
private String statusDesc;
private String creatorDesc;
private String modifiedByDesc;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setNoticeTitle(String noticeTitle)
{
this.noticeTitle = noticeTitle;
}
public String getNoticeTitle()
{
return noticeTitle;
}
public void setNoticeType(Integer noticeType)
{
this.noticeType = noticeType;
}
public Integer getNoticeType()
{
return noticeType;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setNoticeContent(String noticeContent)
{
this.noticeContent = noticeContent;
}
public String getNoticeContent()
{
return noticeContent;
}
public void setStatus(Integer status)
{
this.status = status;
}
public Integer getStatus()
{
return status;
}
public String getNoticeTypeDesc() {
return noticeTypeDesc;
}
public void setNoticeTypeDesc(String noticeTypeDesc) {
this.noticeTypeDesc = noticeTypeDesc;
}
public String getStatusDesc() {
return statusDesc;
}
public void setStatusDesc(String statusDesc) {
this.statusDesc = statusDesc;
}
public String getCreatorDesc() {
return creatorDesc;
}
public void setCreatorDesc(String creatorDesc) {
this.creatorDesc = creatorDesc;
}
public String getModifiedByDesc() {
return modifiedByDesc;
}
public void setModifiedByDesc(String modifiedByDesc) {
this.modifiedByDesc = modifiedByDesc;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("noticeTitle", getNoticeTitle())
.append("noticeType", getNoticeType())
.append("userId", getUserId())
.append("noticeContent", getNoticeContent())
.append("status", getStatus())
.append("creator", getCreator())
.append("createTime", getCreateTime())
.append("modifiedBy", getModifiedBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.TbNotice;
import org.apache.ibatis.annotations.Mapper;
/**
* 通知公告Mapper接口
*
* @author ruoyi
* @date 2022-10-18
*/
@Mapper
public interface TbNoticeMapper
{
/**
* 查询通知公告
*
* @param id 通知公告主键
* @return 通知公告
*/
public TbNotice selectTbNoticeById(Long id);
/**
* 查询通知公告列表
*
* @param tbNotice 通知公告
* @return 通知公告集合
*/
public List<TbNotice> selectTbNoticeList(TbNotice tbNotice);
/**
* 新增通知公告
*
* @param tbNotice 通知公告
* @return 结果
*/
public int insertTbNotice(TbNotice tbNotice);
/**
* 修改通知公告
*
* @param tbNotice 通知公告
* @return 结果
*/
public int updateTbNotice(TbNotice tbNotice);
/**
* 删除通知公告
*
* @param id 通知公告主键
* @return 结果
*/
public int deleteTbNoticeById(Long id);
/**
* 批量删除通知公告
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteTbNoticeByIds(String[] ids);
}
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.TbNotice;
/**
* 通知公告Service接口
*
* @author ruoyi
* @date 2022-10-18
*/
public interface ITbNoticeService
{
/**
* 查询通知公告
*
* @param id 通知公告主键
* @return 通知公告
*/
public TbNotice selectTbNoticeById(Long id);
/**
* 查询通知公告列表
*
* @param tbNotice 通知公告
* @return 通知公告集合
*/
public List<TbNotice> selectTbNoticeList(TbNotice tbNotice);
/**
* 新增通知公告
*
* @param tbNotice 通知公告
* @return 结果
*/
public int insertTbNotice(TbNotice tbNotice);
/**
* 修改通知公告
*
* @param tbNotice 通知公告
* @return 结果
*/
public int updateTbNotice(TbNotice tbNotice);
/**
* 批量删除通知公告
*
* @param ids 需要删除的通知公告主键集合
* @return 结果
*/
public int deleteTbNoticeByIds(String ids);
/**
* 删除通知公告信息
*
* @param id 通知公告主键
* @return 结果
*/
public int deleteTbNoticeById(Long id);
}
......@@ -10,9 +10,7 @@ import com.ruoyi.system.mapper.TbSchoolMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
/**
* @Author:fanxiaolong
......
package com.ruoyi.system.service.impl;
import java.util.List;
import java.util.stream.Collectors;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.utils.DateUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TbNoticeMapper;
import com.ruoyi.system.domain.TbNotice;
import com.ruoyi.system.service.ITbNoticeService;
import com.ruoyi.common.core.text.Convert;
/**
* 通知公告Service业务层处理
*
* @author ruoyi
* @date 2022-10-18
*/
@Service
public class TbNoticeServiceImpl implements ITbNoticeService
{
@Autowired
private TbNoticeMapper tbNoticeMapper;
@Autowired
private CommonServiceImpl commonService;
/**
* 查询通知公告
*
* @param id 通知公告主键
* @return 通知公告
*/
@Override
public TbNotice selectTbNoticeById(Long id)
{
TbNotice tn=tbNoticeMapper.selectTbNoticeById(id);
tn.setCreatorDesc(commonService.getUserName(tn.getCreator()));
if(ObjectUtils.isNotEmpty(tn.getModifiedBy())){
tn.setModifiedByDesc(commonService.getUserName(tn.getModifiedBy()));
}
tn.setNoticeTypeDesc(commonService.convertDictToString(String.valueOf(tn.getNoticeType()), Constants.BUSINESS_NOTICE_TYPE));
tn.setStatusDesc(commonService.convertDictToString(String.valueOf(tn.getStatus()),Constants.BUSINESS_NOTICE_STATUS));
return tn;
}
/**
* 查询通知公告列表
*
* @param tbNotice 通知公告
* @return 通知公告
*/
@Override
public List<TbNotice> selectTbNoticeList(TbNotice tbNotice)
{
List<TbNotice> list=tbNoticeMapper.selectTbNoticeList(tbNotice);
list.stream().filter(s -> {
s.setCreatorDesc(commonService.getUserName(s.getCreator()));
if(ObjectUtils.isNotEmpty(s.getModifiedBy())){
s.setModifiedByDesc(commonService.getUserName(s.getModifiedBy()));
}
s.setNoticeTypeDesc(commonService.convertDictToString(String.valueOf(s.getNoticeType()), Constants.BUSINESS_NOTICE_TYPE));
s.setStatusDesc(commonService.convertDictToString(String.valueOf(s.getStatus()),Constants.BUSINESS_NOTICE_STATUS));
return true;
}).collect(Collectors.toList());
return list;
}
/**
* 新增通知公告
*
* @param tbNotice 通知公告
* @return 结果
*/
@Override
public int insertTbNotice(TbNotice tbNotice)
{
tbNotice.setCreateTime(DateUtils.getNowDate());
return tbNoticeMapper.insertTbNotice(tbNotice);
}
/**
* 修改通知公告
*
* @param tbNotice 通知公告
* @return 结果
*/
@Override
public int updateTbNotice(TbNotice tbNotice)
{
tbNotice.setUpdateTime(DateUtils.getNowDate());
return tbNoticeMapper.updateTbNotice(tbNotice);
}
/**
* 批量删除通知公告
*
* @param ids 需要删除的通知公告主键
* @return 结果
*/
@Override
public int deleteTbNoticeByIds(String ids)
{
return tbNoticeMapper.deleteTbNoticeByIds(Convert.toStrArray(ids));
}
/**
* 删除通知公告信息
*
* @param id 通知公告主键
* @return 结果
*/
@Override
public int deleteTbNoticeById(Long id)
{
return tbNoticeMapper.deleteTbNoticeById(id);
}
}
......@@ -67,10 +67,10 @@ public class TbSchoolMajorServiceImpl implements ITbSchoolMajorService
@Override
public List<TbSchoolMajor> selectTbSchoolMajorList(TbSchoolMajor tbSchoolMajor)
{
if(!StringUtils.isEmpty(tbSchoolMajor.getSchoolId())){
tbSchoolMajor.setSchoolCnName(tbSchoolMajor.getSchoolId());
tbSchoolMajor.setSchoolId(null);
}
// if(!StringUtils.isEmpty(tbSchoolMajor.getSchoolId())){
// tbSchoolMajor.setSchoolCnName(tbSchoolMajor.getSchoolId());
// tbSchoolMajor.setSchoolId(null);
// }
List<TbSchoolMajor> list=tbSchoolMajorMapper.selectTbSchoolMajorList(tbSchoolMajor);
List<SysDictData> degreeList = sysDictDataMapper.selectDictDataByType(Constants.BUSINESS_DEGREE_TYPE);
List<SysDictData> majorList = sysDictDataMapper.selectDictDataByType(Constants.BUSINESS_MAJOR_TYPE);
......@@ -97,10 +97,10 @@ public class TbSchoolMajorServiceImpl implements ITbSchoolMajorService
@Override
public List<TbSchoolMajor> selectTbSchoolMajorNotPassList(TbSchoolMajor tbSchoolMajor){
if(!StringUtils.isEmpty(tbSchoolMajor.getSchoolId())){
tbSchoolMajor.setSchoolCnName(tbSchoolMajor.getSchoolId());
tbSchoolMajor.setSchoolId(null);
}
// if(!StringUtils.isEmpty(tbSchoolMajor.getSchoolId())){
// tbSchoolMajor.setSchoolCnName(tbSchoolMajor.getSchoolId());
// tbSchoolMajor.setSchoolId(null);
// }
List<TbSchoolMajor> list=tbSchoolMajorMapper.selectTbSchoolMajorNotPassList(tbSchoolMajor);
List<SysDictData> degreeList = sysDictDataMapper.selectDictDataByType(Constants.BUSINESS_DEGREE_TYPE);
List<SysDictData> majorList = sysDictDataMapper.selectDictDataByType(Constants.BUSINESS_MAJOR_TYPE);
......
<?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.TbNoticeMapper">
<resultMap type="TbNotice" id="TbNoticeResult">
<result property="id" column="id" />
<result property="noticeTitle" column="notice_title" />
<result property="noticeType" column="notice_type" />
<result property="userId" column="user_id" />
<result property="noticeContent" column="notice_content" />
<result property="status" column="status" />
<result property="creator" column="creator" />
<result property="createTime" column="create_time" />
<result property="modifiedBy" column="modified_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectTbNoticeVo">
select id, notice_title, notice_type, user_id, notice_content, status, creator, create_time, modified_by, update_time, remark from tb_notice
</sql>
<select id="selectTbNoticeList" parameterType="TbNotice" resultMap="TbNoticeResult">
<include refid="selectTbNoticeVo"/>
<where>
<if test="noticeTitle != null and noticeTitle != ''"> and notice_title = #{noticeTitle}</if>
<if test="noticeType != null "> and notice_type = #{noticeType}</if>
<!-- <if test="userId != null "> and user_id = #{userId}</if>-->
<!-- <if test="noticeContent != null and noticeContent != ''"> and notice_content = #{noticeContent}</if>-->
<!-- <if test="status != null and status != ''"> and status = #{status}</if>-->
<!-- <if test="creator != null "> and creator = #{creator}</if>-->
<!-- <if test="modifiedBy != null "> and modified_by = #{modifiedBy}</if>-->
</where>
</select>
<select id="selectTbNoticeById" parameterType="Long" resultMap="TbNoticeResult">
<include refid="selectTbNoticeVo"/>
where id = #{id}
</select>
<insert id="insertTbNotice" parameterType="TbNotice" useGeneratedKeys="true" keyProperty="id">
insert into tb_notice
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="noticeTitle != null and noticeTitle != ''">notice_title,</if>
<if test="noticeType != null">notice_type,</if>
<if test="userId != null">user_id,</if>
<if test="noticeContent != null and noticeContent != ''">notice_content,</if>
<if test="status != null and status != ''">status,</if>
<if test="creator != null">creator,</if>
<if test="createTime != null">create_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle},</if>
<if test="noticeType != null">#{noticeType},</if>
<if test="userId != null">#{userId},</if>
<if test="noticeContent != null and noticeContent != ''">#{noticeContent},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="creator != null">#{creator},</if>
<if test="createTime != null">#{createTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateTbNotice" parameterType="TbNotice">
update tb_notice
<trim prefix="SET" suffixOverrides=",">
<if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle},</if>
<if test="noticeType != null">notice_type = #{noticeType},</if>
<!-- <if test="userId != null"></if>-->
user_id = #{userId},
<if test="noticeContent != null and noticeContent != ''">notice_content = #{noticeContent},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="modifiedBy != null">modified_by = #{modifiedBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTbNoticeById" parameterType="Long">
delete from tb_notice where id = #{id}
</delete>
<delete id="deleteTbNoticeByIds" parameterType="String">
delete from tb_notice where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
......@@ -68,7 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="educationType != null and educationType != ''">education_type = #{educationType},</if>
<if test="requireDesc != null and requireDesc != ''">require_desc = #{requireDesc},</if>
<if test="modifiedBy != null">modified_by = #{modifiedBy},</if>
update_time = sysdate()
update_time = sysdate(),check_status=1,check_result=null,check_time=null,checker=null
</trim>
where id = #{id}
</update>
......
......@@ -23,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectTbSchoolFacilitiesVo"/>
<where>
<if test="schoolId != null "> and school_id = #{schoolId}</if>
<if test="facilitiesType != null and facilitiesType != ''"> and facilities_type = #{facilitiesType}</if>
<if test="facilitiesType != null and facilitiesType != ''"> and facilities_type like concat('%',#{facilitiesType},'%')</if>
</where>
</select>
......
......@@ -24,9 +24,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="schoolId != null "> and school_id = #{schoolId}</if>
<if test="partnerName != null and partnerName != ''"> and partner_name like concat('%', #{partnerName}, '%')</if>
<if test="partnerImage != null and partnerImage != ''"> and partner_image = #{partnerImage}</if>
<if test="creator != null "> and creator = #{creator}</if>
<if test="modifiedBy != null "> and modified_by = #{modifiedBy}</if>
<!-- <if test="partnerImage != null and partnerImage != ''"> and partner_image = #{partnerImage}</if>-->
<!-- <if test="creator != null "> and creator = #{creator}</if>-->
<!-- <if test="modifiedBy != null "> and modified_by = #{modifiedBy}</if>-->
</where>
</select>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论