x1ongzhu пре 7 година
родитељ
комит
85f135b5e4

+ 6 - 3
src/main/java/com/izouma/awesomeadmin/dao/CompetitionMapper.java

@@ -1,16 +1,18 @@
 package com.izouma.awesomeadmin.dao;
 
 import java.util.*;
+
 import com.izouma.awesomeadmin.datasource.DataSource;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 import com.izouma.awesomeadmin.model.Competition;
 
 
 /**
-*  Dao接口
-*/
+ * Dao接口
+ */
 @Repository("com.zoumaframe.dao.CompetitionMapper")
-public interface CompetitionMapper{
+public interface CompetitionMapper {
     /*generatedStart*/
     int deleteByPrimaryKey(Integer id);
 
@@ -31,5 +33,6 @@ public interface CompetitionMapper{
     List<Competition> query(Competition record);
     /*generatedEnd*/
 
+    int queryUserRank(@Param("competitionId") int competitionId, @Param("userId") int userId);
 }
 

+ 27 - 1
src/main/java/com/izouma/awesomeadmin/dao/CompetitionMapper.xml

@@ -14,12 +14,13 @@
         <result column="end_time" property="endTime" jdbcType="TIMESTAMP"/>
         <result column="type" property="type" jdbcType="INTEGER"/>
         <result column="bonus" property="bonus" jdbcType="INTEGER"/>
+        <result column="status" property="status" jdbcType="INTEGER"/>
         <!--generatedEnd-->
     </resultMap>
 
     <sql id="Base_Column_List">
         <!--generatedStart-->
-        id, del_flag, update_time, update_user, create_time, create_user, competition_name, start_time, end_time, type, bonus        <!--generatedEnd-->
+        id, del_flag, update_time, update_user, create_time, create_user, competition_name, start_time, end_time, type, bonus, status        <!--generatedEnd-->
     </sql>
 
     <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
@@ -72,6 +73,9 @@
             <if test="bonus!= null">
                 bonus,
             </if>
+            <if test="status!= null">
+                status,
+            </if>
             <!--generatedEnd-->
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -109,6 +113,9 @@
             <if test="bonus != null">
                 #{bonus,jdbcType=INTEGER},
             </if>
+            <if test="status != null">
+                #{status,jdbcType=INTEGER},
+            </if>
             <!--generatedEnd-->
         </trim>
     </insert>
@@ -150,6 +157,9 @@
             <if test="bonus != null">
                 bonus= #{bonus,jdbcType=INTEGER},
             </if>
+            <if test="status != null">
+                status= #{status,jdbcType=INTEGER},
+            </if>
             <!--generatedEnd-->
         </set>
         WHERE
@@ -202,6 +212,9 @@
             <if test="record.bonus != null and !&quot;&quot;.equals(record.bonus)">
                 AND bonus = #{record.bonus}
             </if>
+            <if test="record.status != null and !&quot;&quot;.equals(record.status)">
+                AND status in (${record.status})
+            </if>
             <!--generatedEnd-->
             <if test="record.searchKey != null and !&quot;&quot;.equals(record.searchKey)">
                 <trim prefix="and (" suffix=")" prefixOverrides="OR">
@@ -209,6 +222,7 @@
                     OR competition_name LIKE concat('%',#{record.searchKey},'%')
                     OR type LIKE concat('%',#{record.searchKey},'%')
                     OR bonus LIKE concat('%',#{record.searchKey},'%')
+                    OR status LIKE concat('%',#{record.searchKey},'%')
                     <!--generatedEnd-->
                 </trim>
             </if>
@@ -295,6 +309,9 @@
             <if test="bonus != null and !&quot;&quot;.equals(bonus)">
                 AND bonus = #{bonus}
             </if>
+            <if test="status != null and !&quot;&quot;.equals(status)">
+                AND status in (${status})
+            </if>
             <!--generatedEnd-->
             <if test="searchKey != null and !&quot;&quot;.equals(searchKey)">
                 <trim prefix="and (" suffix=")" prefixOverrides="OR">
@@ -302,6 +319,7 @@
                     OR competition_name LIKE concat('%',#{searchKey},'%')
                     OR type LIKE concat('%',#{searchKey},'%')
                     OR bonus LIKE concat('%',#{searchKey},'%')
+                    OR status LIKE concat('%',#{searchKey},'%')
                     <!--generatedEnd-->
                 </trim>
             </if>
@@ -384,6 +402,9 @@
             <if test="bonus != null and !&quot;&quot;.equals(bonus)">
                 AND bonus = #{bonus}
             </if>
+            <if test="status != null and !&quot;&quot;.equals(status)">
+                AND status in (${status})
+            </if>
             <!--generatedEnd-->
         </where>
         LIMIT 1
@@ -411,5 +432,10 @@
         </where>
         ORDER BY id DESC
     </select>
+
+    <select id="queryUserRank" resultType="integer">
+
+    </select>
+
 </mapper>
 

+ 8 - 0
src/main/java/com/izouma/awesomeadmin/model/Competition.java

@@ -20,6 +20,7 @@ public class Competition{
     private Date endTime;
     private Integer type;
     private Integer bonus;
+    private Integer status;
 
     private String idStr;
 
@@ -114,6 +115,13 @@ public class Competition{
     public void setBonus(Integer bonus){
         this.bonus = bonus;
     }
+    public Integer getStatus(){
+        return this.status;
+    }
+
+    public void setStatus(Integer status){
+        this.status = status;
+    }
 
     public String getSearchKey() {
         return searchKey;

+ 2 - 0
src/main/java/com/izouma/awesomeadmin/service/CompetitionService.java

@@ -24,5 +24,7 @@ public interface CompetitionService{
 
     boolean updateCompetition(Competition record);
     /*generatedEnd*/
+
+    int getUserRank(Integer competitionId,Integer userId);
 }
 

+ 5 - 4
src/main/java/com/izouma/awesomeadmin/web/CompetitionController.java

@@ -100,10 +100,10 @@ public class CompetitionController {
         String sheetName = "competition";
         String titleName = "赛事数据表";
         String fileName = "赛事表";
-        int columnNumber = 11;
-        int[] columnWidth = { 20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20 };
-        String[] columnName = {  "" ,   "删除标识" ,   "更新时间" ,   "更新人" ,   "创建时间" ,   "创建人" ,   "赛事名称" ,   "开始时间" ,   "结束时间" ,   "赛事类型" ,   "奖金"  };
-        String[][] dataList = new String[competitions.size()][11];
+        int columnNumber = 12;
+        int[] columnWidth = { 20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20 };
+        String[] columnName = {  "" ,   "删除标识" ,   "更新时间" ,   "更新人" ,   "创建时间" ,   "创建人" ,   "赛事名称" ,   "开始时间" ,   "结束时间" ,   "赛事类型" ,   "奖金" ,   "状态"  };
+        String[][] dataList = new String[competitions.size()][12];
 
         for (int i = 0; i < competitions.size(); i++) {
                         dataList[i][0] = String.valueOf(competitions.get(i).getId());
@@ -117,6 +117,7 @@ public class CompetitionController {
                         dataList[i][8] = String.valueOf(competitions.get(i).getEndTime());
                         dataList[i][9] = String.valueOf(competitions.get(i).getType());
                         dataList[i][10] = String.valueOf(competitions.get(i).getBonus());
+                        dataList[i][11] = String.valueOf(competitions.get(i).getStatus());
                     }
 
         ExportExcelUtil.ExportWithResponse(sheetName, titleName, fileName,

+ 28 - 3
src/main/vue/src/pages/Competition.vue

@@ -46,6 +46,18 @@
             <el-form-item prop="bonus" label="奖金">
                 <el-input v-model="formData.bonus" :disabled="'bonus'==subColumn"></el-input>
             </el-form-item>
+            <el-form-item prop="status" label="状态">
+                <template>
+                    <el-select v-model="formData.status" clearable  placeholder="请选择" :disabled="'status'==subColumn">
+                        <el-option
+                            v-for="item in statusOptions"
+                            :key="item.value"
+                            :label="item.label"
+                            :value="item.value">
+                        </el-option>
+                    </el-select>
+                </template>
+            </el-form-item>
             <el-form-item>
                 <el-button @click="onSave" :loading="$store.state.fetchingData" type="primary">保存</el-button>
                 <el-button @click="onDelete" v-if="formData.id" type="danger">删除</el-button>
@@ -77,7 +89,7 @@
                     }
                 }).then(res => {
                     if (res.success) {
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    this.formData = res.data;
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                this.formData = res.data;
                         if (this.$route.query.column) {
                             this.formData[this.subColumn] = this.subValue;
                         }
@@ -89,15 +101,28 @@
                 }
             }
 
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        },
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    },
         data() {
             return {
                 saving: false,
                 formData: {
                 },
                 rules: {
+                    competitionName: [
+                        {required: true, message: '请输入 赛事名称', trigger: 'blur'},
+                    ],
+                    type: [
+                        {required: true, message: '请输入 赛事类型', trigger: 'blur'},
+                    ],
+                    bonus: [
+                        {required: true, message: '请输入 奖金', trigger: 'blur'},
+                    ],
+                    status: [
+                        {required: true, message: '请输入 状态', trigger: 'blur'},
+                    ],
                 },
             typeOptions:[{label:'普通',value:1},{label:'高级',value:2}],
+            statusOptions:[{label:'进行中',value:1},{label:'已结束',value:2}],
                 subColumn: '',
                 subValue: '',
             }
@@ -153,7 +178,7 @@
             submit() {
                 let data = {...this.formData};
 
-                                                                                                                                                                                                
+                                                                                                                                                                                                                
                 this.$http.post({
                     url: this.formData.id ? '/competition/update' : '/competition/save',
                     data: data

+ 16 - 0
src/main/vue/src/pages/Competitions.vue

@@ -80,6 +80,13 @@
                                 label="奖金"
                                 min-width="100">
                         </el-table-column>
+                                                                
+                                            <el-table-column
+                                v-if="isColumnShow('status')"
+                                prop="status"
+                                label="状态"
+                                min-width="100">
+                        </el-table-column>
                                                             <el-table-column
                     label="操作"
                     align="center"
@@ -247,6 +254,11 @@
                                 label: '奖金',
                                 value: 'bonus',
                                 show: true
+                            },
+                                                                                                {
+                                label: '状态',
+                                value: 'status',
+                                show: true
                             },
                                                             ],
                 multipleMode: false,
@@ -275,6 +287,10 @@
                                                                                                 {
                                 label: '奖金',
                                 value: 'bonus'
+                            },
+                                                                                                {
+                                label: '状态',
+                                value: 'status'
                             },
                                                             ],
                 advancedQuerySearchKey: '',