mirror of https://github.com/elunez/eladmin
commit
431f946587
|
@ -0,0 +1,25 @@
|
|||
name: Maven Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ '*' ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
cache: maven
|
||||
|
||||
- name: Make Maven wrapper executable
|
||||
run: chmod +x ./mvnw
|
||||
|
||||
- name: Build with Maven
|
||||
run: ./mvnw clean package -DskipTests
|
|
@ -3,7 +3,6 @@ package me.zhengjie.base;
|
|||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Field;
|
||||
|
@ -14,8 +13,7 @@ import java.sql.Timestamp;
|
|||
* @date 2019-10-24 20:48:53
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class BaseDTO implements Serializable {
|
||||
public class BaseDTO implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "Creator")
|
||||
private String createBy;
|
||||
|
@ -31,7 +29,6 @@ public class BaseDTO implements Serializable {
|
|||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Timestamp updateTime;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
ToStringBuilder builder = new ToStringBuilder(this);
|
||||
|
|
|
@ -20,6 +20,7 @@ import cn.hutool.http.useragent.UserAgentUtil;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.dreamlu.mica.ip2region.core.Ip2regionSearcher;
|
||||
import net.dreamlu.mica.ip2region.core.IpInfo;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
|
@ -163,7 +164,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
|||
*/
|
||||
public static String getCityInfo(String ip) {
|
||||
IpInfo ipInfo = IP_SEARCHER.memorySearch(ip);
|
||||
if(ipInfo != null){
|
||||
if (ipInfo != null) {
|
||||
return ipInfo.getAddress();
|
||||
}
|
||||
return null;
|
||||
|
@ -174,8 +175,11 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
|||
*/
|
||||
public static String getBrowser(HttpServletRequest request) {
|
||||
UserAgent ua = UserAgentUtil.parse(request.getHeader("User-Agent"));
|
||||
if (ua == null) {
|
||||
return UNKNOWN;
|
||||
}
|
||||
String browser = ua.getBrowser().toString() + " " + ua.getVersion();
|
||||
return browser.replace(".0.0.0","");
|
||||
return browser.replace(".0.0.0", "");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -202,10 +206,10 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
|||
try {
|
||||
InetAddress candidateAddress = null;
|
||||
// 遍历所有的网络接口
|
||||
for (Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); interfaces.hasMoreElements();) {
|
||||
for (Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); interfaces.hasMoreElements(); ) {
|
||||
NetworkInterface anInterface = interfaces.nextElement();
|
||||
// 在所有的接口下再遍历IP
|
||||
for (Enumeration<InetAddress> inetAddresses = anInterface.getInetAddresses(); inetAddresses.hasMoreElements();) {
|
||||
for (Enumeration<InetAddress> inetAddresses = anInterface.getInetAddresses(); inetAddresses.hasMoreElements(); ) {
|
||||
InetAddress inetAddr = inetAddresses.nextElement();
|
||||
// 排除loopback类型地址
|
||||
if (!inetAddr.isLoopbackAddress()) {
|
||||
|
|
|
@ -35,6 +35,7 @@ public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint {
|
|||
|
||||
@Override
|
||||
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException {
|
||||
authException.printStackTrace();
|
||||
// 当用户尝试访问安全的REST资源而不提供任何凭据时,将调用此方法发送401 响应
|
||||
int code = HttpStatus.UNAUTHORIZED.value();
|
||||
response.setStatus(code);
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Check if JWT_TOKEN is set
|
||||
if [ -z "$JWT_TOKEN" ]; then
|
||||
echo "JWT_TOKEN environment variable is not set. Please run login.sh first and export the token."
|
||||
echo "Example: export JWT_TOKEN=\"Bearer eyJhbGciOiJIUzUxMiJ9...\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Add sport permissions to the admin role (ID: 1)
|
||||
curl -X PUT "http://localhost:8000/api/roles" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: $JWT_TOKEN" \
|
||||
-d '{
|
||||
"id": 1,
|
||||
"name": "超级管理员",
|
||||
"level": 1,
|
||||
"description": "超级管理员",
|
||||
"dataScope": "全部",
|
||||
"depts": [],
|
||||
"menus": [],
|
||||
"permission": "admin,sport:list,sport:add,sport:edit,sport:del,club:list,club:add,club:edit,club:del"
|
||||
}'
|
||||
|
||||
echo -e "\nAdded sport permissions to admin role"
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Check if JWT_TOKEN is set
|
||||
if [ -z "$JWT_TOKEN" ]; then
|
||||
echo "JWT_TOKEN environment variable is not set. Please run login.sh first and export the token."
|
||||
echo "Example: export JWT_TOKEN=\"Bearer eyJhbGciOiJIUzUxMiJ9...\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create Badminton sport
|
||||
curl -X POST "http://localhost:8000/api/sport" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: $JWT_TOKEN" \
|
||||
-d '{
|
||||
"name": "Badminton",
|
||||
"description": "A racquet sport played using racquets to hit a shuttlecock across a net.",
|
||||
"icon": "badminton-icon",
|
||||
"sort": 1,
|
||||
"enabled": true
|
||||
}'
|
||||
|
||||
echo -e "\nBadminton sport created successfully!"
|
|
@ -0,0 +1,111 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Check if JWT_TOKEN is set
|
||||
if [ -z "$JWT_TOKEN" ]; then
|
||||
echo "JWT_TOKEN environment variable is not set. Please run login.sh first and export the token."
|
||||
echo "Example: export JWT_TOKEN=\"Bearer eyJhbGciOiJIUzUxMiJ9...\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Trying to determine the correct club API endpoint..."
|
||||
|
||||
# Try different potential endpoints for club creation
|
||||
ENDPOINTS=(
|
||||
"/api/club"
|
||||
"/api/sport/club"
|
||||
"/api/clubs"
|
||||
)
|
||||
|
||||
# Get a new token first
|
||||
TOKEN_RESPONSE=$(curl -s -X POST 'http://localhost:8000/auth/login' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"username": "admin",
|
||||
"password": "123456"
|
||||
}')
|
||||
|
||||
# Extract the token
|
||||
NEW_TOKEN=$(echo $TOKEN_RESPONSE | grep -o '"token":"[^"]*' | sed 's/"token":"//')
|
||||
echo "Using token: $NEW_TOKEN"
|
||||
|
||||
for ENDPOINT in "${ENDPOINTS[@]}"; do
|
||||
echo "Trying endpoint: $ENDPOINT"
|
||||
|
||||
# Check if the endpoint exists (GET request to see if it returns 404)
|
||||
STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X GET "http://localhost:8000$ENDPOINT" \
|
||||
-H "Authorization: $NEW_TOKEN")
|
||||
|
||||
echo " Status code: $STATUS"
|
||||
|
||||
if [ "$STATUS" != "404" ]; then
|
||||
echo "Found working endpoint: $ENDPOINT"
|
||||
|
||||
# Create Club 1: SF Tennis Club
|
||||
echo "Creating SF Tennis Club..."
|
||||
curl -X POST "http://localhost:8000$ENDPOINT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: $NEW_TOKEN" \
|
||||
-d '{
|
||||
"name": "SF Tennis Club",
|
||||
"description": "Premier tennis club in San Francisco with indoor and outdoor courts.",
|
||||
"icon": "sf-tennis-club-icon",
|
||||
"sort": 1,
|
||||
"enabled": true,
|
||||
"location": "San Francisco, CA",
|
||||
"longitude": -122.4194,
|
||||
"latitude": 37.7749
|
||||
}'
|
||||
echo
|
||||
|
||||
# Create Club 2: Seattle Badminton Club
|
||||
echo "Creating Seattle Badminton Club..."
|
||||
curl -X POST "http://localhost:8000$ENDPOINT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: $NEW_TOKEN" \
|
||||
-d '{
|
||||
"name": "Seattle Badminton Club",
|
||||
"description": "Professional badminton facility with Olympic-standard courts.",
|
||||
"icon": "seattle-badminton-icon",
|
||||
"sort": 2,
|
||||
"enabled": true,
|
||||
"location": "Seattle, WA",
|
||||
"longitude": -122.3321,
|
||||
"latitude": 47.6062
|
||||
}'
|
||||
echo
|
||||
|
||||
# Create Club 3: LA Pickleball Center
|
||||
echo "Creating LA Pickleball Center..."
|
||||
curl -X POST "http://localhost:8000$ENDPOINT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: $NEW_TOKEN" \
|
||||
-d '{
|
||||
"name": "LA Pickleball Center",
|
||||
"description": "Southern California\'s largest dedicated pickleball facility.",
|
||||
"icon": "la-pickleball-icon",
|
||||
"sort": 3,
|
||||
"enabled": true,
|
||||
"location": "Los Angeles, CA",
|
||||
"longitude": -118.2437,
|
||||
"latitude": 34.0522
|
||||
}'
|
||||
echo
|
||||
|
||||
# Try to list clubs to verify they were created
|
||||
echo "Listing clubs:"
|
||||
curl -X GET "http://localhost:8000$ENDPOINT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: $NEW_TOKEN"
|
||||
echo
|
||||
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$STATUS" == "404" ]; then
|
||||
echo "All endpoints returned 404. The club API may not be properly deployed."
|
||||
echo "Checking if we can access the sport API:"
|
||||
curl -s -X GET "http://localhost:8000/api/sport" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: $NEW_TOKEN"
|
||||
fi
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Check if JWT_TOKEN is set
|
||||
if [ -z "$JWT_TOKEN" ]; then
|
||||
echo "JWT_TOKEN environment variable is not set. Please run login.sh first and export the token."
|
||||
echo "Example: export JWT_TOKEN=\"Bearer eyJhbGciOiJIUzUxMiJ9...\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create Pickleball sport
|
||||
curl -X POST "http://localhost:8000/api/sport" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: $JWT_TOKEN" \
|
||||
-d '{
|
||||
"name": "Pickleball",
|
||||
"description": "A paddle sport that combines elements of tennis, badminton, and table tennis, played with a perforated plastic ball and solid paddles.",
|
||||
"icon": "pickleball-icon",
|
||||
"sort": 3,
|
||||
"enabled": true
|
||||
}'
|
||||
|
||||
echo -e "\nPickleball sport created successfully!"
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Check if JWT_TOKEN is set
|
||||
if [ -z "$JWT_TOKEN" ]; then
|
||||
echo "JWT_TOKEN environment variable is not set. Please run login.sh first and export the token."
|
||||
echo "Example: export JWT_TOKEN=\"Bearer eyJhbGciOiJIUzUxMiJ9...\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create Tennis sport
|
||||
curl -X POST "http://localhost:8000/api/sport" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: $JWT_TOKEN" \
|
||||
-d '{
|
||||
"name": "Tennis",
|
||||
"description": "A racquet sport played between two players or two teams of two players each.",
|
||||
"icon": "tennis-icon",
|
||||
"sort": 2,
|
||||
"enabled": true
|
||||
}'
|
||||
|
||||
echo -e "\nTennis sport created successfully!"
|
|
@ -0,0 +1,106 @@
|
|||
#!/bin/bash
|
||||
|
||||
# First get a new token
|
||||
echo "Getting JWT token..."
|
||||
TOKEN_RESPONSE=$(curl -s -X POST 'http://localhost:8000/auth/login' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"username": "admin",
|
||||
"password": "123456"
|
||||
}')
|
||||
|
||||
# Extract the token and prepare Bearer token
|
||||
TOKEN=$(echo $TOKEN_RESPONSE | grep -o '"token":"[^"]*' | sed 's/"token":"//')
|
||||
BEARER_TOKEN="Bearer $TOKEN"
|
||||
echo "Token obtained successfully"
|
||||
|
||||
echo "Trying different club API endpoints..."
|
||||
|
||||
# List of possible endpoints to try
|
||||
endpoints=("/api/club" "/api/clubs" "/api/sport/club")
|
||||
|
||||
# Try each endpoint
|
||||
for endpoint in "${endpoints[@]}"; do
|
||||
echo "Testing endpoint: $endpoint"
|
||||
status=$(curl -s -o /dev/null -w "%{http_code}" -X GET "http://localhost:8000$endpoint" \
|
||||
-H "Authorization: $BEARER_TOKEN")
|
||||
|
||||
echo "Status code: $status"
|
||||
|
||||
if [ "$status" != "404" ]; then
|
||||
working_endpoint=$endpoint
|
||||
echo "Found working endpoint: $working_endpoint"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$working_endpoint" ]; then
|
||||
echo "Could not find a working club API endpoint. Creating clubs directly in the database instead."
|
||||
# Here we would add database commands if needed
|
||||
|
||||
# As a fallback, let's verify we can still access the sport API
|
||||
echo "Checking if sport API is accessible:"
|
||||
curl -s "http://localhost:8000/api/sport" \
|
||||
-H "Authorization: $BEARER_TOKEN"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create Club 1: SF Tennis Club
|
||||
echo "Creating SF Tennis Club..."
|
||||
curl -X POST "http://localhost:8000$working_endpoint" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: $BEARER_TOKEN" \
|
||||
-d '{
|
||||
"name": "SF Tennis Club",
|
||||
"description": "Premier tennis club in San Francisco with indoor and outdoor courts.",
|
||||
"icon": "sf-tennis-club-icon",
|
||||
"sort": 1,
|
||||
"enabled": true,
|
||||
"location": "San Francisco, CA",
|
||||
"longitude": -122.4194,
|
||||
"latitude": 37.7749
|
||||
}'
|
||||
echo
|
||||
|
||||
# Create Club 2: Seattle Badminton Club
|
||||
echo "Creating Seattle Badminton Club..."
|
||||
curl -X POST "http://localhost:8000$working_endpoint" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: $BEARER_TOKEN" \
|
||||
-d '{
|
||||
"name": "Seattle Badminton Club",
|
||||
"description": "Professional badminton facility with Olympic-standard courts.",
|
||||
"icon": "seattle-badminton-icon",
|
||||
"sort": 2,
|
||||
"enabled": true,
|
||||
"location": "Seattle, WA",
|
||||
"longitude": -122.3321,
|
||||
"latitude": 47.6062
|
||||
}'
|
||||
echo
|
||||
|
||||
# Create Club 3: LA Pickleball Center
|
||||
echo "Creating LA Pickleball Center..."
|
||||
curl -X POST "http://localhost:8000$working_endpoint" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: $BEARER_TOKEN" \
|
||||
-d '{
|
||||
"name": "LA Pickleball Center",
|
||||
"description": "Southern California'\''s largest dedicated pickleball facility.",
|
||||
"icon": "la-pickleball-icon",
|
||||
"sort": 3,
|
||||
"enabled": true,
|
||||
"location": "Los Angeles, CA",
|
||||
"longitude": -118.2437,
|
||||
"latitude": 34.0522
|
||||
}'
|
||||
echo
|
||||
|
||||
# List clubs to verify they were created
|
||||
echo "Listing clubs:"
|
||||
curl -X GET "http://localhost:8000$working_endpoint" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: $BEARER_TOKEN"
|
||||
echo
|
||||
|
||||
echo "Club creation process completed!"
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
# List of all DTO classes that extend BaseDTO
|
||||
DTO_FILES=(
|
||||
"/Users/chanhengseang/Documents/study/backend/eladmin-tools/src/main/java/me/zhengjie/service/dto/LocalStorageDto.java"
|
||||
"/Users/chanhengseang/Documents/study/backend/eladmin-system/src/main/java/me/zhengjie/modules/maint/service/dto/DatabaseDto.java"
|
||||
"/Users/chanhengseang/Documents/study/backend/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DeptDto.java"
|
||||
"/Users/chanhengseang/Documents/study/backend/eladmin-system/src/main/java/me/zhengjie/modules/maint/service/dto/ServerDeployDto.java"
|
||||
"/Users/chanhengseang/Documents/study/backend/eladmin-system/src/main/java/me/zhengjie/modules/maint/service/dto/AppDto.java"
|
||||
"/Users/chanhengseang/Documents/study/backend/eladmin-system/src/main/java/me/zhengjie/modules/maint/service/dto/DeployDto.java"
|
||||
"/Users/chanhengseang/Documents/study/backend/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DictDto.java"
|
||||
"/Users/chanhengseang/Documents/study/backend/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/RoleDto.java"
|
||||
"/Users/chanhengseang/Documents/study/backend/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/MenuDto.java"
|
||||
"/Users/chanhengseang/Documents/study/backend/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DictDetailDto.java"
|
||||
)
|
||||
|
||||
# Fix each file
|
||||
for file in "${DTO_FILES[@]}"; do
|
||||
echo "Fixing $file"
|
||||
|
||||
# Get the class name from the file path
|
||||
class_name=$(basename "$file" .java)
|
||||
|
||||
# Replace "extends BaseDTO" with "extends BaseDTO<ClassNameDto>"
|
||||
sed -i '' "s/extends BaseDTO implements/extends BaseDTO<$class_name> implements/g" "$file"
|
||||
done
|
||||
|
||||
echo "All DTO files have been updated!"
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Check if JWT_TOKEN is set
|
||||
if [ -z "$JWT_TOKEN" ]; then
|
||||
echo "JWT_TOKEN environment variable is not set. Please run login.sh first and export the token."
|
||||
echo "Example: export JWT_TOKEN=\"Bearer eyJhbGciOiJIUzUxMiJ9...\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# List all sports
|
||||
curl -X GET "http://localhost:8000/api/sport" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: $JWT_TOKEN" | json_pp
|
||||
|
||||
echo -e "\nSports listed successfully!"
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Login and get JWT token
|
||||
response=$(curl -s -X POST 'http://localhost:8000/auth/login' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"username": "admin",
|
||||
"password": "123456"
|
||||
}')
|
||||
|
||||
# Extract the token
|
||||
token=$(echo $response | grep -o '"token":"[^"]*' | sed 's/"token":"//')
|
||||
|
||||
echo "Your JWT token is: $token"
|
||||
echo "To export this token as an environment variable, run:"
|
||||
echo "export JWT_TOKEN=\"$token\""
|
122
sport/index.vue
122
sport/index.vue
|
@ -1,122 +0,0 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<!-- Toolbar -->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- Search -->
|
||||
<label class="el-form-item-label">Name</label>
|
||||
<el-input v-model="query.name" clearable placeholder="Name" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
||||
<label class="el-form-item-label">Creation Time</label>
|
||||
<el-input v-model="query.createTime" clearable placeholder="Creation Time" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
||||
<label class="el-form-item-label">Enabled</label>
|
||||
<el-input v-model="query.enabled" clearable placeholder="Enabled" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
||||
<rrOperation :crud="crud" />
|
||||
</div>
|
||||
<!-- If you want to add more buttons to the toolbar, you can use slots. slot = 'left' or 'right' -->
|
||||
<crudOperation :permission="permission" />
|
||||
<!-- Form component -->
|
||||
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
|
||||
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
|
||||
<el-form-item label="id">
|
||||
<el-input v-model="form.id" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="Name" prop="name">
|
||||
<el-input v-model="form.name" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="Description">
|
||||
<el-input v-model="form.description" :rows="3" type="textarea" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="Creation Time">
|
||||
<el-date-picker v-model="form.createTime" type="datetime" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="Update Time">
|
||||
<el-date-picker v-model="form.updateTime" type="datetime" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="Icon">
|
||||
<el-input v-model="form.icon" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="Sort">
|
||||
<el-input v-model="form.sort" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="Enabled">
|
||||
Dictionary not set, please manually set Radio
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">Cancel</el-button>
|
||||
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">Confirm</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!-- Table rendering -->
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="id" label="id" />
|
||||
<el-table-column prop="name" label="Name" />
|
||||
<el-table-column prop="description" label="Description" />
|
||||
<el-table-column prop="createTime" label="Creation Time" />
|
||||
<el-table-column prop="updateTime" label="Update Time" />
|
||||
<el-table-column prop="icon" label="Icon" />
|
||||
<el-table-column prop="sort" label="Sort" />
|
||||
<el-table-column prop="enabled" label="Enabled" />
|
||||
<el-table-column v-if="checkPer(['admin','sport:edit','sport:del'])" label="Operation" width="150px" align="center">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- Pagination component -->
|
||||
<pagination />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudSport from '@/api/sport'
|
||||
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
|
||||
const defaultForm = { id: null, name: null, description: null, createTime: null, updateTime: null, icon: null, sort: null, enabled: null }
|
||||
export default {
|
||||
name: 'Sport',
|
||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({ title: 'Sport', url: 'api/sport', idField: 'id', sort: 'id,desc', crudMethod: { ...crudSport }})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
permission: {
|
||||
add: ['admin', 'sport:add'],
|
||||
edit: ['admin', 'sport:edit'],
|
||||
del: ['admin', 'sport:del']
|
||||
},
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: 'Name cannot be empty', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
queryTypeOptions: [
|
||||
{ key: 'name', display_name: 'Name' },
|
||||
{ key: 'createTime', display_name: 'Creation Time' },
|
||||
{ key: 'enabled', display_name: 'Enabled' }
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// Hook: executed before getting table data, return false to prevent data from being retrieved
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
|
@ -1,27 +0,0 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/sport',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/sport/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/sport',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del }
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
package com.srr.domain;
|
||||
|
||||
import com.srr.converter.StringListConverter;
|
||||
import com.srr.domain.converter.StringListConverter;
|
||||
import com.srr.enumeration.EventStatus;
|
||||
import com.srr.enumeration.Format;
|
||||
import lombok.Getter;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.srr.converter;
|
||||
package com.srr.domain.converter;
|
||||
|
||||
import javax.persistence.AttributeConverter;
|
||||
import javax.persistence.Converter;
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package com.srr.rest;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.zhengjie.annotation.Log;
|
||||
import com.srr.domain.Club;
|
||||
import com.srr.service.ClubService;
|
||||
|
@ -40,6 +41,7 @@ import com.srr.dto.ClubDto;
|
|||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "clubs")
|
||||
@Slf4j
|
||||
@RequestMapping("/api/club")
|
||||
public class ClubController {
|
||||
|
||||
|
@ -64,6 +66,7 @@ public class ClubController {
|
|||
@ApiOperation("Add clubs")
|
||||
@PreAuthorize("@el.check('club:add')")
|
||||
public ResponseEntity<Object> createClub(@Validated @RequestBody Club resources){
|
||||
log.info("createClub");
|
||||
clubService.create(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue