瀏覽代碼

增加报名方法

周箭河 6 年之前
父節點
當前提交
8ed795a55f

+ 46 - 33
src/main/java/com/ym/mec/collectfee/controller/OrchestraController.java

@@ -1,33 +1,46 @@
-//package com.ym.mec.collectfee.controller;
-//
-//import com.ym.mec.collectfee.common.web.BaseController;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.validation.annotation.Validated;
-//import org.springframework.web.bind.annotation.*;
-//
-///**
-// * 乐团
-// */
-//@RestController
-//@RequestMapping("orchestra")
-//public class OrchestraController extends BaseController {
-//
-//    @Autowired
-//    ApplyInfoService applyInfoService;
-//
-//    /**
-//     * 乐团报名
-//     */
-//    @PostMapping("/apply")
-//    public void apply(@ModelAttribute @Validated ApplyInfo applyInfo) throws Exception {
-//        long id = applyInfoService.insert(applyInfo);
-//    }
-//
-//
-//    @GetMapping("/applyinfo")
-//    public void applyInfo(int id){
-//        applyInfoService
-//    }
-//
-//
-//}
+package com.ym.mec.collectfee.controller;
+
+import com.ym.mec.collectfee.common.web.BaseController;
+import com.ym.mec.collectfee.entity.ApplyInfo;
+import com.ym.mec.collectfee.service.ApplyInfoService;
+
+import org.apache.ibatis.annotations.Param;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 乐团
+ */
+@RestController
+@RequestMapping("orchestra")
+public class OrchestraController extends BaseController {
+
+    @Autowired
+    private ApplyInfoService applyInfoService;
+
+    /**
+     * 乐团报名
+     */
+    @PostMapping("/apply")
+    public Object apply(@ModelAttribute @Validated ApplyInfo applyInfo) throws Exception {
+        System.out.println(applyInfo);
+        return applyInfoService.insert(applyInfo);
+    }
+
+
+    /**
+     * 根据手机获取报名信息
+     * @param mobile
+     * @return
+     */
+    @RequestMapping("/applyinfo")
+    public ApplyInfo applyInfo(@Param("patriarchPhone") String mobile) {
+        System.out.println(mobile);
+        ApplyInfo applyInfoByMobile = applyInfoService.getApplyInfoByMobile(mobile);
+        System.out.println(applyInfoByMobile);
+        return applyInfoByMobile;
+    }
+
+
+}

+ 3 - 1
src/main/java/com/ym/mec/collectfee/dao/ApplyInfoDao.java

@@ -2,10 +2,12 @@ package com.ym.mec.collectfee.dao;
 
 import com.ym.mec.collectfee.common.dao.BaseDAO;
 import com.ym.mec.collectfee.entity.ApplyInfo;
+import com.ym.mec.collectfee.entity.Order;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Component;
 
 @Component
 public interface ApplyInfoDao extends BaseDAO<Integer, ApplyInfo> {
 
-	
+    ApplyInfo getApplyInfoByMobile(@Param("patriarchPhone") String patriarchPhone);
 }

+ 2 - 0
src/main/java/com/ym/mec/collectfee/entity/ApplyInfo.java

@@ -1,6 +1,7 @@
 package com.ym.mec.collectfee.entity;
 
 import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.springframework.format.annotation.DateTimeFormat;
 
 /**
  * 对应数据库表(apply_info):
@@ -17,6 +18,7 @@ public class ApplyInfo {
 	private Integer sex;
 	
 	/** 生日 */
+	@DateTimeFormat(pattern="yyyy-MM-dd")
 	private java.util.Date birthday;
 	
 	/** 城市 */

+ 8 - 0
src/main/java/com/ym/mec/collectfee/service/ApplyInfoService.java

@@ -2,7 +2,15 @@ package com.ym.mec.collectfee.service;
 
 import com.ym.mec.collectfee.common.service.BaseService;
 import com.ym.mec.collectfee.entity.ApplyInfo;
+import com.ym.mec.collectfee.entity.Order;
 
 public interface ApplyInfoService extends BaseService<Integer, ApplyInfo> {
 
+    /**
+     * 根据手机号查询报名信息
+     * @param patriarchPhone 手机号
+     * @return
+     */
+    ApplyInfo getApplyInfoByMobile(String patriarchPhone);
+
 }

+ 6 - 0
src/main/java/com/ym/mec/collectfee/service/impl/ApplyInfoServiceImpl.java

@@ -4,6 +4,7 @@ import com.ym.mec.collectfee.common.dao.BaseDAO;
 import com.ym.mec.collectfee.common.service.impl.BaseServiceImpl;
 import com.ym.mec.collectfee.dao.ApplyInfoDao;
 import com.ym.mec.collectfee.entity.ApplyInfo;
+import com.ym.mec.collectfee.entity.Order;
 import com.ym.mec.collectfee.service.ApplyInfoService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -18,5 +19,10 @@ public class ApplyInfoServiceImpl extends BaseServiceImpl<Integer, ApplyInfo> im
 	public BaseDAO<Integer, ApplyInfo> getDAO() {
 		return applyInfoDao;
 	}
+
+	@Override
+	public ApplyInfo getApplyInfoByMobile(String patriarchPhone){
+		return applyInfoDao.getApplyInfoByMobile(patriarchPhone);
+	}
 	
 }

+ 5 - 0
src/main/resources/config/mybatis/ApplyInfoMapper.xml

@@ -64,4 +64,9 @@
 	<select id="queryCount" resultType="int">
 		SELECT COUNT(*) FROM apply_info
 	</select>
+
+	<!-- 根据手机号查询报名信息 -->
+	<select id="getApplyInfoByMobile" resultMap="ApplyInfo" >
+		SELECT * FROM apply_info WHERE patriarch_phone_ = #{patriarchPhone}
+	</select>
 </mapper>