master
邓川江 2023-04-23 11:18:56 +08:00
parent 48d727f018
commit d119fae092
5 changed files with 53 additions and 3 deletions

View File

@ -20,6 +20,10 @@
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId> <artifactId>ruoyi-common</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-system</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -7,6 +7,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -20,6 +21,7 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/** /**
* Controller * Controller
@ -70,6 +72,8 @@ public class EduClazzController extends BaseController
return util.exportExcel(list, "班级管理数据"); return util.exportExcel(list, "班级管理数据");
} }
/** /**
* *
*/ */
@ -98,8 +102,11 @@ public class EduClazzController extends BaseController
@GetMapping("/edit/{id}") @GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap) public String edit(@PathVariable("id") Long id, ModelMap mmap)
{ {
eduClazzService.checkClazzDataScope(id);
EduClazz eduClazz = eduClazzService.selectEduClazzById(id); EduClazz eduClazz = eduClazzService.selectEduClazzById(id);
mmap.put("eduClazz", eduClazz); mmap.put("eduClazz", eduClazz);
mmap.put("clazz",eduClazzService.selectEduClazzById(id));
System.out.println(clazz());
return prefix + "/edit"; return prefix + "/edit";
} }
@ -110,8 +117,11 @@ public class EduClazzController extends BaseController
@Log(title = "班级管理", businessType = BusinessType.UPDATE) @Log(title = "班级管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit") @PostMapping("/edit")
@ResponseBody @ResponseBody
public AjaxResult editSave(EduClazz eduClazz) public AjaxResult editSave(@Validated EduClazz eduClazz)
{ {
eduClazzService.checkClazzAllowed(eduClazz);
eduClazzService.checkClazzDataScope(eduClazz.getId());
eduClazz.setUpdateBy(getLoginName());
return toAjax(eduClazzService.updateEduClazz(eduClazz)); return toAjax(eduClazzService.updateEduClazz(eduClazz));
} }

View File

@ -6,7 +6,10 @@ import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanValidators;
import com.ruoyi.common.utils.security.Md5Utils;
import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.edu.mapper.EduClazzMapper; import com.ruoyi.edu.mapper.EduClazzMapper;
@ -26,6 +29,9 @@ public class EduClazzServiceImpl implements IEduClazzService
@Autowired @Autowired
private EduClazzMapper eduClazzMapper; private EduClazzMapper eduClazzMapper;
@Autowired
private ISysConfigService configService;
/** /**
* *
* *
@ -126,4 +132,6 @@ public class EduClazzServiceImpl implements IEduClazzService
public int changeStatus(EduClazz clazz) { public int changeStatus(EduClazz clazz) {
return eduClazzMapper.updateEduClazz(clazz); return eduClazzMapper.updateEduClazz(clazz);
} }
} }

View File

@ -45,6 +45,9 @@
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="edu:clazz:remove"> <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="edu:clazz:remove">
<i class="fa fa-remove"></i> 删除 <i class="fa fa-remove"></i> 删除
</a> </a>
<a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="edu:clazz:import">
<i class="fa fa-upload"></i> 导入
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="edu:clazz:export"> <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="edu:clazz:export">
<i class="fa fa-download"></i> 导出 <i class="fa fa-download"></i> 导出
</a> </a>
@ -67,6 +70,8 @@
updateUrl: prefix + "/edit/{id}", updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove", removeUrl: prefix + "/remove",
exportUrl: prefix + "/export", exportUrl: prefix + "/export",
importUrl: prefix + "/importData",
importTemplateUrl: prefix + "/importTemplate",
modalName: "班级管理", modalName: "班级管理",
columns: [{ columns: [{
checkbox: true checkbox: true
@ -132,4 +137,19 @@
} }
</script> </script>
</body> </body>
<!-- 导入区域 -->
<script id="importTpl" type="text/template">
<form enctype="multipart/form-data" class="mt20 mb10">
<div class="col-xs-offset-1">
<input type="file" id="file" name="file"/>
<div class="mt10 pt5">
<input type="checkbox" id="updateSupport" name="updateSupport" title="如果登录账户已经存在,更新这条数据。"> 是否更新已经存在的用户数据
&nbsp; <a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
</div>
<font color="red" class="pull-left mt10">
提示仅允许导入“xls”或“xlsx”格式文件
</font>
</div>
</form>
</script>
</html> </html>

View File

@ -22,7 +22,11 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">状态:</label> <label class="col-sm-3 control-label">状态:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="visible" th:field="*{visible}" class="form-control" type="text"> <!-- <input name="visible" th:field="*{visible}" class="form-control" type="text">-->
<label class="toggle-switch switch-solid">
<input type="checkbox" id="visible" th:checked="${clazz.visible == '0' ? true : false}">
<span></span>
</label>
</div> </div>
</div> </div>
</form> </form>
@ -36,7 +40,11 @@
function submitHandler() { function submitHandler() {
if ($.validate.form()) { if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-clazz-edit').serialize()); var data = $("#form-clazz-edit").serializeArray();
var visible=$("input[id='visible']").is(':checked') == true ? 0 : 1;
console.log(visible);
data.push({"name": "visible", "value": visible});
$.operate.save(prefix + "/edit", data);
} }
} }
</script> </script>