Ruoyi 自定义字典字段 推荐不推荐
Ruoyi 自定义字典字段 推荐不推荐字典Html按钮<a class="btn btn-danger multiple disabled" onclick="$.operate.studentSuccess()" shiro:hasPermission="system:student:studentSuccess"><i class="fa fa-remove"><
·
Ruoyi 自定义字典字段 推荐不推荐
字典
Html
按钮
<a class="btn btn-danger multiple disabled" onclick="$.operate.studentSuccess()" shiro:hasPermission="system:student:studentSuccess">
<i class="fa fa-remove"></i> 推荐
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.nostudentSuccess()" shiro:hasPermission="system:student:nostudentSuccess">
<i class="fa fa-remove"></i> 不推荐
</a>
//主页显示推荐否 获取对应字典数据
var recom = [[${@dict.getType('sys_student_studentSuccess')}]];
//控制器方法
nostudentSuccess:prefix + "/nostudentSuccess",
importTemplateUrl: prefix + "/importTemplate",
//主页显示
{
field : 'success',
title : '推荐否',
formatter: function(value, row, index) {
return $.table.selectDictLabel(recom, value);
}
},
按钮点击的onclick方法
// 批量推荐信息
studentSuccess: function() {
table.set();
var rows = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId);
if (rows.length == 0) {
$.modal.alertWarning("请至少选择一条记录");
return;
}
$.modal.confirm("确认要推荐选中的" + rows.length + "条数据吗?", function() {
var url = table.options.studentSuccess;
var data = { "ids": rows.join() };
$.operate.submit(url, "post", "json", data);
});
},
// 批量不推荐信息
nostudentSuccess: function() {
table.set();
var rows = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId);
if (rows.length == 0) {
$.modal.alertWarning("请至少选择一条记录");
return;
}
$.modal.confirm("确认要不推荐选中的" + rows.length + "条数据吗?", function() {
var url = table.options.nostudentSuccess;
var data = { "ids": rows.join() };
$.operate.submit(url, "post", "json", data);
});
},
Controller
/**
* 修改推荐
*/
@RequiresPermissions("system:student:studentSuccess")
@Log(title = "通知公告", businessType = BusinessType.updataSuccess)
@PostMapping("/studentSuccess")
@ResponseBody
public AjaxResult studentSuccess(String ids)
{
return toAjax(studentService.studentSuccess(ids));
}
/**
* 修改不推荐
*/
@RequiresPermissions("system:student:nostudentSuccess")
@Log(title = "通知公告", businessType = BusinessType.updataSuccess)
@PostMapping("/nostudentSuccess")
@ResponseBody
public AjaxResult nostudentSuccess(String ids)
{
return toAjax(studentService.nostudentSuccess(ids));
}
ServiceImpl
/**
* 推荐公告对象
*
* @param ids 需要推荐的数据ID
* @return 结果
*/
@Override
public int studentSuccess(String ids)
{
return studentMapper.studentSuccess(Convert.toStrArray(ids));
}
/**
* 不推荐公告对象
*
* @param ids 需要不推荐的数据ID
* @return 结果
*/
@Override
public int nostudentSuccess(String ids)
{
return studentMapper.nostudentSuccess(Convert.toStrArray(ids));
}
Mapper
/**
* 批量修改推荐
*
* @param studentIds 需要推荐的数据ID
* @return 结果
*/
public int studentSuccess(String[] studentIds);
/**
* 批量修改不推荐
*
* @param studentIds 需要不推荐的数据ID
* @return 结果
*/
public int nostudentSuccess(String[] studentIds);
Mapper.xml
<update id="studentSuccess" parameterType="Student">
update student set success=1 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<update id="nostudentSuccess" parameterType="Student">
update student set success=0 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
更多推荐
已为社区贡献9条内容
所有评论(0)