Ver código fonte

学生列表页面接口

weifanli 3 anos atrás
pai
commit
04c1776039

+ 10 - 62
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/StudentController.java

@@ -1,13 +1,13 @@
 package com.yonge.cooleshow.admin.controller;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.yonge.cooleshow.auth.api.entity.SysUser;
+import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.biz.dal.entity.Student;
-import com.yonge.cooleshow.biz.dal.entity.Teacher;
 import com.yonge.cooleshow.biz.dal.service.StudentService;
 import com.yonge.cooleshow.biz.dal.support.Condition;
 import com.yonge.cooleshow.biz.dal.support.Query;
-import com.yonge.cooleshow.biz.dal.vo.TeacherHomeVo;
+import com.yonge.cooleshow.biz.dal.vo.StudentVo;
+import com.yonge.cooleshow.biz.dal.vo.TeacherVo;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.common.page.PageInfo;
@@ -15,8 +15,8 @@ import com.yonge.toolset.utils.string.StringUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
+import org.apache.commons.beanutils.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
@@ -26,78 +26,26 @@ import java.util.List;
 @RequestMapping("/Student")
 @Api(value = "学生表", tags = "学生表")
 public class StudentController extends BaseController {
-
     @Autowired
     private StudentService studentService;
-
-
 	/**
      * 查询单条
      */
-    @GetMapping("/detail")
+    @GetMapping("/detail/")
     @ApiOperation(value = "详情", notes = "传入student")
-    public HttpResponseResult<Student> detail(Student student) {
-		Student detail = studentService.getOne(Condition.getQueryWrapper(student));
+    public HttpResponseResult<StudentVo> detail(Student student) throws Exception{
+		StudentVo detail = studentService.detail(student.getUserId());
 		return succeed(detail);
 	}
-    
-    
-    /**
-     * 查询集合
-     */
-    @GetMapping("/list")
-    @ApiOperation(value = "查询集合", notes = "传入student")
-    public HttpResponseResult<List<Student>> list(Student student) {
-		List<Student> list = studentService.list();
-		return succeed(list);
-	}
-    
+
     /**
      * 查询分页
      */
     @GetMapping("/page")
     @ApiOperation(value = "查询分页", notes = "传入student")
-    public HttpResponseResult<PageInfo<Student>> page(Student student, Query query) {
-		IPage<Student> pages = studentService.selectPage(Condition.getPage(query), student);
+    public HttpResponseResult<PageInfo<StudentVo>> page(Student student, Query query) {
+		IPage<StudentVo> pages = studentService.selectPage(Condition.getPage(query), student);
         return succeed(Condition.pageInfo(pages));
 	}
-    
-    /**
-	 * 新增
-	 */
-	@PostMapping("/save")
-	@ApiOperation(value = "新增", notes = "传入student")
-	public HttpResponseResult save(@Valid @RequestBody Student student) {
-    	return status(studentService.save(student));
-	}
-    
-    /**
-	 * 修改
-	 */
-	@PostMapping("/update")
-	@ApiOperation(value = "修改", notes = "传入student")
-	public HttpResponseResult update(@Valid @RequestBody Student student) {
-        return status(studentService.updateById(student));
-	}
-    
-    /**
-	 * 新增或修改
-	 */
-    @PostMapping("/submit")
-    @ApiOperation(value = "新增或修改", notes = "传入student")
-	public HttpResponseResult submit(@RequestBody Student student) {
-        return status(studentService.saveOrUpdate(student));
-    }
 
- 	/**
-	 * 删除
-	 */
-	@PostMapping("/remove")
-	@ApiOperation(value = "逻辑删除", notes = "传入ids")
-	public HttpResponseResult remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
-        if (StringUtil.isEmpty(ids)) {
-			return failed("参数不能为空");
-		}
-		return status(studentService.removeByIds(StringUtil.toLongList(ids)));
-	}
 }

+ 6 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/constant/SysConfigConstant.java

@@ -24,6 +24,12 @@ public interface SysConfigConstant {
      * 直播服务费
      */
     String LIVE_SERVICE_RATE = "live_service_rate";
+    /***
+     * 平台提现手续费
+     * @author liweifan
+     * @updateTime 2022/3/24 17:15
+     */
+    String WITHDRAWAL_SERVICE_FEE = "withdrawal_service_fee";
 
     /**
      * 提前创建直播房间的时间

+ 11 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/StudentDao.java

@@ -5,12 +5,21 @@ import java.util.List;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.yonge.cooleshow.biz.dal.entity.Student;
+import com.yonge.cooleshow.biz.dal.vo.StudentVo;
+import org.apache.ibatis.annotations.Param;
 
 public interface StudentDao extends BaseMapper<Student>{
 
 	/**
 	 * 自定义分页
 	 */
-	List<Student> selectPage(IPage page, Student student);
-	
+	List<StudentVo> selectPage(IPage page, Student student);
+	/***
+	 *
+	 * @author liweifan
+	 * @param: userId
+	 * @updateTime 2022/3/24 18:14
+	 * @return: com.yonge.cooleshow.biz.dal.vo.StudentVo
+	 */
+    StudentVo detail(@Param("userId") Long userId);
 }

+ 1 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/TeacherStyleVideoDao.java

@@ -9,6 +9,6 @@ import org.apache.ibatis.annotations.Param;
 
 public interface TeacherStyleVideoDao extends BaseMapper<TeacherStyleVideo>{
 
-    TeacherStyleVideo selectListByUserId(@Param("userId") Long userId);
+    List<TeacherStyleVideo> selectListByUserId(@Param("userId") Long userId);
 
 }

+ 11 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/StudentService.java

@@ -3,6 +3,8 @@ package com.yonge.cooleshow.biz.dal.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.yonge.cooleshow.biz.dal.entity.Student;
+import com.yonge.cooleshow.biz.dal.vo.StudentVo;
+import com.yonge.cooleshow.biz.dal.vo.TeacherVo;
 
 /**
  * 学生表 服务类
@@ -16,5 +18,13 @@ public interface StudentService extends IService<Student>  {
      * @author liweifan
  	 * @date 2022-03-23
      */
-    IPage<Student> selectPage(IPage<Student> page, Student student);
+    IPage<StudentVo> selectPage(IPage<StudentVo> page, Student student);
+    /***
+     * 查询学员详情
+     * @author liweifan
+     * @param: userId
+     * @updateTime 2022/3/23 17:49
+     * @return: com.yonge.cooleshow.biz.dal.vo.TeacherVo
+     */
+    StudentVo detail(Long userId);
 }

+ 13 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/StudentServiceImpl.java

@@ -2,11 +2,16 @@ package com.yonge.cooleshow.biz.dal.service.impl;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.yonge.cooleshow.biz.dal.entity.TeacherStyleVideo;
+import com.yonge.cooleshow.biz.dal.vo.StudentVo;
+import com.yonge.cooleshow.biz.dal.vo.TeacherVo;
 import org.springframework.stereotype.Service;
 import com.yonge.cooleshow.biz.dal.entity.Student;
 import com.yonge.cooleshow.biz.dal.dao.StudentDao;
 import com.yonge.cooleshow.biz.dal.service.StudentService;
 
+import java.util.List;
+
 
 @Service
 public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> implements StudentService {
@@ -15,8 +20,14 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
      * 分页查询
      */
      @Override
-    public IPage<Student> selectPage(IPage<Student> page, Student student){
+    public IPage<StudentVo> selectPage(IPage<StudentVo> page, Student student){
         return page.setRecords(baseMapper.selectPage(page, student));
     }
-	
+
+    @Override
+    public StudentVo detail(Long userId) {
+        StudentVo detail = baseMapper.detail(userId);
+        return detail;
+    }
+
 }

+ 3 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TeacherStyleVideoServiceImpl.java

@@ -7,12 +7,14 @@ import com.yonge.cooleshow.biz.dal.entity.TeacherStyleVideo;
 import com.yonge.cooleshow.biz.dal.dao.TeacherStyleVideoDao;
 import com.yonge.cooleshow.biz.dal.service.TeacherStyleVideoService;
 
+import java.util.List;
+
 
 @Service
 public class TeacherStyleVideoServiceImpl extends ServiceImpl<TeacherStyleVideoDao, TeacherStyleVideo> implements TeacherStyleVideoService {
 
     @Override
-    public TeacherStyleVideo selectListByUserId(Long userId) {
+    public List<TeacherStyleVideo> selectListByUserId(Long userId) {
         return baseMapper.selectListByUserId(userId);
     }
 }

+ 119 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/StudentVo.java

@@ -0,0 +1,119 @@
+package com.yonge.cooleshow.biz.dal.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.yonge.cooleshow.biz.dal.entity.Student;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * @Author: liweifan
+ * @Data: 2022/3/24 17:22
+ */
+@ApiModel(value = "StudentVo对象", description = "学生表")
+public class StudentVo extends Student {
+    @ApiModelProperty("头像地址")
+    private String avatar;
+    @ApiModelProperty("昵称")
+    private String username;
+    @ApiModelProperty(value = "性别 0女 1男")
+    private Integer gender;
+    @ApiModelProperty(value = "手机号")
+    private String phone;
+    @ApiModelProperty(value = "是否实名 0否 1是")
+    private Boolean isReal;
+    @ApiModelProperty(value = "是否会员 0否 1是")
+    private Boolean isBank;
+    @ApiModelProperty(value = "真实姓名")
+    private String realName;
+    @ApiModelProperty(value = "身份证号码")
+    private String idCardNo;
+    @ApiModelProperty(value = "出生日期")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date birthdate;
+    @ApiModelProperty(value = "年龄")
+    private Integer age;
+
+    public String getAvatar() {
+        return avatar;
+    }
+
+    public void setAvatar(String avatar) {
+        this.avatar = avatar;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public Integer getGender() {
+        return gender;
+    }
+
+    public void setGender(Integer gender) {
+        this.gender = gender;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public Boolean getReal() {
+        return isReal;
+    }
+
+    public void setReal(Boolean real) {
+        isReal = real;
+    }
+
+    public Boolean getBank() {
+        return isBank;
+    }
+
+    public void setBank(Boolean bank) {
+        isBank = bank;
+    }
+
+    public String getRealName() {
+        return realName;
+    }
+
+    public void setRealName(String realName) {
+        this.realName = realName;
+    }
+
+    public String getIdCardNo() {
+        return idCardNo;
+    }
+
+    public void setIdCardNo(String idCardNo) {
+        this.idCardNo = idCardNo;
+    }
+
+    public Date getBirthdate() {
+        return birthdate;
+    }
+
+    public void setBirthdate(Date birthdate) {
+        this.birthdate = birthdate;
+    }
+
+    public Integer getAge() {
+        return age;
+    }
+
+    public void setAge(Integer age) {
+        this.age = age;
+    }
+}

+ 35 - 5
cooleshow-user/user-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -4,7 +4,6 @@
 	<resultMap id="BaseResultMap" type="com.yonge.cooleshow.biz.dal.entity.Student">
             <result column="user_id_" property="userId" />
 	        <result column="subject_id_list_" property="subjectIdList" />
-	        <result column="current_grade_num_" property="currentGradeNum" />
 	        <result column="member_rank_setting_id_" property="memberRankSettingId" />
 	        <result column="membership_start_time_" property="membershipStartTime" />
 	        <result column="membership_end_time_" property="membershipEndTime" />
@@ -29,9 +28,40 @@
         </sql> 
     
     <!-- 分页查询 -->
-    <select id="selectPage" resultMap="BaseResultMap">
-		SELECT         
-        	<include refid="baseColumns" />
-		FROM student t
+    <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.vo.StudentVo">
+        SELECT
+            <include refid="baseColumns"/>,
+            u.username_ as username,
+            u.gender_ as gender,
+            u.birthdate_ as birthdate,
+
+            u.phone_ as phone,
+            (case when isnull(u.id_card_no_) then 0 else 1 end) as isReal
+        FROM student t
+        left join sys_user u on t.user_id_ = u.id
+        <where>
+            <if test="null != param.search and '' != param.search">
+                AND (
+                t.user_id_ LIKE CONCAT('%', #{param.search}, '%') or
+                u.username_ LIKE CONCAT('%', #{param.search}, '%') or
+                u.phone_ LIKE CONCAT('%', #{param.search}, '%')
+                )
+            </if>
+        </where>
 	</select>
+    <select id="detail" resultType="com.yonge.cooleshow.biz.dal.vo.StudentVo">
+        SELECT
+            <include refid="baseColumns"/>,
+            u.avatar_ as avatar,
+            u.username_ as username,
+            u.gender_ as gender,
+            u.birthdate_ as birthdate,
+            u.phone_ as phone,
+            (case when isnull(u.id_card_no_) then 0 else 1 end) as isReal,
+            u.real_name_ as realName,
+            id_card_no_ as idCardNo
+        FROM student t
+        left join sys_user u on t.user_id_ = u.id_
+        where t.user_id_ = #{userId}
+    </select>
 </mapper>

+ 0 - 2
cooleshow-user/user-biz/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -73,8 +73,6 @@
         </where>
     </select>
 
-
-
 	<resultMap id="BasicUserInfo" type="com.yonge.cooleshow.biz.dal.dto.BasicUserInfo">
 		<result property="userId" column="user_id_"/>
 		<result property="username" column="username_"/>

+ 0 - 73
cooleshow-user/user-student/src/main/java/com/yonge/cooleshow/student/controller/StudentController.java

@@ -72,77 +72,4 @@ public class StudentController extends BaseController {
         return succeed(studentHomeVo);
     }
 
-
-
-    /**
-     * 修改
-     */
-    @PostMapping("/update")
-    @ApiOperation(value = "修改", notes = "传入student")
-    public HttpResponseResult update(@Valid @RequestBody Student student) {
-        return status(studentService.updateById(student));
-    }
-
-
-    /**
-     * 查询单条
-     */
-    @GetMapping("/detail")
-    @ApiOperation(value = "详情", notes = "传入student")
-    public HttpResponseResult<Student> detail(Student student) {
-        Student detail = studentService.getOne(Condition.getQueryWrapper(student));
-        return succeed(detail);
-    }
-
-
-    /**
-     * 查询集合
-     */
-    @GetMapping("/list")
-    @ApiOperation(value = "查询集合", notes = "传入student")
-    public HttpResponseResult<List<Student>> list(Student student) {
-        List<Student> list = studentService.list();
-        return succeed(list);
-    }
-
-    /**
-     * 查询分页
-     */
-    @GetMapping("/page")
-    @ApiOperation(value = "查询分页", notes = "传入student")
-    public HttpResponseResult<PageInfo<Student>> page(Student student, Query query) {
-        IPage<Student> pages = studentService.selectPage(Condition.getPage(query), student);
-        return succeed(Condition.pageInfo(pages));
-    }
-
-    /**
-     * 新增
-     */
-    @PostMapping("/save")
-    @ApiOperation(value = "新增", notes = "传入student")
-    public HttpResponseResult save(@Valid @RequestBody Student student) {
-        return status(studentService.save(student));
-    }
-
-
-    /**
-     * 新增或修改
-     */
-    @PostMapping("/submit")
-    @ApiOperation(value = "新增或修改", notes = "传入student")
-    public HttpResponseResult submit(@RequestBody Student student) {
-        return status(studentService.saveOrUpdate(student));
-    }
-
-    /**
-     * 删除
-     */
-    @PostMapping("/remove")
-    @ApiOperation(value = "逻辑删除", notes = "传入ids")
-    public HttpResponseResult remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
-        if (StringUtil.isEmpty(ids)) {
-            return failed("参数不能为空");
-        }
-        return status(studentService.removeByIds(StringUtil.toLongList(ids)));
-    }
 }