Bläddra i källkod

赛事增加创建时间, 修改时间, 发布时间, 创建人id, 创建人姓名, 修改人id, 修改人姓名, 发布人id, 发布人姓名
前端修改结束时间为必填项

Memory_LG 5 månader sedan
förälder
incheckning
77f84f4869

+ 1 - 1
qmjszx-business/src/main/java/beilv/competition/controller/CompetitionController.java

@@ -1,4 +1,4 @@
-package beilv.competition.controller;
+package beilv.web.controller.competition;
 
 import java.util.List;
 

+ 1 - 1
qmjszx-business/src/main/java/beilv/stadium/controller/StadiumController.java

@@ -1,4 +1,4 @@
-package beilv.stadium.controller;
+package beilv.web.controller.stadium;
 
 import beilv.common.core.controller.BaseController;
 import beilv.common.core.domain.AjaxResult;

+ 2 - 2
qmjszx-admin/src/main/resources/templates/competition/add.html

@@ -62,12 +62,12 @@
                                placeholder="年-月-日 时:分" required>
                     </div>
                 </div>
-                <label class="col-sm-2 control-label">赛事结束时间:</label>
+                <label class="col-sm-2 control-label is-required">赛事结束时间:</label>
                 <div class="col-sm-4">
                     <div class="input-group date">
                         <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                         <input name="applyEndTime" type="text" class="form-control" id="applyEndTime"
-                               placeholder="年-月-日 时:分">
+                               placeholder="年-月-日 时:分" required>
                     </div>
                 </div>
             </div>

+ 2 - 2
qmjszx-admin/src/main/resources/templates/competition/edit.html

@@ -56,11 +56,11 @@
                             <input name="applyStartTime" th:value="${#dates.format(competition.applyStartTime, 'yyyy-MM-dd HH:mm')}" type="text" class="form-control" id="applyStartTime" placeholder="年-月-日 时:分" required>
                         </div>
                     </div>
-                    <label class="col-sm-2 control-label">赛事结束时间:</label>
+                    <label class="col-sm-2 control-label is-required">赛事结束时间:</label>
                     <div class="col-sm-4">
                         <div class="input-group date">
                             <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
-                            <input name="applyEndTime" th:value="${#dates.format(competition.applyEndTime, 'yyyy-MM-dd HH:mm')}" type="text" class="form-control" id="applyEndTime" placeholder="年-月-日 时:分">
+                            <input name="applyEndTime" th:value="${#dates.format(competition.applyEndTime, 'yyyy-MM-dd HH:mm')}" type="text" class="form-control" id="applyEndTime" placeholder="年-月-日 时:分" required>
                         </div>
                     </div>
                 </div>

+ 27 - 119
qmjszx-business/src/main/java/beilv/competition/domain/Competition.java

@@ -3,6 +3,7 @@ package beilv.competition.domain;
 import java.util.Date;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.*;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import beilv.common.annotation.Excel;
@@ -14,6 +15,11 @@ import beilv.common.core.domain.BaseEntity;
  * @author LG
  * @date 2024-12-31
  */
+@Setter
+@Getter
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
 public class Competition extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
@@ -108,125 +114,27 @@ public class Competition extends BaseEntity {
     @Excel(name = "赛事状态")
     private String competitionState;
 
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    public Integer getId() {
-        return id;
-    }
-
-    public void setCompetitionTitle(String competitionTitle) {
-        this.competitionTitle = competitionTitle;
-    }
-
-    public String getCompetitionTitle() {
-        return competitionTitle;
-    }
-
-    public void setCompetitionType(String competitionType) {
-        this.competitionType = competitionType;
-    }
-
-    public String getCompetitionType() {
-        return competitionType;
-    }
-
-    public void setPersonMax(Integer personMax) {
-        this.personMax = personMax;
-    }
-
-    public Integer getPersonMax() {
-        return personMax;
-    }
-
-    public void setTeamMax(Integer teamMax) {
-        this.teamMax = teamMax;
-    }
-
-    public Integer getTeamMax() {
-        return teamMax;
-    }
-
-    public void setCompetitionPlace(String competitionPlace) {
-        this.competitionPlace = competitionPlace;
-    }
-
-    public String getCompetitionPlace() {
-        return competitionPlace;
-    }
-
-    public void setApplyStartTime(Date applyStartTime) {
-        this.applyStartTime = applyStartTime;
-    }
-
-    public Date getApplyStartTime() {
-        return applyStartTime;
-    }
-
-    public void setApplyEndTime(Date applyEndTime) {
-        this.applyEndTime = applyEndTime;
-    }
-
-    public Date getApplyEndTime() {
-        return applyEndTime;
-    }
-
-    public void setApplyBeforeTime(Double applyBeforeTime) {
-        this.applyBeforeTime = applyBeforeTime;
-    }
-
-    public Double getApplyBeforeTime() {
-        return applyBeforeTime;
-    }
-
-    public void setCompetitionMaximum(Integer competitionMaximum) {
-        this.competitionMaximum = competitionMaximum;
-    }
-
-    public Integer getCompetitionMaximum() {
-        return competitionMaximum;
-    }
-
-    public void setCompetitionExpense(Double competitionExpense) {
-        this.competitionExpense = competitionExpense;
-    }
-
-    public Double getCompetitionExpense() {
-        return competitionExpense;
-    }
-
-    public void setViewingTicket(Double viewingTicket) {
-        this.viewingTicket = viewingTicket;
-    }
-
-    public Double getViewingTicket() {
-        return viewingTicket;
-    }
-
-    public void setCompetitionDetails(String competitionDetails) {
-        this.competitionDetails = competitionDetails;
-    }
-
-    public String getCompetitionDetails() {
-        return competitionDetails;
-    }
-
-    public void setRegistrationNotes(String registrationNotes) {
-        this.registrationNotes = registrationNotes;
-    }
-
-    public String getRegistrationNotes() {
-        return registrationNotes;
-    }
-
-    public void setCompetitionState(String competitionState) {
-        this.competitionState = competitionState;
-    }
-
-    public String getCompetitionState() {
-        return competitionState;
-    }
+    /**
+     * 创建人姓名
+     */
+    private String createName;
+    /**
+     * 更新人姓名
+     */
+    private String updateName;
+    /**
+     * 发布人姓名
+     */
+    private String publishName;
+    /**
+     * 发布人id
+     */
+    private String publishBy;
+    /**
+     * 发布时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date publishTime;
 
     @Override
     public String toString() {

+ 14 - 10
qmjszx-business/src/main/java/beilv/competition/service/impl/CompetitionServiceImpl.java

@@ -1,13 +1,15 @@
 package beilv.competition.service.impl;
 
-import java.util.List;
-
+import beilv.common.core.text.Convert;
+import beilv.common.utils.ShiroUtils;
 import beilv.competition.domain.Competition;
 import beilv.competition.mapper.CompetitionMapper;
 import beilv.competition.service.ICompetitionService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import beilv.common.core.text.Convert;
+
+import java.util.Date;
+import java.util.List;
 
 /**
  * 赛事发布Service业务层处理
@@ -55,10 +57,10 @@ public class CompetitionServiceImpl implements ICompetitionService {
      */
     @Override
     public int insertCompetition(Competition competition) {
+        competition.setCreateTime(new Date());
+        competition.setCreateBy(ShiroUtils.getSysUser().getUserId().toString());
+        competition.setCreateName(ShiroUtils.getSysUser().getUserName());
         competition.setCompetitionState(DAI_FA_BU);
-        /*int a = competition.getPersonMax() != null ? competition.getPersonMax() : 0;
-        int b = competition.getTeamMax() != null ? competition.getTeamMax() : 0;
-        competition.setCompetitionMaximum(a * b);*/
         return competitionMapper.insertCompetition(competition);
     }
 
@@ -70,6 +72,9 @@ public class CompetitionServiceImpl implements ICompetitionService {
      */
     @Override
     public int updateCompetition(Competition competition) {
+        competition.setUpdateTime(new Date());
+        competition.setUpdateBy(ShiroUtils.getSysUser().getUserId().toString());
+        competition.setUpdateName(ShiroUtils.getSysUser().getUserName());
         return competitionMapper.updateCompetition(competition);
     }
 
@@ -98,6 +103,9 @@ public class CompetitionServiceImpl implements ICompetitionService {
     @Override
     public int publishCompetitionById(String id) {
         Competition competition = new Competition();
+        competition.setPublishTime(new Date());
+        competition.setPublishBy(ShiroUtils.getSysUser().getUserId().toString());
+        competition.setPublishName(ShiroUtils.getSysUser().getUserName());
         competition.setId(Integer.valueOf(id));
         competition.setCompetitionState(BAO_MING_ZHONG);
         return competitionMapper.publishCompetition(competition);
@@ -105,10 +113,6 @@ public class CompetitionServiceImpl implements ICompetitionService {
 
     @Override
     public int closeCompetitionById(String id) {
-        //查询已经缴费的用户
-
-        //调用退费接口
-
         //修改赛事状态
         Competition competition = new Competition();
         competition.setId(Integer.valueOf(id));

+ 47 - 7
qmjszx-business/src/main/resources/mapper/competition/CompetitionMapper.xml

@@ -20,10 +20,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="registrationNotes"    column="registration_notes"    />
         <result property="competitionState"    column="competition_state"    />
         <result property="viewingTicket"    column="viewing_ticket"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createName"    column="create_name"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateName"    column="update_name"    />
+        <result property="publishTime"    column="publish_time"    />
+        <result property="publishBy"    column="publish_by"    />
+        <result property="publishName"    column="publish_name"    />
     </resultMap>
 
     <sql id="selectCompetitionVo">
-        select id, competition_title, competition_type, person_max, team_max, competition_place, apply_start_time, apply_end_time, apply_before_time, competition_maximum, competition_expense, viewing_ticket, competition_details, registration_notes, competition_state from competition
+        select id, competition_title, competition_type, person_max, team_max,
+               competition_place, apply_start_time, apply_end_time, apply_before_time,
+               competition_maximum, competition_expense, viewing_ticket,
+               competition_details, registration_notes, competition_state,
+               create_time, create_by, create_name, update_time, update_by, update_name, publish_time, publish_by, publish_name
+        from beilv_competition
     </sql>
 
     <select id="selectCompetitionList" parameterType="Competition" resultMap="CompetitionResult">
@@ -35,6 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="applyStartTime != null "> and apply_start_time = #{applyStartTime}</if>
             <if test="competitionState != null  and competitionState != ''"> and competition_state = #{competitionState}</if>
         </where>
+        order by create_time desc
     </select>
     
     <select id="selectCompetitionById" parameterType="Integer" resultMap="CompetitionResult">
@@ -43,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <insert id="insertCompetition" parameterType="Competition" useGeneratedKeys="true" keyProperty="id">
-        insert into competition
+        insert into beilv_competition
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="competitionTitle != null">competition_title,</if>
             <if test="competitionType != null">competition_type,</if>
@@ -59,6 +74,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="competitionDetails != null">competition_details,</if>
             <if test="registrationNotes != null">registration_notes,</if>
             <if test="competitionState != null">competition_state,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="publishTime != null">publish_time,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="publishBy != null">publish_by,</if>
+            <if test="createName != null">create_name,</if>
+            <if test="updateName != null">update_name,</if>
+            <if test="publishName != null">publish_name,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="competitionTitle != null">#{competitionTitle},</if>
@@ -75,11 +99,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="competitionDetails != null">#{competitionDetails},</if>
             <if test="registrationNotes != null">#{registrationNotes},</if>
             <if test="competitionState != null">#{competitionState},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="publishTime != null">#{publishTime},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="publishBy != null">#{publishBy},</if>
+            <if test="createName != null">#{createName},</if>
+            <if test="updateName != null">#{updateName},</if>
+            <if test="publishName != null">#{publishName},</if>
          </trim>
     </insert>
 
     <update id="updateCompetition" parameterType="Competition">
-        update competition
+        update beilv_competition
         <trim prefix="SET" suffixOverrides=",">
             <if test="competitionTitle != null">competition_title = #{competitionTitle},</if>
             <if test="competitionType != null">competition_type = #{competitionType},</if>
@@ -95,28 +128,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="competitionDetails != null">competition_details = #{competitionDetails},</if>
             <if test="registrationNotes != null">registration_notes = #{registrationNotes},</if>
             <if test="competitionState != null">competition_state = #{competitionState},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateName != null">update_name = #{updateName},</if>
         </trim>
         where id = #{id}
     </update>
 
     <delete id="deleteCompetitionById" parameterType="Integer">
-        delete from competition where id = #{id}
+        delete from beilv_competition where id = #{id}
     </delete>
 
     <delete id="deleteCompetitionByIds" parameterType="String">
-        delete from competition where id in 
+        delete from beilv_competition where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>
     </delete>
 
     <update id="publishCompetition" parameterType="Competition">
-        update competition set competition_state = #{competitionState}
+        update beilv_competition set
+        competition_state = #{competitionState},
+        publish_time = #{publishTime},
+        publish_by = #{publishBy},
+        publish_name = #{publishName}
         where id = #{id}
     </update>
 
     <select id="getCompetitionList" resultMap="CompetitionResult">
-        select * from competition where competition_state = 'competiton_state_2'
+        select * from beilv_competition where competition_state = 'competiton_state_2'
     </select>
 
 </mapper>

+ 5 - 5
qmjszx-business/src/main/resources/mapper/stadium/StadiumMapper.xml

@@ -21,7 +21,7 @@
 
 
     <insert id="toBeStadium" parameterType="stadium">
-        insert into book_a_race
+        insert into beilv_book_a_race
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="userId != null">user_id,</if>
             <if test="contactPerple != null">contact_perple,</if>
@@ -51,7 +51,7 @@
     </insert>
 
     <update id="cancellStadium" parameterType="stadium">
-        update book_a_race
+        update beilv_book_a_race
         <trim prefix="SET" suffixOverrides=",">
             <if test="paymentTime != null">#{paymentTime},</if>
             <if test="cancellationTime != null">#{cancellationTime},</if>
@@ -65,7 +65,7 @@
         select
             user_id, contact_perple, contact_number, registration_time, payment_time,
             cancellation_time, refund_time, payment_status, order_id, competition_id, order_type
-        from book_a_race
+        from beilv_book_a_race
         <where>
             <if test="userId != null and userId != ''">
                 and user_id = #{userId}
@@ -86,8 +86,8 @@
                 ELSE false
                 END AS is_available
         FROM
-                (SELECT team_max FROM competition WHERE id = #{competitionId}) a,
-                (SELECT COUNT(id) AS isPay FROM book_a_race WHERE competition_id = #{competitionId} AND (payment_status = 'payment_status_have_paid' OR payment_status = 'payment_status_to_be_paid	')  and order_type = '1') b;
+                (SELECT team_max FROM beilv_competition WHERE id = #{competitionId}) a,
+                (SELECT COUNT(id) AS isPay FROM beilv_book_a_race WHERE competition_id = #{competitionId} AND (payment_status = 'payment_status_have_paid' OR payment_status = 'payment_status_to_be_paid	')  and order_type = '1') b;
     </select>
 
 </mapper>