Browse Source

悦姐ELearning BUG修改

huan.wang@yueguanjia.com 5 năm trước cách đây
mục cha
commit
e7cdd63557

+ 1 - 0
src/main/java/com/ygj/yuemum/controller/college/CollegeCurriculumCoreController.java

@@ -64,6 +64,7 @@ public class CollegeCurriculumCoreController {
         CollegeCurriculumQuery collegeCurriculumQuery = new CollegeCurriculumQuery();
         collegeCurriculumQuery.setId(id);
         collegeCurriculumQuery.setOpenid(openid);
+
         LinkedHashMap<String, Object> orderTemps = collegeCurriculumCoreService.queryUserLearningCoreDetail(collegeCurriculumQuery);
         String jso = JSONObject.toJSONString(orderTemps, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue);
         return jso;

+ 9 - 0
src/main/java/com/ygj/yuemum/controller/elearning/ELearningController.java

@@ -3,9 +3,12 @@ package com.ygj.yuemum.controller.elearning;
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.ygj.yuemum.domain.college.CollegeBooking;
 import com.ygj.yuemum.domain.college.CollegeTest;
+import com.ygj.yuemum.domain.elearning.ELearningBooking;
 import com.ygj.yuemum.service.eLearning.ELearningService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
@@ -19,6 +22,7 @@ public class ELearningController {
     @Autowired
     private ELearningService eLearningService;
 
+
     @PostMapping("/eLearning/index")
     public String index(@RequestParam("attendant_id") String attendant_id) {
         LinkedHashMap<String, Object> orderTemps = eLearningService.index(attendant_id);
@@ -64,4 +68,9 @@ public class ELearningController {
         return eLearningService.courseworkUpdate(attendant_id,coursework_id,rate);
     }
 
+    @PostMapping("/eLearning/courseworkBooking")
+    public int courseworkBooking(@ModelAttribute ELearningBooking eLearningBooking) {
+        return eLearningService.courseworkBooking(eLearningBooking);
+    }
+
 }

+ 1 - 0
src/main/java/com/ygj/yuemum/dao/college/CollegeBookingDao.java

@@ -19,6 +19,7 @@ public interface CollegeBookingDao {
     int updateByPrimaryKeySelective(CollegeBooking record);
 
     CollegeBooking checkBooking(CollegeBooking collegeBooking);
+    CollegeBooking checkELearningBooking(CollegeBooking collegeBooking);
 
     int bookingCancel (CollegeBooking collegeBooking);
 

+ 2 - 0
src/main/java/com/ygj/yuemum/dao/college/CollegeCurriculumCoreDao.java

@@ -31,7 +31,9 @@ public interface CollegeCurriculumCoreDao {
 
     int updatePositive(String c_code);
     int updateCoreCount(String c_code);
+    int updateELearningCount(String c_code);
 
     CollegeCurriculumCore queryCoreByCode(String c_code);
+    CollegeCurriculumCore queryELeaningByCode(String c_code);
 
 }

+ 2 - 0
src/main/java/com/ygj/yuemum/dao/college/CollegeLearningDetailDao.java

@@ -22,6 +22,8 @@ public interface CollegeLearningDetailDao {
 
     CollegeLearningDetail checkCorePositive(CollegeLearningDetail collegeLearningDetail);
 
+    CollegeLearningDetail checkELearning(CollegeLearningDetail collegeLearningDetail);
+
     CollegeLearningDetail checkCoreLearningRate(CollegeLearningDetail collegeLearningDetail);
 
     int updateLearningRate (CollegeLearningDetail collegeLearningDetail);

+ 36 - 0
src/main/java/com/ygj/yuemum/domain/college/CollegeBooking.java

@@ -10,6 +10,42 @@ public class CollegeBooking {
     private String college_code;
     private Integer b_count;
     private Integer b_time;
+    private String  sys_type;
+    private Integer gender;
+    private Float applause_rate;
+    private Integer orders;
+
+    public String getSys_type() {
+        return sys_type;
+    }
+
+    public void setSys_type(String sys_type) {
+        this.sys_type = sys_type;
+    }
+
+    public Integer getGender() {
+        return gender;
+    }
+
+    public void setGender(Integer gender) {
+        this.gender = gender;
+    }
+
+    public Float getApplause_rate() {
+        return applause_rate;
+    }
+
+    public void setApplause_rate(Float applause_rate) {
+        this.applause_rate = applause_rate;
+    }
+
+    public Integer getOrders() {
+        return orders;
+    }
+
+    public void setOrders(Integer orders) {
+        this.orders = orders;
+    }
 
     public String getName() {
         return name;

+ 50 - 0
src/main/java/com/ygj/yuemum/domain/elearning/ELearningBooking.java

@@ -0,0 +1,50 @@
+package com.ygj.yuemum.domain.elearning;
+
+public class ELearningBooking {
+    private String attendant_id;
+    private String coursework_id;
+    private Integer gender;
+    private Float applause_rate;
+    private Integer orders;
+
+
+    public String getAttendant_id() {
+        return attendant_id;
+    }
+
+    public void setAttendant_id(String attendant_id) {
+        this.attendant_id = attendant_id;
+    }
+
+    public String getCoursework_id() {
+        return coursework_id;
+    }
+
+    public void setCoursework_id(String coursework_id) {
+        this.coursework_id = coursework_id;
+    }
+
+    public Integer getGender() {
+        return gender;
+    }
+
+    public void setGender(Integer gender) {
+        this.gender = gender;
+    }
+
+    public Float getApplause_rate() {
+        return applause_rate;
+    }
+
+    public void setApplause_rate(Float applause_rate) {
+        this.applause_rate = applause_rate;
+    }
+
+    public Integer getOrders() {
+        return orders;
+    }
+
+    public void setOrders(Integer orders) {
+        this.orders = orders;
+    }
+}

+ 32 - 0
src/main/java/com/ygj/yuemum/service/college/CollegeBookingService.java

@@ -30,10 +30,41 @@ public class CollegeBookingService {
         return collegeBookingDao.checkBooking(collegeBooking);
     }
 
+    public CollegeBooking checkELearningBooking(CollegeBooking collegeBooking){
+        return collegeBookingDao.checkELearningBooking(collegeBooking);
+    }
+
     public CollegeBooking getCollegeBooking(Integer id) {
         return collegeBookingDao.selectByPrimaryKey(id);
     }
 
+
+    public int addELearningBooking(CollegeBooking collegeBooking) {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        CollegeBooking collegeBooking1 = collegeBookingDao.checkBooking(collegeBooking);
+        if( collegeBooking1 != null) {
+            collegeBooking.setId(collegeBooking1.getId());
+            int tt = collegeBookingDao.updateByPrimaryKeySelective(collegeBooking);
+            return  tt;
+        } else {
+            try {
+                collegeBooking.setDate(sdf.format(new Date()));
+                CollegeLearningDetail collegeLearningDetail = new CollegeLearningDetail();
+                collegeLearningDetail.setOpen_id(collegeBooking.getOpenid());
+                collegeLearningDetail.setC_code(collegeBooking.getCollege_code());
+                collegeLearningDetail.setDate(sdf.format(new Date()));
+                collegeLearningDetail.setStatus(1);
+                collegeLearningDetail.setSys_type("YueLife");
+                collegeLearningDetailService.addCollegeLearningDetail(collegeLearningDetail);
+                collegeBookingDao.insertSelective(collegeBooking);
+                return 1;
+            }catch (Exception ex){
+                ex.printStackTrace();
+                return 0;
+            }
+        }
+    }
+
     public int addCollegeBooking(CollegeBooking collegeBooking) {
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         CollegeBooking collegeBooking1 = collegeBookingDao.checkBooking(collegeBooking);
@@ -49,6 +80,7 @@ public class CollegeBookingService {
                 collegeLearningDetail.setC_code(collegeBooking.getCollege_code());
                 collegeLearningDetail.setDate(sdf.format(new Date()));
                 collegeLearningDetail.setStatus(1);
+                collegeLearningDetail.setSys_type("YueSuo");
                 collegeLearningDetailService.addCollegeLearningDetail(collegeLearningDetail);
                 collegeBookingDao.insertSelective(collegeBooking);
                 // pcount

+ 2 - 1
src/main/java/com/ygj/yuemum/service/college/CollegeCurriculumCoreService.java

@@ -265,8 +265,9 @@ public class CollegeCurriculumCoreService {
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         collegeLearningDetail.setOpen_id(openid);
         collegeLearningDetail.setC_code(c_code);
+        collegeLearningDetail.setSys_type("YueSuo");
         CollegeLearningDetail collegeLearningDetailOld = collegeLearningDetailService.checkCoreLearningRate(collegeLearningDetail);
-        if (collegeLearningDetailOld != null && collegeLearningDetailOld.getStatus() ==9) {
+        if (collegeLearningDetailOld == null || collegeLearningDetailOld.getStatus() ==9) {
             return 0;
         } else {
             //加学分 更新日志

+ 3 - 2
src/main/java/com/ygj/yuemum/service/college/CollegeLearningDetailService.java

@@ -1,8 +1,6 @@
 package com.ygj.yuemum.service.college;
 
-import com.ygj.yuemum.dao.college.CollegeCurriculumCoreDao;
 import com.ygj.yuemum.dao.college.CollegeLearningDetailDao;
-import com.ygj.yuemum.domain.college.CollegeCurriculumCore;
 import com.ygj.yuemum.domain.college.CollegeLearningDetail;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -46,6 +44,9 @@ public class CollegeLearningDetailService {
     public CollegeLearningDetail  checkCoreLearningRate(CollegeLearningDetail collegeLearningDetail) {
         return collegeLearningDetailDao.checkCoreLearningRate(collegeLearningDetail);
     }
+    public CollegeLearningDetail  checkELearning(CollegeLearningDetail collegeLearningDetail) {
+        return collegeLearningDetailDao.checkELearning(collegeLearningDetail);
+    }
 
     public int updateLearningRate(CollegeLearningDetail collegeLearningDetail) {
         return collegeLearningDetailDao.updateLearningRate(collegeLearningDetail);

+ 2 - 1
src/main/java/com/ygj/yuemum/service/college/CollegeTestDetailService.java

@@ -61,7 +61,7 @@ public class CollegeTestDetailService {
         return collegeTestDetailDao.queryUserAnswers(collegeTestDetail);
     }
     public CollegeTestDetail queryTestComplete (CollegeTestDetail collegeTestDetail) {
-        return collegeTestDetailDao.queryUserAnswers(collegeTestDetail);
+        return collegeTestDetailDao.queryTestComplete(collegeTestDetail);
     }
     public LinkedHashMap<String, Object> addTestDetail(String openid, Integer core_id, String answers) {
         LinkedHashMap<String, Object> tableData = new LinkedHashMap<>();
@@ -69,6 +69,7 @@ public class CollegeTestDetailService {
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         collegeTestDetailQuery.setOpenid(openid);
         collegeTestDetailQuery.setCoreid(core_id);
+        collegeTestDetailQuery.setSys_type("YueSuo");
         if(collegeTestDetailDao.selectByOpenId(collegeTestDetailQuery) == null) {
             CollegeTestDetail collegeTestDetail = new CollegeTestDetail();
             collegeTestDetail.setCoreid(core_id);

+ 81 - 21
src/main/java/com/ygj/yuemum/service/eLearning/ELearningService.java

@@ -2,16 +2,14 @@ package com.ygj.yuemum.service.eLearning;
 
 import com.ygj.yuemum.dao.college.CollegeCurriculumCoreDao;
 import com.ygj.yuemum.domain.college.*;
+import com.ygj.yuemum.domain.elearning.ELearningBooking;
 import com.ygj.yuemum.service.college.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
+import java.util.*;
 
 @Service
 
@@ -28,22 +26,35 @@ public class ELearningService {
     private CollegeCurriculumCoreService collegeCurriculumCoreService;
     @Autowired
     private CollegeLearningDetailService collegeLearningDetailService;
+    @Autowired
+    private CollegeBookingService collegeBookingService;
 
     public LinkedHashMap<String, Object> index(String attendant_id) {
         LinkedHashMap<String, Object> tableData = new LinkedHashMap<>();
+        List<CollegeCurriculumCore> tableDataComplete = new ArrayList<>();
+        List<CollegeCurriculumCore> tableDataBooking = new ArrayList<>();
+        List<CollegeCurriculumCore> tableDataIncomplete = new ArrayList<>();
         CollegeCurriculumCore collegeCurriculumCoreQuery = new CollegeCurriculumCore();
         collegeCurriculumCoreQuery.setOpenid(attendant_id);
         List<CollegeCurriculumCore> collegeCurriculumCores = collegeCurriculumCoreDao.queryELearning_Index(collegeCurriculumCoreQuery);
         for (CollegeCurriculumCore collegeCurriculumCore : collegeCurriculumCores) {
             if (collegeCurriculumCore.getStatus() != null && collegeCurriculumCore.getStatus().equals("9")) { //1-已预约,2-学习中,3-已过期, 9-已完成
                 collegeCurriculumCore.setStatus("已完成");
+                tableDataComplete.add(collegeCurriculumCore);
+            } else if (collegeCurriculumCore.getStatus() != null && collegeCurriculumCore.getStatus().equals("1")) {
+                collegeCurriculumCore.setStatus("已预约");
+                tableDataBooking.add(collegeCurriculumCore);
             } else if (collegeCurriculumCore.getStatus() != null && collegeCurriculumCore.getStatus().equals("2")) {
-                collegeCurriculumCore.setStatus("待完成");
+                collegeCurriculumCore.setStatus("学习中");
+                tableDataBooking.add(collegeCurriculumCore);
             } else {
                 collegeCurriculumCore.setStatus("待完成");
+                tableDataIncomplete.add(collegeCurriculumCore);
             }
         }
-        tableData.put("college_core", collegeCurriculumCores);
+        tableData.put("coursework_complete", tableDataComplete);
+        tableData.put("coursework_booking", tableDataBooking);
+        tableData.put("coursework_incomplete", tableDataIncomplete);
         return tableData;
     }
 
@@ -190,7 +201,8 @@ public class ELearningService {
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         collegeTestDetailQuery.setOpenid(attendant_id);
         collegeTestDetailQuery.setCoreid(coursework_id);
-        if (collegeTestDetailService.selectByOpenId(collegeTestDetailQuery) == null) {
+        collegeTestDetailQuery.setSys_type("YueLife");
+        if (collegeTestDetailService.queryTestComplete(collegeTestDetailQuery) == null) {
             CollegeTestDetail collegeTestDetail = new CollegeTestDetail();
             collegeTestDetail.setCoreid(coursework_id);
             collegeTestDetail.setOpenid(attendant_id);
@@ -222,7 +234,7 @@ public class ELearningService {
             CollegeCurriculumCore collegeCurriculumCore = collegeCurriculumCoreService.getCollegeCurriculumCore(coursework_id);
             CollegeLearningDetail collegeLearningDetail1 = new CollegeLearningDetail();
             collegeLearningDetail1.setOpen_id(attendant_id);
-            collegeLearningDetail1.setC_code(collegeCurriculumCore.getC_code());
+            collegeLearningDetail1.setC_code(String.valueOf(coursework_id));
             collegeLearningDetail1.setDate(sdf.format(new Date()));
             collegeLearningDetail1.setCredit(collegeCurriculumCore.getCredit());
             collegeLearningDetail1.setStatus(9);
@@ -238,12 +250,18 @@ public class ELearningService {
     }
 
     public int courseworkComplete(String attendant_id, String coursework_id) {
+        //传入ID 转换成编号
         CollegeLearningDetail collegeLearningDetail = new CollegeLearningDetail();
+        CollegeCurriculumCore collegeCurriculumCore = collegeCurriculumCoreDao.selectByPrimaryKey(Integer.parseInt(coursework_id));
+        if(collegeCurriculumCore == null) {
+            return 0;
+        }
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         collegeLearningDetail.setOpen_id(attendant_id);
         collegeLearningDetail.setC_code(coursework_id);
-        CollegeLearningDetail collegeLearningDetailOld = collegeLearningDetailService.checkCoreLearningRate(collegeLearningDetail);
-        if (collegeLearningDetailOld != null && collegeLearningDetailOld.getStatus() == 9) {
+        collegeLearningDetail.setSys_type("YueLife");
+        CollegeLearningDetail collegeLearningDetailOld = collegeLearningDetailService.checkELearning(collegeLearningDetail);
+        if (collegeLearningDetailOld == null || collegeLearningDetailOld.getStatus() == 9) {
             return 0;
         } else {
             collegeLearningDetail.setId(collegeLearningDetailOld.getId());
@@ -263,40 +281,40 @@ public class ELearningService {
             DecimalFormat df = new DecimalFormat("00.00");
             collegeLearningDetail.setOpen_id(attendant_id);
             collegeLearningDetail.setC_code(coursework_id);
-            CollegeLearningDetail collegeLearningDetailOld = collegeLearningDetailService.checkCoreLearningRate(collegeLearningDetail);
-            CollegeCurriculumCore collegeCurriculumCore = collegeCurriculumCoreDao.queryCoreByCode(coursework_id);
+            CollegeLearningDetail collegeLearningDetailOld = collegeLearningDetailService.checkELearning(collegeLearningDetail);
+            CollegeCurriculumCore collegeCurriculumCore = collegeCurriculumCoreDao.queryELeaningByCode(coursework_id);
 
             String rTime[] = rate.split(":");
             int rHours = Integer.parseInt(rTime[0]) * 60 * 60;
             int rMinutes = Integer.parseInt(rTime[1]) * 60;
-            int rateNew = rHours+rMinutes;
+            int rateNew = rHours + rMinutes;
 
             String coreTime[] = collegeCurriculumCore.getVideo_length().split(":");
             int coreHours = Integer.parseInt(coreTime[0]) * 60 * 60;
             int coreMinutes = Integer.parseInt(coreTime[1]) * 60;
-            int coreRate = coreHours+coreMinutes;
-            double rateValueTemp = ((double)coreRate - (double)rateNew)/coreRate;
+            int coreRate = coreHours + coreMinutes;
+            double rateValueTemp = ((double) coreRate - (double) rateNew) / coreRate;
             String rateValue;
             if (rateValueTemp >= 1) {
                 rateValue = "100%";
             } else {
-                rateValue = df.format(rateValueTemp*100) + "%";
+                rateValue = df.format(rateValueTemp * 100) + "%";
             }
 
-            if(collegeLearningDetailOld == null) {
+            if (collegeLearningDetailOld == null) {
                 collegeLearningDetail.setRate(rateValue);
                 collegeLearningDetail.setDate(sdf.format(new Date()));
                 collegeLearningDetail.setStatus(2);
                 collegeLearningDetail.setRate_time(rate);
                 collegeLearningDetail.setSys_type("YueLife");
                 collegeLearningDetailService.addCollegeLearningDetail(collegeLearningDetail);
-                collegeCurriculumCoreDao.updateCoreCount(coursework_id);
+                collegeCurriculumCoreDao.updateELearningCount(coursework_id);
                 return 1;
             } else {
-                if(collegeLearningDetailOld.getStatus() == 9) {
+                if (collegeLearningDetailOld.getStatus() == 9) {
                     return 0;
                 } else {
-                    if (Double.parseDouble(rateValue.replace("%","")) > Double.parseDouble(collegeLearningDetailOld.getRate().replace("%",""))) {
+                    if (Double.parseDouble(rateValue.replace("%", "")) > Double.parseDouble(collegeLearningDetailOld.getRate().replace("%", ""))) {
                         collegeLearningDetail.setId(collegeLearningDetailOld.getId());
                         collegeLearningDetail.setRate(rateValue);
                         collegeLearningDetail.setStatus(2);
@@ -310,11 +328,53 @@ public class ELearningService {
                 }
 
             }
-        }catch (Exception ex) {
+        } catch (Exception ex) {
             ex.printStackTrace();
             return 0;
         }
 
     }
 
+    public int courseworkBooking(ELearningBooking eLearningBooking) {
+        CollegeBooking collegeBooking = new CollegeBooking();
+        collegeBooking.setOpenid(eLearningBooking.getAttendant_id());
+        collegeBooking.setCollege_code(eLearningBooking.getCoursework_id());
+        collegeBooking.setGender(eLearningBooking.getGender());
+        collegeBooking.setOrders(eLearningBooking.getOrders());
+        collegeBooking.setApplause_rate(eLearningBooking.getApplause_rate());
+        //判断是否已预约
+        try {
+            CollegeBooking collegeBooking1 = collegeBookingService.checkELearningBooking(collegeBooking);
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            if (collegeBooking1 != null) {
+                return 0; //已预约
+            } else {
+                //更改学习记录
+                CollegeLearningDetail collegeLearningDetailQuery = new CollegeLearningDetail();
+                collegeLearningDetailQuery.setOpen_id(collegeBooking.getOpenid());
+                collegeLearningDetailQuery.setC_code(collegeBooking.getCollege_code());
+                CollegeLearningDetail collegeLearningDetail = collegeLearningDetailService.checkELearning(collegeLearningDetailQuery);
+                if (collegeLearningDetail != null) {
+                    return collegeLearningDetail.getStatus(); //2学习中,9已完成
+                } else {
+                    //保存学习记录
+                    CollegeLearningDetail collegeLearningDetailNew = new CollegeLearningDetail();
+                    collegeLearningDetailNew.setOpen_id(collegeBooking.getOpenid());
+                    collegeLearningDetailNew.setC_code(collegeBooking.getCollege_code());
+                    collegeLearningDetailNew.setStatus(1);
+                    collegeLearningDetailNew.setSys_type("YueLife");
+                    collegeLearningDetailNew.setDate(sdf.format(new Date()));
+                    //保存预约
+                    collegeBooking.setSys_type("YueLife");
+                    collegeBooking.setDate(sdf.format(new Date()));
+                    collegeBookingService.addELearningBooking(collegeBooking);
+                    return 1;
+                }
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            return 99;
+        }
+    }
+
 }

+ 1 - 0
src/main/java/com/ygj/yuemum/shiro/ShiroConfig.java

@@ -141,6 +141,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/eLearning/testComplete","anon");
         filterChainDefinitionMap.put("/eLearning/courseworkComplete","anon");
         filterChainDefinitionMap.put("/eLearning/courseworkUpdate","anon");
+        filterChainDefinitionMap.put("/eLearning/courseworkBooking","anon");
 //        //用户,需要角色权限 “user”
 //        filterChainDefinitionMap.put("/user/**", "roles[user]");
 //        //管理员,需要角色权限 “admin”

+ 60 - 3
src/main/resources/mybatis/mapper/college/CollegeBookingMapper.xml

@@ -12,6 +12,10 @@
         <result column="college_code" property="college_code" jdbcType="VARCHAR" />
         <result column="b_count" property="b_count" jdbcType="INTEGER" />
         <result column="b_time" property="b_time" jdbcType="INTEGER" />
+        <result column="sys_type" property="sys_type" jdbcType="VARCHAR" />
+        <result column="gender" property="gender" jdbcType="INTEGER" />
+        <result column="applause_rate" property="applause_ate" jdbcType="INTEGER" />
+        <result column="orders" property="orders" jdbcType="INTEGER" />
     </resultMap>
     <!--获取所有数据-->
 
@@ -19,6 +23,7 @@
         select
         *
         from college_booking
+        where sys_type = 'YueSuo'
         order by id desc
     </select>
 
@@ -28,6 +33,7 @@
         *
         from college_booking
         where id = #{id,jdbcType=INTEGER}
+        and sys_type = 'YueSuo'
     </select>
 
 
@@ -37,6 +43,17 @@
         from college_booking
         where openid = #{openid,jdbcType=VARCHAR}
         and college_code = #{college_code,jdbcType=VARCHAR}
+        and sys_type = 'YueSuo'
+    </select>
+
+
+    <select id="checkELearningBooking" resultType="com.ygj.yuemum.domain.college.CollegeBooking" parameterType="com.ygj.yuemum.domain.college.CollegeBooking" >
+        select
+        *
+        from college_booking
+        where openid = #{openid,jdbcType=VARCHAR}
+        and college_code = #{college_code,jdbcType=VARCHAR}
+        and sys_type = 'YueLife'
     </select>
 
 
@@ -44,11 +61,13 @@
         delete from college_booking
         where openid = #{openid,jdbcType=VARCHAR}
         and college_code = #{college_code,jdbcType=VARCHAR}
+        and sys_type = 'YueSuo'
     </delete>
 
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
         delete from college_booking
         where id = #{id,jdbcType=INTEGER}
+        and sys_type = 'YueSuo'
     </delete>
 
     <insert id="insertSelective" parameterType="com.ygj.yuemum.domain.college.CollegeBooking" >
@@ -76,7 +95,20 @@
                 `b_count`,
             </if>
             <if test="b_time != null" >
-                `b_time`
+                `b_time`,
+            </if>
+
+            <if test="sys_type != null" >
+                `sys_type`,
+            </if>
+            <if test="gender != null" >
+                `gender`,
+            </if>
+            <if test="applause_rate != null" >
+                `applause_rate`,
+            </if>
+            <if test="orders != null" >
+                `orders`
             </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides="," >
@@ -102,7 +134,20 @@
                 #{b_count,jdbcType=INTEGER},
             </if>
             <if test="b_time != null" >
-                #{b_time,jdbcType=INTEGER}
+                #{b_time,jdbcType=INTEGER},
+            </if>
+
+            <if test="sys_type != null" >
+                #{sys_type,jdbcType=VARCHAR},
+            </if>
+            <if test="gender != null" >
+                #{gender,jdbcType=INTEGER},
+            </if>
+            <if test="applause_rate != null" >
+                #{applause_rate,jdbcType=INTEGER},
+            </if>
+            <if test="orders != null" >
+                #{orders,jdbcType=INTEGER}
             </if>
         </trim>
     </insert>
@@ -132,7 +177,19 @@
                 b_count = #{b_count ,jdbcType=INTEGER},
             </if>
             <if test="b_time != null" >
-                b_time = #{b_time,jdbcType=INTEGER}
+                b_time = #{b_time,jdbcType=INTEGER},
+            </if>
+            <if test="sys_type != null" >
+                sys_type = #{sys_type,jdbcType=VARCHAR},
+            </if>
+            <if test="gender != null" >
+                gender = #{gender,jdbcType=INTEGER},
+            </if>
+            <if test="applause_rate != null" >
+                applause_rate = #{applause_rate,jdbcType=INTEGER},
+            </if>
+            <if test="orders != null" >
+                orders = #{orders,jdbcType=INTEGER}
             </if>
         </set>
         where id = #{id,jdbcType=INTEGER}

+ 26 - 8
src/main/resources/mybatis/mapper/college/CollegeCurriculumCoreMapper.xml

@@ -131,7 +131,17 @@
         *
         from college_curriculum_core
         where c_code = #{c_code,jdbcType=INTEGER}
-        and ccc.sys_type = 'YueSuo'
+        and sys_type = 'YueSuo'
+    </select>
+
+
+    <select id="queryELeaningByCode" resultType="com.ygj.yuemum.domain.college.CollegeCurriculumCore"
+            parameterType="java.lang.String">
+        select
+        *
+        from college_curriculum_core
+        where id = #{c_code,jdbcType=INTEGER}
+        and sys_type = 'YueLife'
     </select>
 
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
@@ -290,6 +300,14 @@
         and ccc.sys_type = 'YueSuo'
     </update>
 
+
+    <update id="updateELearningCount" parameterType="java.lang.String">
+        update college_curriculum_core set pcount = pcount +1
+        where id =  #{c_code,jdbcType=VARCHAR}
+        and sys_type = 'YueLife'
+    </update>
+
+
     <update id="updateByPrimaryKeySelective" parameterType="com.ygj.yuemum.domain.college.CollegeCurriculumCore">
         update college_curriculum_core
         <set>
@@ -366,7 +384,7 @@
             parameterType="com.ygj.yuemum.domain.college.CollegeCurriculumCore">
         select
         ccc.*,
-        IFNULL((select `status` from college_learning_detail where c_code = ccc.c_code  and sys_type = 'YueLife' and open_id = #{openid,jdbcType=VARCHAR}  and `status` != 8 order by `status` desc limit 1),0) `status`
+        IFNULL((select `status` from college_learning_detail where c_code = ccc.id  and sys_type = 'YueLife' and open_id = #{openid,jdbcType=VARCHAR}  and `status` != 8 order by `status` desc limit 1),0) `status`
         from college_curriculum_core as ccc
         where
         ccc.sys_type = 'YueLife'
@@ -378,8 +396,8 @@
         SELECT
             ccc.*,
             (select result from college_test_detail where coreid = ccc.id and sys_type = 'YueLife' and  `status` != 8 and openid = #{openid,jdbcType=VARCHAR}) result,
-            (select status from college_learning_detail where c_code = ccc.c_code  and sys_type = 'YueLife' and  `status` != 8 and open_id = #{openid,jdbcType=VARCHAR} order by `status` desc limit 1) `status`,
-            IFNULL((select rate from college_learning_detail where c_code = ccc.c_code  and sys_type = 'YueLife' and  `status` != 8 and open_id = #{openid,jdbcType=VARCHAR} order by `status` desc limit 1),'0%') `rate`
+            (select status from college_learning_detail where c_code = ccc.id  and sys_type = 'YueLife' and  `status` != 8 and open_id = #{openid,jdbcType=VARCHAR} order by `status` desc limit 1) `status`,
+            IFNULL((select rate from college_learning_detail where c_code = ccc.id  and sys_type = 'YueLife' and  `status` != 8 and open_id = #{openid,jdbcType=VARCHAR} order by `status` desc limit 1),'0%') `rate`
         FROM
             college_curriculum_core  as ccc
         WHERE
@@ -402,10 +420,10 @@
             ccc.isvideo,
             ccc.video_length,
             ccc.video_href,
-            (select status from college_learning_detail where c_code = ccc.c_code and sys_type = 'YueSuo' and  `status` != 8 and open_id = #{openid,jdbcType=VARCHAR} order by `status` desc limit 1) `status`,
-            IFNULL((select rate from college_learning_detail where c_code = ccc.c_code  and sys_type = 'YueSuo' and  `status` != 8 and open_id = #{openid,jdbcType=VARCHAR} order by `status` desc limit 1),'0%') `rate`,
-            IFNULL((select rate_time from college_learning_detail where c_code = ccc.c_code  and sys_type = 'YueSuo' and  `status` != 8 and open_id = #{openid,jdbcType=VARCHAR} order by `status` desc limit 1),ccc.video_length) `rate_time`,
-            IFNULL((select status from college_learning_detail where c_code = ccc.c_code and sys_type = 'YueSuo' and  `status` = 8 and open_id = #{openid,jdbcType=VARCHAR} order by `status` desc limit 1),0) ispositive
+            (select status from college_learning_detail where c_code = ccc.id and sys_type = 'YueLife' and  `status` != 8 and open_id = #{openid,jdbcType=VARCHAR} order by `status` desc limit 1) `status`,
+            IFNULL((select rate from college_learning_detail where c_code = ccc.id  and sys_type = 'YueLife' and  `status` != 8 and open_id = #{openid,jdbcType=VARCHAR} order by `status` desc limit 1),'0%') `rate`,
+            IFNULL((select rate_time from college_learning_detail where c_code = ccc.id  and sys_type = 'YueLife' and  `status` != 8 and open_id = #{openid,jdbcType=VARCHAR} order by `status` desc limit 1),ccc.video_length) `rate_time`,
+            IFNULL((select status from college_learning_detail where c_code = ccc.id and sys_type = 'YueLife' and  `status` = 8 and open_id = #{openid,jdbcType=VARCHAR} order by `status` desc limit 1),0) ispositive
         FROM
             college_curriculum_core  as ccc
         WHERE

+ 11 - 0
src/main/resources/mybatis/mapper/college/CollegeLearningDetailMapper.xml

@@ -54,6 +54,17 @@
     </select>
 
 
+    <select id="checkELearning" resultType="com.ygj.yuemum.domain.college.CollegeLearningDetail" parameterType="com.ygj.yuemum.domain.college.CollegeLearningDetail" >
+        select
+        *
+        from college_learning_detail
+        where open_id = #{open_id,jdbcType=INTEGER}
+        and c_code = #{c_code,jdbcType=INTEGER}
+        and sys_type = 'YueLife'
+        order by id desc limit 1
+    </select>
+
+
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
 
         delete from college_learning_detail