记得上下班打卡 | git大法好,push需谨慎

Commit 293461cf authored by wangyifan's avatar wangyifan

草莓护照-徽章

parent 8cc3adee
...@@ -27,14 +27,14 @@ CREATE TABLE `adam_caomei_badge` ( ...@@ -27,14 +27,14 @@ CREATE TABLE `adam_caomei_badge` (
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '徽章名称', `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '徽章名称',
`icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '徽章图标 (Emoji字符或图片URL)', `icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '徽章图标 (Emoji字符或图片URL)',
`type` tinyint(4) NOT NULL COMMENT '徽章类型: 1-护照纪念徽章, 2-演出纪念徽章, 3-特殊徽章', `type` tinyint(4) NOT NULL COMMENT '徽章类型: 1-护照纪念徽章, 2-演出纪念徽章, 3-特殊徽章',
`ticket_times_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '关联演出场次ID (仅演出纪念徽章必填,其他类型为空)', `performance_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '关联演出ID (仅演出纪念徽章必填,其他类型为空)',
`display_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '上架状态: 0-下架(默认), 1-已发布', `display_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '上架状态: 0-下架(默认), 1-已发布',
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`mid`), PRIMARY KEY (`mid`),
KEY `idx_badge_id` (`badge_id`), KEY `idx_badge_id` (`badge_id`),
KEY `idx_type_status` (`type`,`display_status`), KEY `idx_type_status` (`type`,`display_status`),
KEY `idx_ticket_times_id` (`ticket_times_id`) KEY `idx_performance_id` (`performance_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='草莓护照-徽章配置表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='草莓护照-徽章配置表';
-- ---------------------------- -- ----------------------------
...@@ -59,7 +59,7 @@ CREATE TABLE `adam_caomei_badge_apply_record` ( ...@@ -59,7 +59,7 @@ CREATE TABLE `adam_caomei_badge_apply_record` (
`apply_record_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '补签id', `apply_record_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '补签id',
`user_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '用户id', `user_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '用户id',
`badge_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '申请补签的徽章ID', `badge_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '申请补签的徽章ID',
`ticket_times_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '关联的演出场次ID (冗余字段,便于后台筛选)', `performance_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '关联的演出ID (冗余字段,便于后台筛选)',
`proof_image_url` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '订单截图/凭证图片URL', `proof_image_url` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '订单截图/凭证图片URL',
`audit_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '审核状态: 0-待审核, 1-已通过, 2-已驳回', `audit_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '审核状态: 0-待审核, 1-已通过, 2-已驳回',
`reject_reason` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '驳回理由 (驳回时必填,用户端可见)', `reject_reason` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '驳回理由 (驳回时必填,用户端可见)',
......
package com.liquidnet.service.adam.dto.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 草莓护照-徽章管理参数
*/
@Data
@ApiModel("草莓护照-徽章管理参数")
public class AdamCaomeiBadgeParam {
@ApiModelProperty(value = "主键ID")
private Long mid;
@ApiModelProperty(value = "徽章ID")
private String badgeId;
@ApiModelProperty(value = "徽章名称")
private String name;
@ApiModelProperty(value = "徽章图标 (Emoji字符或图片URL)")
private String icon;
@ApiModelProperty(value = "徽章类型: 1-护照纪念徽章, 2-演出纪念徽章, 3-特殊徽章")
private Integer type;
@ApiModelProperty(value = "关联演出ID (仅演出纪念徽章必填,其他类型为空)")
private String performanceId;
@ApiModelProperty(value = "上架状态: 0-下架(默认), 1-已发布")
private Integer displayStatus;
}
package com.liquidnet.service.adam.dto.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 草莓护照-徽章搜索参数
*/
@Data
@ApiModel("草莓护照-徽章搜索参数")
public class AdamCaomeiBadgeSearchParam {
@ApiModelProperty(value = "徽章名称")
private String name;
@ApiModelProperty(value = "徽章类型: 1-护照纪念徽章, 2-演出纪念徽章, 3-特殊徽章")
private Integer type;
@ApiModelProperty(value = "上架状态: 0-下架(默认), 1-已发布")
private Integer displayStatus;
@ApiModelProperty(value = "当前页码")
private Integer pageNum = 1;
@ApiModelProperty(value = "每页数量")
private Integer pageSize = 10;
}
package com.liquidnet.service.adam.dto.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* 草莓护照-徽章视图对象
*/
@Data
@ApiModel("草莓护照-徽章视图对象")
public class AdamCaomeiBadgeVo {
@ApiModelProperty(value = "主键ID")
private Long mid;
@ApiModelProperty(value = "徽章ID")
private String badgeId;
@ApiModelProperty(value = "徽章名称")
private String name;
@ApiModelProperty(value = "徽章图标 (Emoji字符或图片URL)")
private String icon;
@ApiModelProperty(value = "徽章类型: 1-护照纪念徽章, 2-演出纪念徽章, 3-特殊徽章")
private Integer type;
@ApiModelProperty(value = "关联演出ID")
private String performanceId;
@ApiModelProperty(value = "上架状态: 0-下架(默认), 1-已发布")
private Integer displayStatus;
@ApiModelProperty(value = "添加时间")
private Date createdAt;
@ApiModelProperty(value = "更新时间")
private Date updatedAt;
@ApiModelProperty(value = "领取人数")
private Integer claimedCount;
}
package com.liquidnet.client.admin.web.controller.zhengzai.adam;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.liquidnet.client.admin.common.annotation.Log;
import com.liquidnet.client.admin.common.core.controller.BaseController;
import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import com.liquidnet.client.admin.common.core.page.TableDataInfo;
import com.liquidnet.client.admin.common.enums.BusinessType;
import com.liquidnet.client.admin.zhengzai.adam.service.IAdamCaomeiBadgeAdminService;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.adam.dto.param.AdamCaomeiBadgeParam;
import com.liquidnet.service.adam.dto.param.AdamCaomeiBadgeSearchParam;
import com.liquidnet.service.adam.dto.vo.AdamCaomeiBadgeVo;
import com.liquidnet.service.adam.entity.AdamCaomeiBadge;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@Api(tags = "草莓护照-徽章管理")
@Controller
@RequestMapping("adam/caomei/badge")
public class AdamCaomeiBadgeController extends BaseController {
private final String prefix = "zhengzai/adam/caomei/badge";
@Autowired
private IAdamCaomeiBadgeAdminService adamCaomeiBadgeAdminService;
@RequiresPermissions("adam:caomei:badge:view")
@GetMapping()
public String view() {
return prefix + "/badge_list";
}
@RequiresPermissions("adam:caomei:badge:list")
@PostMapping("list")
@ResponseBody
public TableDataInfo list(AdamCaomeiBadgeSearchParam param) {
startPage();
LambdaQueryWrapper<AdamCaomeiBadge> queryWrapper = Wrappers.lambdaQuery(AdamCaomeiBadge.class);
if (StringUtils.isNotBlank(param.getName())) {
queryWrapper.like(AdamCaomeiBadge::getName, param.getName());
}
if (param.getType() != null) {
queryWrapper.eq(AdamCaomeiBadge::getType, param.getType());
}
if (param.getDisplayStatus() != null) {
queryWrapper.eq(AdamCaomeiBadge::getDisplayStatus, param.getDisplayStatus());
}
queryWrapper.orderByDesc(AdamCaomeiBadge::getCreatedAt);
List<AdamCaomeiBadge> list = adamCaomeiBadgeAdminService.list(queryWrapper);
List<AdamCaomeiBadgeVo> voList = list.stream().map(item -> {
AdamCaomeiBadgeVo vo = new AdamCaomeiBadgeVo();
BeanUtils.copyProperties(item, vo);
vo.setClaimedCount(0); // TODO: 关联 user_badge 表统计领取人数
return vo;
}).collect(Collectors.toList());
return getDataTable(voList);
}
@GetMapping("add")
public String add() {
return prefix + "/badge_add";
}
@RequiresPermissions("adam:caomei:badge:add")
@Log(title = "草莓护照-徽章管理:新增", businessType = BusinessType.INSERT)
@PostMapping("add")
@ResponseBody
public AjaxResult addSave(AdamCaomeiBadgeParam param) {
AdamCaomeiBadge badge = new AdamCaomeiBadge();
BeanUtils.copyProperties(param, badge);
badge.setBadgeId(IDGenerator.nextSnowId());
badge.setDisplayStatus(0); // 默认下架
badge.setCreatedAt(new Date());
badge.setUpdatedAt(new Date());
// 演出类型校验
if (badge.getType() != null && badge.getType() == 2) {
if (StringUtils.isBlank(badge.getPerformanceId())) {
return error("演出纪念徽章必须关联演出场次");
}
} else {
badge.setPerformanceId("");
}
return toAjax(adamCaomeiBadgeAdminService.save(badge));
}
@RequiresPermissions("adam:caomei:badge:view")
@GetMapping("detail/{mid}")
public String detail(@PathVariable("mid") Long mid, ModelMap mmap) {
AdamCaomeiBadge badge = adamCaomeiBadgeAdminService.getById(mid);
mmap.put("badge", badge);
return prefix + "/badge_detail";
}
@GetMapping("edit/{mid}")
public String edit(@PathVariable("mid") Long mid, ModelMap mmap) {
AdamCaomeiBadge badge = adamCaomeiBadgeAdminService.getById(mid);
mmap.put("badge", badge);
return prefix + "/badge_edit";
}
@RequiresPermissions("adam:caomei:badge:edit")
@Log(title = "草莓护照-徽章管理:修改", businessType = BusinessType.UPDATE)
@PostMapping("edit")
@ResponseBody
public AjaxResult editSave(AdamCaomeiBadgeParam param) {
AdamCaomeiBadge oldBadge = adamCaomeiBadgeAdminService.getById(param.getMid());
if (oldBadge == null || oldBadge.getDisplayStatus() == 1) {
return error("已发布的徽章不允许修改");
}
AdamCaomeiBadge badge = new AdamCaomeiBadge();
BeanUtils.copyProperties(param, badge);
badge.setUpdatedAt(new java.util.Date());
if (badge.getType() != null && badge.getType() != 2) {
badge.setPerformanceId("");
}
return toAjax(adamCaomeiBadgeAdminService.updateById(badge));
}
@RequiresPermissions("adam:caomei:badge:edit")
@Log(title = "草莓护照-徽章管理:状态修改", businessType = BusinessType.UPDATE)
@PostMapping("changeStatus")
@ResponseBody
public AjaxResult changeStatus(AdamCaomeiBadgeParam param) {
AdamCaomeiBadge updateBadge = new AdamCaomeiBadge();
updateBadge.setMid(param.getMid());
updateBadge.setDisplayStatus(param.getDisplayStatus());
updateBadge.setUpdatedAt(new java.util.Date());
return toAjax(adamCaomeiBadgeAdminService.updateById(updateBadge));
}
}
<!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-badge-add">
<div class="form-group">
<label class="col-sm-3 control-label is-required">徽章名称:</label>
<div class="col-sm-8">
<input name="name" 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="icon" class="form-control" type="text" placeholder="输入Emoji或图片URL" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">徽章类型:</label>
<div class="col-sm-8">
<select name="type" class="form-control m-b" required onchange="typeChange(this.value)">
<option value="">请选择</option>
<option value="1">护照纪念徽章</option>
<option value="2">演出纪念徽章</option>
<option value="3">特殊徽章</option>
</select>
</div>
</div>
<div class="form-group" id="ticketTimesDiv" style="display: none;">
<label class="col-sm-3 control-label is-required">关联演出场次:</label>
<div class="col-sm-8">
<input name="performanceId" id="performanceId" class="form-control" type="text" placeholder="请输入演出场次ID">
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 演出纪念徽章必填</span>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script type="text/javascript">
var prefix = ctx + "adam/caomei/badge";
function typeChange(val) {
if (val == 2) {
$("#ticketTimesDiv").show();
$("#performanceId").prop("required", true);
} else {
$("#ticketTimesDiv").hide();
$("#performanceId").prop("required", false);
$("#performanceId").val("");
}
}
$("#form-badge-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-badge-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-badge-detail" th:object="${badge}">
<div class="form-group">
<label class="col-sm-3 control-label">徽章名称:</label>
<div class="col-sm-8">
<div class="form-control-static" th:text="*{name}"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">徽章图标:</label>
<div class="col-sm-8">
<div class="form-control-static">
<span th:if="*{icon != null and (!icon.startsWith('http') and !icon.startsWith('/'))}" style="font-size: 24px;" th:text="*{icon}"></span>
<img th:if="*{icon != null and (icon.startsWith('http') or icon.startsWith('/'))}" th:src="*{icon}" style="max-height: 30px;"/>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">徽章类型:</label>
<div class="col-sm-8">
<div class="form-control-static" th:if="*{type == 1}">护照纪念徽章</div>
<div class="form-control-static" th:if="*{type == 2}">演出纪念徽章</div>
<div class="form-control-static" th:if="*{type == 3}">特殊徽章</div>
</div>
</div>
<div class="form-group" th:style="${badge.type == 2 ? 'display:block;' : 'display:none;'}">
<label class="col-sm-3 control-label">关联演出场次:</label>
<div class="col-sm-8">
<div class="form-control-static" th:text="*{performanceId}"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">状态:</label>
<div class="col-sm-8">
<div class="form-control-static" th:if="*{displayStatus == 1}">已发布</div>
<div class="form-control-static" th:if="*{displayStatus == 0}">下架</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script type="text/javascript">
$(function() {
// 隐藏底部的确认按钮,只保留关闭按钮
var index = parent.layer.getFrameIndex(window.name);
if (index) {
var $layero = parent.$("#layui-layer" + index);
$layero.find(".layui-layer-btn0").hide(); // 隐藏确认按钮
}
});
</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-badge-edit" th:object="${badge}">
<input name="mid" th:field="*{mid}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label is-required">徽章名称:</label>
<div class="col-sm-8">
<input name="name" th:field="*{name}" 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="icon" th:field="*{icon}" class="form-control" type="text" placeholder="输入Emoji或图片URL" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">徽章类型:</label>
<div class="col-sm-8">
<select name="type" class="form-control m-b" th:field="*{type}" required onchange="typeChange(this.value)">
<option value="">请选择</option>
<option value="1">护照纪念徽章</option>
<option value="2">演出纪念徽章</option>
<option value="3">特殊徽章</option>
</select>
</div>
</div>
<div class="form-group" id="ticketTimesDiv" th:style="${badge.type == 2 ? 'display:block;' : 'display:none;'}">
<label class="col-sm-3 control-label is-required">关联演出场次:</label>
<div class="col-sm-8">
<input name="performanceId" id="performanceId" th:field="*{performanceId}" class="form-control" type="text" placeholder="请输入演出场次ID" th:required="${badge.type == 2}">
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 演出纪念徽章必填</span>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script type="text/javascript">
var prefix = ctx + "adam/caomei/badge";
function typeChange(val) {
if (val == 2) {
$("#ticketTimesDiv").show();
$("#performanceId").prop("required", true);
} else {
$("#ticketTimesDiv").hide();
$("#performanceId").prop("required", false);
$("#performanceId").val("");
}
}
$("#form-badge-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-badge-edit').serialize());
}
}
</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>
徽章名称:<input type="text" name="name"/>
</li>
<li>
徽章类型:<select name="type" th:with="type=${@dict.getType('adam_caomei_badge_type')}">
<option value="">所有</option>
<option value="1">护照纪念徽章</option>
<option value="2">演出纪念徽章</option>
<option value="3">特殊徽章</option>
</select>
</li>
<li>
状态:<select name="displayStatus">
<option value="">所有</option>
<option value="0">下架</option>
<option value="1">已发布</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="adam:caomei:badge:add">
<i class="fa fa-plus"></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('adam:caomei:badge:edit')}]];
var prefix = ctx + "adam/caomei/badge";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
modalName: "草莓护照徽章",
columns: [{
checkbox: true
},
{
field: 'mid',
title: '主键ID',
visible: false
},
{
field: 'badgeId',
title: '徽章ID'
},
{
field: 'icon',
title: '图标',
formatter: function(value, row, index) {
// 如果是图片链接,可以用 $.table.imageView(value)
// 如果是 emoji,直接返回
if(value && (value.startsWith('http') || value.startsWith('/'))) {
return $.table.imageView(value);
}
return '<span style="font-size: 24px;">' + value + '</span>';
}
},
{
field: 'name',
title: '名称'
},
{
field: 'type',
title: '类型',
formatter: function(value, row, index) {
if (value == 1) return '<span class="badge badge-info">护照纪念</span>';
if (value == 2) return '<span class="badge badge-primary">演出纪念</span>';
if (value == 3) return '<span class="badge badge-warning">特殊徽章</span>';
return value;
}
},
{
field: 'createdAt',
title: '添加时间',
formatter: function(value, row, index) {
if (!value) return '-';
return value.length >= 10 ? value.substring(0, 10) : value;
}
},
{
field: 'claimedCount',
title: '领取人数'
},
{
field: 'displayStatus',
title: '状态',
align: 'center',
formatter: function (value, row, index) {
if (value == 1) {
return '<span class="badge badge-primary" style="background-color: #e6f3ff; color: #1890ff; padding: 5px 10px; border-radius: 4px;">已发布</span>';
} else {
return '<span class="badge badge-default" style="background-color: #f5f5f5; color: #999; padding: 5px 10px; border-radius: 4px;">下架</span>';
}
}
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
// 详情按钮
actions.push('<a class="btn btn-info btn-sm" style="margin-right: 5px;" href="javascript:void(0)" onclick="detail(\'' + row.mid + '\')"><i class="fa fa-eye"></i>详情</a>');
// 仅下架状态可修改(编辑)
if (row.displayStatus == 0) {
actions.push('<a class="btn btn-success btn-sm ' + editFlag + '" style="margin-right: 5px;" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.mid + '\')"><i class="fa fa-edit"></i>编辑</a>');
}
// 下架/发布按钮
if (row.displayStatus == 1) {
actions.push('<a class="btn btn-danger btn-sm" style="margin-right: 5px;" href="javascript:void(0)" onclick="disable(\'' + row.mid + '\')"><i class="fa fa-arrow-down"></i>下架</a>');
} else {
actions.push('<a class="btn btn-primary btn-sm" style="margin-right: 5px;" href="javascript:void(0)" onclick="enable(\'' + row.mid + '\')"><i class="fa fa-upload"></i>发布</a>');
}
// 领取用户按钮
actions.push('<a class="btn btn-warning btn-sm" href="javascript:void(0)" onclick="claimedUsers(\'' + row.mid + '\')"><i class="fa fa-users"></i>领取用户</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
/* 徽章下架 */
function disable(mid) {
$.modal.confirm("确认要下架该徽章吗?", function() {
$.operate.post(prefix + "/changeStatus", { "mid": mid, "displayStatus": 0 });
});
}
/* 徽章发布 */
function enable(mid) {
$.modal.confirm("确认要发布该徽章吗?", function() {
$.operate.post(prefix + "/changeStatus", { "mid": mid, "displayStatus": 1 });
});
}
/* 详情 */
function detail(mid) {
$.modal.open("徽章详情", prefix + "/detail/" + mid);
}
/* 领取用户 */
function claimedUsers(mid) {
$.modal.msgWarning("领取用户列表功能开发中...");
}
</script>
</body>
</html>
\ No newline at end of file
package com.liquidnet.client.admin.zhengzai.adam.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.liquidnet.service.adam.entity.AdamCaomeiBadge;
/**
* 草莓护照-徽章管理
*/
public interface IAdamCaomeiBadgeAdminService extends IService<AdamCaomeiBadge> {
}
package com.liquidnet.client.admin.zhengzai.adam.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.client.admin.zhengzai.adam.service.IAdamCaomeiBadgeAdminService;
import com.liquidnet.service.adam.entity.AdamCaomeiBadge;
import com.liquidnet.service.adam.mapper.AdamCaomeiBadgeMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class AdamCaomeiBadgeAdminServiceImpl extends ServiceImpl<AdamCaomeiBadgeMapper, AdamCaomeiBadge> implements IAdamCaomeiBadgeAdminService {
}
package com.liquidnet.service.adam.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 草莓护照-徽章配置表
*/
@Data
@TableName("adam_caomei_badge")
public class AdamCaomeiBadge implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键ID
*/
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
/**
* 徽章ID
*/
private String badgeId;
/**
* 徽章名称
*/
private String name;
/**
* 徽章图标 (Emoji字符或图片URL)
*/
private String icon;
/**
* 徽章类型: 1-护照纪念徽章, 2-演出纪念徽章, 3-特殊徽章
*/
private Integer type;
/**
* 关联演出ID (仅演出纪念徽章必填,其他类型为空)
*/
private String performanceId;
/**
* 上架状态: 0-下架(默认), 1-已发布
*/
private Integer displayStatus;
/**
* 添加时间
*/
private Date createdAt;
/**
* 更新时间
*/
private Date updatedAt;
}
package com.liquidnet.service.adam.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.liquidnet.service.adam.entity.AdamCaomeiBadge;
public interface AdamCaomeiBadgeMapper extends BaseMapper<AdamCaomeiBadge> {
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment