代码提交

This commit is contained in:
zhengzheng 2022-03-18 18:34:22 +08:00
parent 1e46397105
commit 545cb01fa6
16 changed files with 1674 additions and 147 deletions

View File

@ -1,91 +1,85 @@
//package com.wuzhen.web.controller.system;
//
//import com.wuzhen.common.annotation.Log;
//import com.wuzhen.common.constant.UserConstants;
//import com.wuzhen.common.core.controller.BaseController;
//import com.wuzhen.common.core.domain.AjaxResult;
//import com.wuzhen.common.core.domain.entity.SysRole;
//import com.wuzhen.common.core.domain.entity.SysUser;
//import com.wuzhen.common.core.page.TableDataInfo;
//import com.wuzhen.common.enums.BusinessType;
//import com.wuzhen.common.utils.poi.ExcelUtil;
//import com.wuzhen.framework.shiro.util.AuthorizationUtils;
//import com.wuzhen.system.domain.SysUserRole;
//import com.wuzhen.system.service.ISysRoleService;
//import com.wuzhen.system.service.ISysUserService;
//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.validation.annotation.Validated;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.List;
//
///**
// * 角色信息
// *
// * @author zhengzheng
// */
//@Controller
//@RequestMapping("/system/role")
//public class ActiveInfoController extends BaseController
//{
// private String prefix = "system/role";
//
// @Autowired
// private ISysRoleService roleService;
//
// @Autowired
// private ISysUserService userService;
//
// @RequiresPermissions("system:role:view")
// @GetMapping()
// public String role()
// {
// return prefix + "/role";
// }
//
// @RequiresPermissions("system:role:list")
// @PostMapping("/list")
// @ResponseBody
// public TableDataInfo list(SysRole role)
// {
// startPage();
// List<SysRole> list = roleService.selectRoleList(role);
// return getDataTable(list);
// }
//
// @Log(title = "角色管理", businessType = BusinessType.EXPORT)
// @RequiresPermissions("system:role:export")
// @PostMapping("/export")
// @ResponseBody
// public AjaxResult export(SysRole role)
// {
// List<SysRole> list = roleService.selectRoleList(role);
// ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
// return util.exportExcel(list, "角色数据");
// }
//
// /**
// * 新增角色
// */
// @GetMapping("/add")
// public String add()
// {
// return prefix + "/add";
// }
//
// /**
// * 新增保存角色
// */
// @RequiresPermissions("system:role:add")
// @Log(title = "角色管理", businessType = BusinessType.INSERT)
// @PostMapping("/add")
// @ResponseBody
// public AjaxResult addSave(@Validated SysRole role)
// {
// if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
package com.wuzhen.web.controller.busi;
import com.wuzhen.common.annotation.Log;
import com.wuzhen.common.core.controller.BaseController;
import com.wuzhen.common.core.domain.AjaxResult;
import com.wuzhen.common.core.page.TableDataInfo;
import com.wuzhen.common.enums.BusinessType;
import com.wuzhen.common.utils.poi.ExcelUtil;
import com.wuzhen.framework.shiro.util.AuthorizationUtils;
import com.wuzhen.system.domain.ActiveInfo;
import com.wuzhen.system.service.IActiveInfoService;
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.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 角色信息
*
* @author zhengzheng
*/
@Controller
@RequestMapping("/active/info")
public class ActiveInfoController extends BaseController
{
private String prefix = "active/info";
@Autowired
private IActiveInfoService activeInfoService;
@RequiresPermissions("active:info:view")
@GetMapping()
public String role()
{
return prefix + "/index";
}
@RequiresPermissions("active:info:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(ActiveInfo activeInfo)
{
startPage();
List<ActiveInfo> list = activeInfoService.selectActiveList(activeInfo);
return getDataTable(list);
}
@Log(title = "活动信息导出", businessType = BusinessType.EXPORT)
@RequiresPermissions("active:info:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(ActiveInfo activeInfo)
{
List<ActiveInfo> list = activeInfoService.selectActiveList(activeInfo);
ExcelUtil<ActiveInfo> util = new ExcelUtil<ActiveInfo>(ActiveInfo.class);
return util.exportExcel(list, "活动信息");
}
/**
* 新增活动
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存活动
*/
@RequiresPermissions("active:info:add")
@Log(title = "活动管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(@Validated ActiveInfo activeInfo)
{
// if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(activeInfoService.checkNameUnique(role)))
// {
// return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
// }
@ -93,33 +87,33 @@
// {
// return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
// }
// role.setCreateBy(getLoginName());
// AuthorizationUtils.clearAllCachedAuthorizationInfo();
// return toAjax(roleService.insertRole(role));
//
// }
//
// /**
// * 修改角色
// */
// @RequiresPermissions("system:role:edit")
// @GetMapping("/edit/{roleId}")
// public String edit(@PathVariable("roleId") Long roleId, ModelMap mmap)
// {
activeInfo.setCreateBy(getLoginName());
AuthorizationUtils.clearAllCachedAuthorizationInfo();
return toAjax(activeInfoService.insertActive(activeInfo));
}
/**
* 修改活动
*/
@RequiresPermissions("active:info:edit")
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
// roleService.checkRoleDataScope(roleId);
// mmap.put("role", roleService.selectRoleById(roleId));
// return prefix + "/edit";
// }
//
// /**
// * 修改保存角色
// */
// @RequiresPermissions("system:role:edit")
// @Log(title = "角色管理", businessType = BusinessType.UPDATE)
// @PostMapping("/edit")
// @ResponseBody
// public AjaxResult editSave(@Validated SysRole role)
// {
mmap.put("active", activeInfoService.selectActiveById(id));
return prefix + "/edit";
}
/**
* 修改保存活动
*/
@RequiresPermissions("active:info:edit")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(@Validated ActiveInfo activeInfo)
{
// roleService.checkRoleAllowed(role);
// roleService.checkRoleDataScope(role.getRoleId());
// if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
@ -130,11 +124,11 @@
// {
// return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
// }
// role.setUpdateBy(getLoginName());
// AuthorizationUtils.clearAllCachedAuthorizationInfo();
// return toAjax(roleService.updateRole(role));
// }
//
activeInfo.setUpdateBy(getLoginName());
AuthorizationUtils.clearAllCachedAuthorizationInfo();
return toAjax(activeInfoService.updateActive(activeInfo));
}
// /**
// * 角色分配数据权限
// */
@ -144,7 +138,7 @@
// mmap.put("role", roleService.selectRoleById(roleId));
// return prefix + "/dataScope";
// }
//
// /**
// * 保存角色分配数据权限
// */
@ -164,17 +158,17 @@
// }
// return error();
// }
//
// @RequiresPermissions("system:role:remove")
// @Log(title = "角色管理", businessType = BusinessType.DELETE)
// @PostMapping("/remove")
// @ResponseBody
// public AjaxResult remove(String ids)
// {
// return toAjax(roleService.deleteRoleByIds(ids));
// }
//
// /**
@RequiresPermissions("active:info:remove")
@Log(title = "活动管理", businessType = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(activeInfoService.deleteActiveByIds(ids));
}
/**
// * 校验角色名称
// */
// @PostMapping("/checkRoleNameUnique")
@ -202,7 +196,7 @@
// {
// return prefix + "/tree";
// }
//
// /**
// * 角色状态修改
// */
@ -216,7 +210,7 @@
// roleService.checkRoleDataScope(role.getRoleId());
// return toAjax(roleService.changeStatus(role));
// }
//
// /**
// * 分配用户
// */
@ -227,7 +221,7 @@
// mmap.put("role", roleService.selectRoleById(roleId));
// return prefix + "/authUser";
// }
//
// /**
// * 查询已分配用户角色列表
// */
@ -240,7 +234,7 @@
// List<SysUser> list = userService.selectAllocatedList(user);
// return getDataTable(list);
// }
//
// /**
// * 取消授权
// */
@ -252,10 +246,10 @@
// {
// return toAjax(roleService.deleteAuthUser(userRole));
// }
//
// /**
// * 批量取消授权
// */
/**
* 批量取消授权
*/
// @RequiresPermissions("system:role:edit")
// @Log(title = "角色管理", businessType = BusinessType.GRANT)
// @PostMapping("/authUser/cancelAll")
@ -264,7 +258,7 @@
// {
// return toAjax(roleService.deleteAuthUsers(roleId, userIds));
// }
//
// /**
// * 选择用户
// */
@ -274,7 +268,7 @@
// mmap.put("role", roleService.selectRoleById(roleId));
// return prefix + "/selectUser";
// }
//
// /**
// * 查询未分配用户角色列表
// */
@ -287,7 +281,7 @@
// List<SysUser> list = userService.selectUnallocatedList(user);
// return getDataTable(list);
// }
//
// /**
// * 批量选择用户授权
// */
@ -300,4 +294,4 @@
// roleService.checkRoleDataScope(roleId);
// return toAjax(roleService.insertAuthUsers(roleId, userIds));
// }
//}
}

View File

@ -1,4 +1,4 @@
//package com.wuzhen.web.controller.system;
package com.wuzhen.web.controller.busi;//package com.wuzhen.web.controller.system;
//
//import com.wuzhen.common.annotation.Log;
//import com.wuzhen.common.constant.UserConstants;

View File

@ -1,4 +1,4 @@
package com.wuzhen.web.controller.system;
package com.wuzhen.web.controller.busi;
import com.wuzhen.common.annotation.Log;
import com.wuzhen.common.core.controller.BaseController;

View File

@ -21,6 +21,6 @@ public class DruidController extends BaseController
@GetMapping()
public String index()
{
return redirect(prefix + "/index.html");
return redirect(prefix + "/edit.html");
}
}

View File

@ -19,6 +19,6 @@ public class SwaggerController extends BaseController
@GetMapping()
public String index()
{
return redirect("/swagger-ui/index.html");
return redirect("/swagger-ui/edit.html");
}
}

View File

@ -0,0 +1,142 @@
<!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="role-form">
<input type="hidden" id="roleId" name="roleId" th:value="${role.roleId}">
<div class="select-list">
<ul>
<li>
登录名称:<input type="text" name="loginName"/>
</li>
<li>
手机号码:<input type="text" name="phonenumber"/>
</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="selectUser()" shiro:hasPermission="system:role:add">
<i class="fa fa-plus"></i> 添加用户
</a>
<a class="btn btn-danger multiple disabled" onclick="cancelAuthUserAll()" shiro:hasPermission="system:role:remove">
<i class="fa fa-remove"></i> 批量取消授权
</a>
<a class="btn btn-warning" onclick="closeItem()">
<i class="fa fa-reply-all"></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 removeFlag = [[${@permission.hasPermi('system:role:remove')}]];
var datas = [[${@dict.getType('sys_normal_disable')}]];
var prefix = ctx + "system/role/authUser";
$(function() {
var options = {
url: prefix + "/allocatedList",
queryParams: queryParams,
sortName: "createTime",
sortOrder: "desc",
columns: [{
checkbox: true
},
{
field: 'userId',
title: '用户ID',
visible: false
},
{
field: 'loginName',
title: '登录名称',
sortable: true
},
{
field: 'userName',
title: '用户名称'
},
{
field: 'email',
title: '邮箱'
},
{
field: 'phonenumber',
title: '手机'
},
{
field: 'status',
title: '用户状态',
align: 'center',
formatter: function (value, row, index) {
return $.table.selectDictLabel(datas, value);
}
},
{
field: 'createTime',
title: '创建时间',
sortable: true
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="cancelAuthUser(\'' + row.userId + '\')"><i class="fa fa-remove"></i>取消授权</a> ');
return actions.join('');
}
}]
};
$.table.init(options);
});
function queryParams(params) {
var search = $.table.queryParams(params);
search.roleId = $("#roleId").val();
return search;
}
/* 分配用户-选择用户 */
function selectUser() {
var url = prefix + '/selectUser/' + $("#roleId").val();
$.modal.open("选择用户", url);
}
/* 分配用户-批量取消授权 */
function cancelAuthUserAll(userId) {
var rows = $.table.selectFirstColumns();
if (rows.length == 0) {
$.modal.alertWarning("请至少选择一条记录");
return;
}
$.modal.confirm("确认要删除选中的" + rows.length + "条数据吗?", function() {
var data = { "roleId": $("#roleId").val(), "userIds": rows.join() };
$.operate.submit(prefix + "/cancelAll", "post", "json", data);
});
}
/* 分配用户-取消授权 */
function cancelAuthUser(userId) {
$.modal.confirm("确认要取消该用户角色吗?", function() {
$.operate.post(prefix + "/cancel", { "roleId": $("#roleId").val(), "userId": userId });
})
}
</script>
</body>
</html>

View File

@ -0,0 +1,137 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('角色数据权限')" />
<th:block th:include="include :: ztree-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-role-edit" th:object="${role}">
<input id="roleId" name="roleId" type="hidden" th:field="*{roleId}"/>
<div class="form-group">
<label class="col-sm-3 control-label">角色名称:</label>
<div class="col-sm-8">
<input class="form-control" type="text" name="roleName" id="roleName" th:field="*{roleName}" readonly="true"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">权限字符:</label>
<div class="col-sm-8">
<input class="form-control" type="text" name="roleKey" id="roleKey" th:field="*{roleKey}" readonly="true">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">数据范围:</label>
<div class="col-sm-8">
<select id="dataScope" name="dataScope" class="form-control m-b">
<option value="1" th:field="*{dataScope}">全部数据权限</option>
<option value="2" th:field="*{dataScope}">自定数据权限</option>
<option value="3" th:field="*{dataScope}">本部门数据权限</option>
<option value="4" th:field="*{dataScope}">本部门及以下数据权限</option>
<option value="5" th:field="*{dataScope}">仅本人数据权限</option>
</select>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 特殊情况下,设置为“自定数据权限”</span>
</div>
</div>
<div class="form-group" id="authDataScope" th:style="'display:' + @{(*{dataScope=='2'} ? 'block' : 'none')} + ''">
<label class="col-sm-3 control-label">数据权限:</label>
<div class="col-sm-8">
<label class="check-box">
<input type="checkbox" value="1" checked>展开/折叠</label>
<label class="check-box">
<input type="checkbox" value="2">全选/全不选</label>
<label class="check-box">
<input type="checkbox" value="3" checked>父子联动</label>
<div id="deptTrees" class="ztree ztree-border"></div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: ztree-js" />
<script type="text/javascript">
$(function() {
var url = ctx + "system/dept/roleDeptTreeData?roleId=" + $("#roleId").val();
var options = {
id: "deptTrees",
url: url,
check: { enable: true, nocheckInherit: true, chkboxType: { "Y": "ps", "N": "ps" } },
expandLevel: 2
};
$.tree.init(options);
});
$('input').on('ifChanged', function(obj){
var type = $(this).val();
var checked = obj.currentTarget.checked;
if (type == 1) {
if (checked) {
$._tree.expandAll(true);
} else {
$._tree.expandAll(false);
}
} else if (type == "2") {
if (checked) {
$._tree.checkAllNodes(true);
} else {
$._tree.checkAllNodes(false);
}
} else if (type == "3") {
if (checked) {
$._tree.setting.check.chkboxType = { "Y": "ps", "N": "ps" };
} else {
$._tree.setting.check.chkboxType = { "Y": "", "N": "" };
}
}
})
function submitHandler() {
if ($.validate.form()) {
edit();
}
}
function edit() {
var roleId = $("input[name='roleId']").val();
var roleName = $("input[name='roleName']").val();
var roleKey = $("input[name='roleKey']").val();
var dataScope = $("#dataScope").val();
var deptIds = $.tree.getCheckedNodes();
$.ajax({
cache : true,
type : "POST",
url : ctx + "system/role/authDataScope",
data : {
"roleId": roleId,
"roleName": roleName,
"roleKey": roleKey,
"dataScope": dataScope,
"deptIds": deptIds
},
async : false,
error : function(request) {
$.modal.alertError("系统错误");
},
success : function(data) {
$.operate.successCallback(data);
}
});
}
$("#dataScope").change(function(event){
var dataScope = $(event.target).val();
dataScopeVisible(dataScope);
});
function dataScopeVisible(dataScope) {
if (dataScope == 2) {
$("#authDataScope").show();
} else {
$._tree.checkAllNodes(false);
$("#authDataScope").hide();
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,92 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增活动')" />
<!-- <th:block th:include="include :: ztree-css" />-->
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-role-add">
<div class="form-group">
<label class="col-sm-3 control-label is-required">活动标题:</label>
<div class="col-sm-8">
<input class="form-control" type="text" name="activeTitle" id="activeTitle" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">活动内容描述:</label>
<div class="col-sm-8">
<textarea name="activeDesc" maxlength="500" class="form-control" rows="3"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">活动类型:</label>
<div class="col-sm-8">
<input class="form-control" type="text" name="activeType" id="activeType" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">活动图片:</label>
<div class="col-sm-8">
<input class="form-control" type="text" name="activePic" id="activePic" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">状态:</label>
<div class="col-sm-8">
<label class="toggle-switch switch-solid">
<input type="checkbox" id="status" checked>
<span></span>
</label>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<input id="remark" name="remark" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<!-- <th:block th:include="include :: ztree-js" />-->
<script type="text/javascript">
function submitHandler() {
add();
}
function add() {
var activeTitle = $("input[name='activeTitle']").val();
var activeDesc =$("textarea[name='activeDesc']").val();
var activeType = $("input[name='activeType']").val();
var activePic = $("input[name='activePic']").val();
var status = $("input[id='status']").is(':checked') == true ? 0 : 1;
var remark = $("input[name='remark']").val();
$.ajax({
cache : true,
type : "POST",
url : ctx + "active/info/add",
data : {
"activeTitle": activeTitle,
"activeDesc": activeDesc,
"activeType": activeType,
"activePic": activePic,
"status": status,
"remark": remark
},
async : false,
error : function(request) {
$.modal.alertError("系统错误");
},
success : function(data) {
$.operate.successCallback(data);
}
});
}
</script>
</body>
</html>

View File

@ -0,0 +1,109 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改活动信息')" />
<th:block th:include="include :: ztree-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-role-edit" th:object="${active}">
<input id="roleId" name="id" type="hidden" th:field="*{id}"/>
<div class="form-group">
<label class="col-sm-3 control-label is-required">活动标题:</label>
<div class="col-sm-8">
<input class="form-control" type="text" name="activeTitle" id="activeTitle" th:field="*{activeTitle}" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">活动内容描述:</label>
<div class="col-sm-8">
<textarea name="activeDesc" maxlength="500" class="form-control" rows="3">[[*{activeDesc}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">活动开始日期:</label>
<div class="col-sm-8">
<input class="form-control" type="text" name="activeStartDate" id="activeStartDate" th:field="*{activeStartDate}" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">活动结束日期:</label>
<div class="col-sm-8">
<input class="form-control" type="text" name="activeEndDate" id="activeEndDate" th:field="*{activeEndDate}" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">活动类型:</label>
<div class="col-sm-8">
<input class="form-control" type="text" name="activeType" id="activeType" th:field="*{activeType}" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">活动图片:</label>
<div class="col-sm-8">
<input class="form-control" type="text" name="activePic" id="activePic" th:field="*{activePic}" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">状态:</label>
<div class="col-sm-8">
<label class="toggle-switch switch-solid">
<input type="checkbox" id="status" th:checked="${active.status == '0' ? true : false}">
<span></span>
</label>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<input id="remark" name="remark" class="form-control" type="text" th:field="*{remark}">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script type="text/javascript">
function edit() {
var id = $("input[name='id']").val();
var activeTitle = $("input[name='activeTitle']").val();
var activeDesc =$("textarea[name='activeDesc']").val();
var activeStartDate = $("input[name='activeStartDate']").val();
var activeEndDate = $("input[name='activeEndDate']").val();
var activeType = $("input[name='activeType']").val();
var activePic = $("input[name='activePic']").val();
var status = $("input[id='status']").is(':checked') == true ? 0 : 1;
var remark = $("input[name='remark']").val();
$.ajax({
cache : true,
type : "POST",
url : ctx + "active/info/edit",
data : {
"id": id,
"activeTitle": activeTitle,
"activeDesc": activeDesc,
"activeStartDate": activeStartDate,
"activeEndDate": activeEndDate,
"activeType": activeType,
"activePic": activePic,
"status": status,
"remark": remark
},
async : false,
error : function(request) {
$.modal.alertError("系统错误");
},
success : function(data) {
$.operate.successCallback(data);
}
});
}
function submitHandler() {
edit();
}
</script>
</body>
</html>

View File

@ -0,0 +1,164 @@
<!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="role-form">
<div class="select-list">
<ul>
<li>
活动标题:<input type="text" name="roleName"/>
</li>
<li>
互动状态:<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li class="select-time">
<label>活动日期: </label>
<input type="text" class="time-input" id="activeStartDate" placeholder="开始时间" name="params[activeStartDate]"/>
<span>-</span>
<input type="text" class="time-input" id="activeEndDate" placeholder="结束时间" name="params[activeEndDate]"/>
</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="active:info:add">
<i class="fa fa-plus"></i> 新增
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="active:info:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="active:info:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="active:info: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('active:info:list')}]];
var removeFlag = [[${@permission.hasPermi('active:info:remove')}]];
var prefix = ctx + "active/info";
$(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: '活动编号'
},
{
field: 'activeTitle',
title: '活动标题',
sortable: true
},
{
field: 'activeDesc',
title: '活动内容描述',
sortable: true
},
{
field: 'activeType',
title: '活动类型',
sortable: true
},
{
field: 'activeStartDate',
title: '活动开始日期',
sortable: true
},
{
field: 'activeEndDate',
title: '活动开始日期',
sortable: true
},
{
field: 'createTime',
title: '创建时间',
sortable: true
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
if (row.roleId != 1) {
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('');
} else {
return "";
}
}
}]
};
$.table.init(options);
});
/* 角色管理-分配数据权限 */
function authDataScope(roleId) {
var url = prefix + '/authDataScope/' + roleId;
$.modal.open("分配数据权限", url);
}
/* 角色管理-分配用户 */
function authUser(roleId) {
var url = prefix + '/authUser/' + roleId;
$.modal.openTab("分配用户", url);
}
/* 角色状态显示 */
function statusTools(row) {
if (row.status == 1) {
return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.roleId + '\')"></i> ';
} else {
return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.roleId + '\')"></i> ';
}
}
/* 活动管理-停用 */
function disable(roleId) {
$.modal.confirm("确认要停用角色吗?", function() {
$.operate.post(prefix + "/changeStatus", { "id": id, "status": 1 });
})
}
/* 活动管理启用 */
function enable(roleId) {
$.modal.confirm("确认要启用角色吗?", function() {
$.operate.post(prefix + "/changeStatus", { "id": id, "status": 0 });
})
}
</script>
</body>
</html>

View File

@ -0,0 +1,113 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<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="role-form">
<input type="hidden" id="roleId" name="roleId" th:value="${role.roleId}">
<div class="select-list">
<ul>
<li>
登录名称:<input type="text" name="loginName"/>
</li>
<li>
手机号码:<input type="text" name="phonenumber"/>
</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="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 datas = [[${@dict.getType('sys_normal_disable')}]];
var prefix = ctx + "system/role/authUser";
$(function() {
var options = {
url: prefix + "/unallocatedList",
queryParams: queryParams,
sortName: "createTime",
sortOrder: "desc",
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
clickToSelect: true,
rememberSelected: true,
columns: [{
field: 'state',
checkbox: true
},
{
field: 'userId',
title: '用户ID',
visible: false
},
{
field: 'loginName',
title: '登录名称',
sortable: true
},
{
field: 'userName',
title: '用户名称'
},
{
field: 'email',
title: '邮箱'
},
{
field: 'phonenumber',
title: '手机'
},
{
field: 'status',
title: '用户状态',
align: 'center',
formatter: function (value, row, index) {
return $.table.selectDictLabel(datas, value);
}
},
{
field: 'createTime',
title: '创建时间',
sortable: true
}]
};
$.table.init(options);
});
function queryParams(params) {
var search = $.table.queryParams(params);
search.roleId = $("#roleId").val();
return search;
}
/* 添加用户-选择用户-提交 */
function submitHandler() {
var rows = $.table.selectFirstColumns();
if (rows.length == 0) {
$.modal.alertWarning("请至少选择一条记录");
return;
}
var data = { "roleId": $("#roleId").val(), "userIds": rows.join() };
$.operate.save(prefix + "/selectAll", data);
}
</script>
</body>
</html>

View File

@ -0,0 +1,163 @@
package com.wuzhen.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.wuzhen.common.annotation.Excel;
import com.wuzhen.common.annotation.Excel.ColumnType;
import com.wuzhen.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 活动信息 active_info
*
* @author zhengzheng
*/
public class ActiveInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 活动编号
*/
@Excel(name = "报名用户编号", cellType = ColumnType.NUMERIC)
private Long id;
/**
* 活动标题
*/
@Excel(name = "活动标题")
private String activeTitle;
/**
* 活动内容描述
*/
@Excel(name = "活动内容描述")
private String activeDesc;
/**
* 活动开始日期
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "活动开始日期")
private String activeStartDate;
/**
* 活动结束日期
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "活动结束日期")
private String activeEndDate;
/**
* 海报地址
*/
@Excel(name = "活动类型")
private String activeType;
/**
* 活动图片
*/
@Excel(name = "活动图片")
private String activePic;
/**
* 推荐人编号
*/
@Excel(name = "活动状态")
private String status;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getActiveTitle() {
return activeTitle;
}
public void setActiveTitle(String activeTitle) {
this.activeTitle = activeTitle;
}
public String getActiveDesc() {
return activeDesc;
}
public void setActiveDesc(String activeDesc) {
this.activeDesc = activeDesc;
}
public String getActiveStartDate() {
return activeStartDate;
}
public void setActiveStartDate(String activeStartDate) {
this.activeStartDate = activeStartDate;
}
public String getActiveEndDate() {
return activeEndDate;
}
public void setActiveEndDate(String activeEndDate) {
this.activeEndDate = activeEndDate;
}
public String getActiveType() {
return activeType;
}
public void setActiveType(String activeType) {
this.activeType = activeType;
}
public String getActivePic() {
return activePic;
}
public void setActivePic(String activePic) {
this.activePic = activePic;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("activeTitle", getActiveTitle())
.append("activeDesc", getActiveDesc())
.append("activeStartDate", getActiveStartDate())
.append("activeEndDate", getActiveEndDate())
.append("activeType", getActiveType())
.append("activePic", getActivePic())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -0,0 +1,65 @@
package com.wuzhen.system.mapper;
import com.wuzhen.system.domain.ActiveInfo;
import java.util.List;
/**
* 角色表 数据层
*
* @author zhengzheng
*/
public interface ActiveInfoMapper
{
/**
* 根据条件分页查询角色数据
*
* @param activeInfo 活动信息
* @return 活动数据集合信息
*/
public List<ActiveInfo> selectActiveList(ActiveInfo activeInfo);
/**
* 通过活动ID查询角色
*
* @param id ID
* @return 角色对象信息
*/
public ActiveInfo selectActiveById(Long id);
/**
* 通过角色ID删除角色
*
* @param id 角色ID
* @return 结果
*/
public int deleteActiveById(Long id);
/**
* 批量活动信息
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteActiveByIds(Long[] ids);
/**
* 修改角色信息
*
* @param activeInfo 角色信息
* @return 结果
*/
public int updateActive(ActiveInfo activeInfo);
/**
* 新增角色信息
*
* @param activeInfo 角色信息
* @return 结果
*/
public int insertActive(ActiveInfo activeInfo);
}

View File

@ -0,0 +1,72 @@
package com.wuzhen.system.service;
import com.wuzhen.system.domain.ActiveInfo;
import java.util.List;
/**
* 活动信息服务层
*
* @author zhengzheng
*/
public interface IActiveInfoService
{
/**
* 根据条件分页查询角色数据
*
* @param activeInfo 活动信息
* @return 活动数据集合信息
*/
public List<ActiveInfo> selectActiveList(ActiveInfo activeInfo);
/**
* 查询所有角色
*
* @return 角色列表
*/
public List<ActiveInfo> selectActiveAll();
/**
* 通过角色ID查询角色
*
* @param id 活动ID
* @return 角色对象信息
*/
public ActiveInfo selectActiveById(Long id);
/**
* 通过活动ID删除角色
*
* @param id 角色ID
* @return 结果
*/
public boolean deleteActiveById(Long id);
/**
* 批量删除角色用户信息
*
* @param ids 需要删除的数据ID
* @return 结果
* @throws Exception 异常
*/
public int deleteActiveByIds(String ids);
/**
* 新增保存角色信息
*
* @param activeInfo 角色信息
* @return 结果
*/
public int insertActive(ActiveInfo activeInfo);
/**
* 修改保存角色信息
*
* @param activeInfo 角色信息
* @return 结果
*/
public int updateActive(ActiveInfo activeInfo);
}

View File

@ -0,0 +1,354 @@
package com.wuzhen.system.service.impl;
import com.wuzhen.common.annotation.DataScope;
import com.wuzhen.common.core.text.Convert;
import com.wuzhen.common.utils.spring.SpringUtils;
import com.wuzhen.system.domain.ActiveInfo;
import com.wuzhen.system.mapper.ActiveInfoMapper;
import com.wuzhen.system.service.IActiveInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 角色 业务层处理
*
* @author zhengzheng
*/
@Service
public class ActiveInfoServiceImpl implements IActiveInfoService {
@Autowired
private ActiveInfoMapper activeInfoMapper;
/**
* 根据条件分页查询角色数据
*
* @param activeInfo 角色信息
* @return 角色数据集合信息
*/
@Override
@DataScope(deptAlias = "d")
public List<ActiveInfo> selectActiveList(ActiveInfo activeInfo) {
return activeInfoMapper.selectActiveList(activeInfo);
}
// /**
// * 根据用户ID查询权限
// *
// * @param userId 用户ID
// * @return 权限列表
// */
// @Override
// public Set<String> selectRoleKeys(Long userId)
// {
// List<SysRole> perms = roleMapper.selectRolesByUserId(userId);
// Set<String> permsSet = new HashSet<>();
// for (SysRole perm : perms)
// {
// if (StringUtils.isNotNull(perm))
// {
// permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(",")));
// }
// }
// return permsSet;
// }
// /**
// * 根据用户ID查询角色
// *
// * @param userId 用户ID
// * @return 角色列表
// */
// @Override
// public List<SysRole> selectRolesByUserId(Long userId)
// {
// List<SysRole> userRoles = roleMapper.selectRolesByUserId(userId);
// List<SysRole> roles = selectRoleAll();
// for (SysRole role : roles)
// {
// for (SysRole userRole : userRoles)
// {
// if (role.getRoleId().longValue() == userRole.getRoleId().longValue())
// {
// role.setFlag(true);
// break;
// }
// }
// }
// return roles;
// }
/**
* 查询所有角色
*
* @return 角色列表
*/
@Override
public List<ActiveInfo> selectActiveAll() {
return SpringUtils.getAopProxy(this).selectActiveList(new ActiveInfo());
}
/**
* 通过活动ID查询角色
*
* @param id 活动ID
* @return 活动对象信息
*/
@Override
public ActiveInfo selectActiveById(Long id) {
return activeInfoMapper.selectActiveById(id);
}
/**
* 通过角色ID删除角色
*
* @param id 角色ID
* @return 结果
*/
@Override
@Transactional
public boolean deleteActiveById(Long id) {
return activeInfoMapper.deleteActiveById(id) > 0 ? true : false;
}
/**
* 批量删除角色信息
*
* @param ids 需要删除的数据ID
* @throws Exception
*/
@Override
@Transactional
public int deleteActiveByIds(String ids) {
Long[] ids_arr = Convert.toLongArray(ids);
// for (Long roleId : roleIds) {
// checkRoleAllowed(new SysRole(roleId));
// checkRoleDataScope(roleId);
// SysRole role = selectRoleById(roleId);
// if (countUserRoleByRoleId(roleId) > 0) {
// throw new ServiceException(String.format("%1$s已分配,不能删除", role.getRoleName()));
// }
// }
// // 删除角色与菜单关联
// roleMenuMapper.deleteRoleMenu(roleIds);
// // 删除角色与部门关联
// roleDeptMapper.deleteRoleDept(roleIds);
return activeInfoMapper.deleteActiveByIds(ids_arr);
}
/**
* 新增保存角色信息
*
* @param activeInfo 角色信息
* @return 结果
*/
@Override
@Transactional
public int insertActive(ActiveInfo activeInfo) {
// 新增角色信息
// activeInfoMapper.insertActive(activeInfo);
return activeInfoMapper.insertActive(activeInfo);
}
/**
* 修改保存活动信息
*
* @param activeInfo 活动信息
* @return 结果
*/
@Override
@Transactional
public int updateActive(ActiveInfo activeInfo) {
// 修改角色信息
activeInfoMapper.updateActive(activeInfo);
return activeInfoMapper.updateActive(activeInfo);
}
/**
* 修改数据权限信息
*
* @param role 角色信息
* @return 结果
*/
// @Override
// @Transactional
// public int authDataScope(SysRole role) {
// // 修改角色信息
// roleMapper.updateRole(role);
// // 删除角色与部门关联
// roleDeptMapper.deleteRoleDeptByRoleId(role.getRoleId());
// // 新增角色和部门信息数据权限
// return insertRoleDept(role);
// }
//
// /**
// * 新增角色菜单信息
// *
// * @param role 角色对象
// */
// public int insertRoleMenu(SysRole role) {
// int rows = 1;
// // 新增用户与角色管理
// List<SysRoleMenu> list = new ArrayList<SysRoleMenu>();
// for (Long menuId : role.getMenuIds()) {
// SysRoleMenu rm = new SysRoleMenu();
// rm.setRoleId(role.getRoleId());
// rm.setMenuId(menuId);
// list.add(rm);
// }
// if (list.size() > 0) {
// rows = roleMenuMapper.batchRoleMenu(list);
// }
// return rows;
// }
//
// /**
// * 新增角色部门信息(数据权限)
// *
// * @param role 角色对象
// */
// public int insertRoleDept(SysRole role) {
// int rows = 1;
// // 新增角色与部门数据权限管理
// List<SysRoleDept> list = new ArrayList<SysRoleDept>();
// for (Long deptId : role.getDeptIds()) {
// SysRoleDept rd = new SysRoleDept();
// rd.setRoleId(role.getRoleId());
// rd.setDeptId(deptId);
// list.add(rd);
// }
// if (list.size() > 0) {
// rows = roleDeptMapper.batchRoleDept(list);
// }
// return rows;
// }
//
// /**
// * 校验角色名称是否唯一
// *
// * @param role 角色信息
// * @return 结果
// */
// @Override
// public String checkRoleNameUnique(SysRole role) {
// Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
// SysRole info = roleMapper.checkRoleNameUnique(role.getRoleName());
// if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) {
// return UserConstants.ROLE_NAME_NOT_UNIQUE;
// }
// return UserConstants.ROLE_NAME_UNIQUE;
// }
//
// /**
// * 校验角色权限是否唯一
// *
// * @param role 角色信息
// * @return 结果
// */
// @Override
// public String checkRoleKeyUnique(SysRole role) {
// Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
// SysRole info = roleMapper.checkRoleKeyUnique(role.getRoleKey());
// if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) {
// return UserConstants.ROLE_KEY_NOT_UNIQUE;
// }
// return UserConstants.ROLE_KEY_UNIQUE;
// }
//
// /**
// * 校验角色是否允许操作
// *
// * @param role 角色信息
// */
// @Override
// public void checkRoleAllowed(SysRole role) {
// if (StringUtils.isNotNull(role.getRoleId()) && role.isAdmin()) {
// throw new ServiceException("不允许操作超级管理员角色");
// }
// }
//
// /**
// * 校验角色是否有数据权限
// *
// * @param roleId 角色id
// */
// @Override
// public void checkRoleDataScope(Long roleId) {
// if (!SysUser.isAdmin(ShiroUtils.getUserId())) {
// SysRole role = new SysRole();
// role.setRoleId(roleId);
// List<SysRole> roles = SpringUtils.getAopProxy(this).selectRoleList(role);
// if (StringUtils.isEmpty(roles)) {
// throw new ServiceException("没有权限访问角色数据!");
// }
// }
// }
//
// /**
// * 通过角色ID查询角色使用数量
// *
// * @param roleId 角色ID
// * @return 结果
// */
// @Override
// public int countUserRoleByRoleId(Long roleId) {
// return userRoleMapper.countUserRoleByRoleId(roleId);
// }
//
// /**
// * 角色状态修改
// *
// * @param role 角色信息
// * @return 结果
// */
// @Override
// public int changeStatus(SysRole role) {
// return roleMapper.updateRole(role);
// }
//
// /**
// * 取消授权用户角色
// *
// * @param userRole 用户和角色关联信息
// * @return 结果
// */
// @Override
// public int deleteAuthUser(SysUserRole userRole) {
// return userRoleMapper.deleteUserRoleInfo(userRole);
// }
//
// /**
// * 批量取消授权用户角色
// *
// * @param roleId 角色ID
// * @param userIds 需要删除的用户数据ID
// * @return 结果
// */
// @Override
// public int deleteAuthUsers(Long roleId, String userIds) {
// return userRoleMapper.deleteUserRoleInfos(roleId, Convert.toLongArray(userIds));
// }
//
// /**
// * 批量选择授权用户角色
// *
// * @param roleId 角色ID
// * @param userIds 需要授权的用户数据ID
// * @return 结果
// */
// @Override
// public int insertAuthUsers(Long roleId, String userIds) {
// Long[] users = Convert.toLongArray(userIds);
// // 新增用户与角色管理
// List<SysUserRole> list = new ArrayList<SysUserRole>();
// for (Long userId : users) {
// SysUserRole ur = new SysUserRole();
// ur.setUserId(userId);
// ur.setRoleId(roleId);
// list.add(ur);
// }
// return userRoleMapper.batchUserRole(list);
// }
}

View File

@ -0,0 +1,122 @@
<?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.wuzhen.system.mapper.ActiveInfoMapper">
<resultMap type="ActiveInfo" id="ActiveInfoResult">
<id property="id" column="id" />
<result property="activeTitle" column="active_title" />
<result property="activeDesc" column="active_desc" />
<result property="activeStartDate" column="active_start_date" />
<result property="activeEndDate" column="active_end_date" />
<result property="activeType" column="active_type" />
<result property="activePic" column="active_pic" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<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" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="selectActiveVo">
select r.id, r.active_title, r.active_desc,r.active_start_date,r.active_end_date, r.active_pic, r.active_type, r.status, r.del_flag, r.create_time, r.remark
from active_info r
</sql>
<select id="selectActiveList" parameterType="ActiveInfo" resultMap="ActiveInfoResult">
<include refid="selectActiveVo"/>
where r.del_flag = '0'
<if test="id != null and id != 0">
AND r.id = #{id}
</if>
<if test="activeTitle != null and activeTitle != ''">
AND r.active_title like concat('%', #{activeTitle}, '%')
</if>
<if test="status != null and status != ''">
AND r.status = #{status}
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(r.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(r.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
<select id="selectActiveById" parameterType="Long" resultMap="ActiveInfoResult">
<include refid="selectActiveVo"/>
where r.del_flag = '0' and r.id = #{id}
</select>
<select id="checkActiveNameUnique" parameterType="String" resultMap="ActiveInfoResult">
<include refid="selectActiveVo"/>
where r.active_title=#{activeTitle} limit 1
</select>
<select id="checkActiveKeyUnique" parameterType="String" resultMap="ActiveInfoResult">
<include refid="selectActiveVo"/>
where r.id=#{id} limit 1
</select>
<delete id="deleteActiveById" parameterType="Long">
update active_info set del_flag = '2' where id = #{id}
</delete>
<delete id="deleteActiveByIds" parameterType="Long">
update active_info set del_flag = '2' where id in
<foreach collection="array" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="updateActive" parameterType="ActiveInfo">
update active_info
<set>
<if test="activeTitle != null and activeTitle != ''">active_title = #{activeTitle},</if>
<if test="activeDesc != null and activeDesc != ''">active_desc = #{activeDesc},</if>
<if test="activeStartDate != null and activeStartDate != ''">active_start_date = #{activeStartDate},</if>
<if test="activeEndDate != null and activeEndDate != ''">active_end_date = #{activeEndDate},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="activePic != null and activePic != ''">active_pic = #{activePic},</if>
<if test="activeType != null and activeType != ''">active_type = #{activeType},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where id = #{id}
</update>
<insert id="insertActive" parameterType="ActiveInfo" useGeneratedKeys="true" keyProperty="id">
insert into active_info(
<if test="activeTitle != null and activeTitle != ''">active_title,</if>
<if test="activeDesc != null and activeDesc != ''">active_desc,</if>
<if test="activeStartDate != null and activeStartDate != ''">active_start_date,</if>
<if test="activeEndDate != null and activeEndDate != ''">active_end_date,</if>
<if test="activeType != null and activeType != ''">active_type,</if>
<if test="activePic != null and activePic != ''">active_pic,</if>
<if test="status != null and status != ''">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="activeTitle != null and activeTitle !=''">#{activeTitle},</if>
<if test="activeDesc != null and activeDesc != ''">#{activeDesc},</if>
<if test="activeStartDate != null and activeStartDate != ''">#{activeStartDate},</if>
<if test="activeEndDate != null and activeEndDate != ''">#{activeEndDate},</if>
<if test="activeType != null and activeType != ''">#{activeType},</if>
<if test="activePic != null and activeType != ''">#{activePic},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
</mapper>