ソースを参照

教练端登录

Althars123 3 年 前
コミット
3d67b65946

+ 116 - 0
fx-admin/src/main/java/com/miaxis/h5/controller/coach/CoachInfoController.java

@@ -0,0 +1,116 @@
+package com.miaxis.h5.controller.coach;
+
+import java.util.List;
+import java.util.Arrays;
+import io.swagger.annotations.*;
+import com.miaxis.common.core.domain.Response;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.enums.BusinessTypeEnum;
+import com.miaxis.common.core.domain.entity.CoachInfo;
+import com.miaxis.coach.service.ICoachInfoService;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.common.core.page.ResponsePageInfo;
+
+/**
+ * 【教练用户】Controller
+ *
+ * @author miaxis
+ * @date 2022-05-10
+ */
+@RestController
+@RequestMapping("/coach/info")
+@Api(tags={"【H5-教练用户】"})
+public class CoachInfoController extends BaseController{
+    @Autowired
+    private ICoachInfoService coachInfoService;
+
+    /**
+     * 查询教练用户列表
+     */
+    @PreAuthorize("@ss.hasPermi('coach:info:list')")
+    @GetMapping("/list")
+    @ApiOperation("查询教练用户列表")
+        @ApiImplicitParams({
+            @ApiImplicitParam(name = "pageNum",value = "当前页码" ,dataType = "int", paramType = "query", required = false),
+            @ApiImplicitParam(name = "pageSize",value = "每页数据量" , dataType = "int", paramType = "query", required = false),
+    })
+    public ResponsePageInfo<CoachInfo> list(@ModelAttribute CoachInfo coachInfo){
+        startPage();
+        List<CoachInfo> list = coachInfoService.selectCoachInfoList(coachInfo);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 导出教练用户列表
+     */
+    @PreAuthorize("@ss.hasPermi('coach:info:export')")
+    @Log(title = "教练用户", businessType = BusinessTypeEnum.EXPORT)
+    @GetMapping("/export")
+    @ApiOperation("导出教练用户列表Excel")
+    public Response<String> export(@ModelAttribute CoachInfo coachInfo){
+        List<CoachInfo> list = coachInfoService.selectCoachInfoList(coachInfo);
+        ExcelUtil<CoachInfo> util = new ExcelUtil<CoachInfo>(CoachInfo.class);
+        return util.exportExcel(list, "info");
+    }
+
+    /**
+     * 获取教练用户详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('coach:info:query')")
+    @GetMapping(value = "/{id}")
+    @ApiOperation("获取教练用户详细信息")
+    public Response<CoachInfo> getInfo(
+            @ApiParam(name = "id", value = "教练用户参数", required = true)
+            @PathVariable("id") Long id
+    ){
+        return Response.success(coachInfoService.getById(id));
+    }
+
+    /**
+     * 新增教练用户
+     */
+    @PreAuthorize("@ss.hasPermi('coach:info:add')")
+    @Log(title = "教练用户", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    @ApiOperation("新增教练用户")
+    public Response<Integer> add(@RequestBody CoachInfo coachInfo){
+        return toResponse(coachInfoService.save(coachInfo) ? 1 : 0);
+    }
+
+    /**
+     * 修改教练用户
+     */
+    @PreAuthorize("@ss.hasPermi('coach:info:edit')")
+    @Log(title = "教练用户", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    @ApiOperation("修改教练用户")
+    public Response<Integer> edit(@RequestBody CoachInfo coachInfo){
+        return toResponse(coachInfoService.updateById(coachInfo) ? 1 : 0);
+    }
+
+    /**
+     * 删除教练用户
+     */
+    @PreAuthorize("@ss.hasPermi('coach:info:remove')")
+    @Log(title = "教练用户", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{ids}")
+    @ApiOperation("删除教练用户")
+    public  Response<Integer> remove(
+            @ApiParam(name = "ids", value = "教练用户ids参数", required = true)
+            @PathVariable Long[] ids
+    ){
+        return toResponse(coachInfoService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
+    }
+}

+ 2 - 2
fx-admin/src/main/java/com/miaxis/system/controller/system/SysLoginController.java

@@ -111,7 +111,7 @@ public class SysLoginController
      *
      */
     @PostMapping("/login/code")
-    @ApiOperation("用户授权码模式登录")
+    @ApiOperation("教练端用户授权码模式登录")
     public Response<TokenDTO> loginByAuthorizationCode(String authorizationCode ){
         String wxResultStr = wxService.getWxToken(appid, appSecret, authorizationCode, "authorization_code");
         logger.info("微信授权码登录返回值:"+wxResultStr);
@@ -134,7 +134,7 @@ public class SysLoginController
 
     }
     @PostMapping("/login/code/test")
-    @ApiOperation("用户授权码模式登录--测试")
+    @ApiOperation("教练端用户授权码模式登录--测试")
     public Response<TokenDTO> testloginByAuthorizationCode(String authorizationCode ){
         WxUserInfo wxUserInfo = new WxUserInfo();
         wxUserInfo.setOpenid("ovKTX5-FKLF6_sgTtCIXpG_lz3PY");

+ 289 - 0
fx-common/src/main/java/com/miaxis/common/core/domain/entity/CoachInfo.java

@@ -0,0 +1,289 @@
+package com.miaxis.common.core.domain.entity;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.miaxis.common.annotation.Excel;
+import com.miaxis.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.miaxis.common.core.domain.BaseBusinessEntity;
+import lombok.Data;
+/**
+ * 教练用户对象 coach_info
+ *
+ * @author miaxis
+ * @date 2022-05-10
+ */
+@Data
+@TableName("coach_info")
+@ApiModel(value = "CoachInfo", description = "教练用户对象 coach_info")
+public class CoachInfo extends BaseBusinessEntity{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键 */
+    @TableId(value = "id")
+    @ApiModelProperty(value = "主键")
+    private Long id;
+
+    /** 手机号码 */
+    @Excel(name = "手机号码")
+    @TableField("phone")
+    @ApiModelProperty(value = "手机号码")
+    private String phone;
+
+    /** 微信号码 */
+    @Excel(name = "微信号码")
+    @TableField("wechar")
+    @ApiModelProperty(value = "微信号码")
+    private String wechar;
+
+    /** 小程序头像地址 */
+    @Excel(name = "小程序头像地址")
+    @TableField("head_image")
+    @ApiModelProperty(value = "小程序头像地址")
+    private String headImage;
+
+    /** 小程序昵称 */
+    @Excel(name = "小程序昵称")
+    @TableField("nick_name")
+    @ApiModelProperty(value = "小程序昵称")
+    private String nickName;
+
+    /** 用户真实姓名 */
+    @Excel(name = "用户真实姓名")
+    @TableField("real_name")
+    @ApiModelProperty(value = "用户真实姓名")
+    private String realName;
+
+    /** 微信openid */
+    @Excel(name = "微信openid")
+    @TableField("openid")
+    @ApiModelProperty(value = "微信openid")
+    private String openid;
+
+    /** 0 启用 1禁用 */
+    @Excel(name = "0 启用 1禁用")
+    @TableField("status")
+    @ApiModelProperty(value = "0 启用 1禁用")
+    private Integer status;
+
+    /** 会员过期时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "会员过期时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @TableField("expire_time")
+    @ApiModelProperty(value = "会员过期时间")
+    private Date expireTime;
+
+    /** 销售类型0- 普通用户 1-普通用户(含驾校分成) 2- 代理商(不含驾校分成) 3 - 代理商(含驾校分成) */
+    @Excel(name = "销售类型0- 普通用户 1-普通用户(含驾校分成) 2- 代理商(不含驾校分成) 3 - 代理商(含驾校分成)")
+    @TableField("sale_type")
+    @ApiModelProperty(value = "销售类型0- 普通用户 1-普通用户(含驾校分成) 2- 代理商(不含驾校分成) 3 - 代理商(含驾校分成)")
+    private Integer saleType;
+
+    /** 城市名称 */
+    @Excel(name = "城市名称")
+    @TableField("city_name")
+    @ApiModelProperty(value = "城市名称")
+    private String cityName;
+
+    /** 地区名称 */
+    @Excel(name = "地区名称")
+    @TableField("area_name")
+    @ApiModelProperty(value = "地区名称")
+    private String areaName;
+
+    /** 所属驾校名称 */
+    @Excel(name = "所属驾校名称")
+    @TableField("school_name")
+    @ApiModelProperty(value = "所属驾校名称")
+    private String schoolName;
+
+    /** 直接收益金额,单位分 */
+    @Excel(name = "直接收益金额,单位分")
+    @TableField("profit_price")
+    @ApiModelProperty(value = "直接收益金额,单位分")
+    private Long profitPrice;
+
+    /** 未结算推广积分 */
+    @Excel(name = "未结算推广积分")
+    @TableField("achievement")
+    @ApiModelProperty(value = "未结算推广积分")
+    private Long achievement;
+
+    /** 已结算推广积分 */
+    @Excel(name = "已结算推广积分")
+    @TableField("achievement_settled")
+    @ApiModelProperty(value = "已结算推广积分")
+    private Long achievementSettled;
+
+    /** unionid */
+    @Excel(name = "unionid")
+    @TableField("union_id")
+    @ApiModelProperty(value = "unionid")
+    private String unionId;
+
+    /** 小程序openid */
+    @Excel(name = "小程序openid")
+    @TableField("xcx_openid")
+    @ApiModelProperty(value = "小程序openid")
+    private String xcxOpenid;
+
+    public void setId(Long id){
+        this.id = id;
+    }
+
+    public Long getId(){
+        return id;
+    }
+    public void setPhone(String phone){
+        this.phone = phone;
+    }
+
+    public String getPhone(){
+        return phone;
+    }
+    public void setWechar(String wechar){
+        this.wechar = wechar;
+    }
+
+    public String getWechar(){
+        return wechar;
+    }
+    public void setHeadImage(String headImage){
+        this.headImage = headImage;
+    }
+
+    public String getHeadImage(){
+        return headImage;
+    }
+    public void setNickName(String nickName){
+        this.nickName = nickName;
+    }
+
+    public String getNickName(){
+        return nickName;
+    }
+    public void setRealName(String realName){
+        this.realName = realName;
+    }
+
+    public String getRealName(){
+        return realName;
+    }
+    public void setOpenid(String openid){
+        this.openid = openid;
+    }
+
+    public String getOpenid(){
+        return openid;
+    }
+    public void setStatus(Integer status){
+        this.status = status;
+    }
+
+    public Integer getStatus(){
+        return status;
+    }
+    public void setExpireTime(Date expireTime){
+        this.expireTime = expireTime;
+    }
+
+    public Date getExpireTime(){
+        return expireTime;
+    }
+    public void setSaleType(Integer saleType){
+        this.saleType = saleType;
+    }
+
+    public Integer getSaleType(){
+        return saleType;
+    }
+    public void setCityName(String cityName){
+        this.cityName = cityName;
+    }
+
+    public String getCityName(){
+        return cityName;
+    }
+    public void setAreaName(String areaName){
+        this.areaName = areaName;
+    }
+
+    public String getAreaName(){
+        return areaName;
+    }
+    public void setSchoolName(String schoolName){
+        this.schoolName = schoolName;
+    }
+
+    public String getSchoolName(){
+        return schoolName;
+    }
+    public void setProfitPrice(Long profitPrice){
+        this.profitPrice = profitPrice;
+    }
+
+    public Long getProfitPrice(){
+        return profitPrice;
+    }
+    public void setAchievement(Long achievement){
+        this.achievement = achievement;
+    }
+
+    public Long getAchievement(){
+        return achievement;
+    }
+    public void setAchievementSettled(Long achievementSettled){
+        this.achievementSettled = achievementSettled;
+    }
+
+    public Long getAchievementSettled(){
+        return achievementSettled;
+    }
+    public void setUnionId(String unionId){
+        this.unionId = unionId;
+    }
+
+    public String getUnionId(){
+        return unionId;
+    }
+    public void setXcxOpenid(String xcxOpenid){
+        this.xcxOpenid = xcxOpenid;
+    }
+
+    public String getXcxOpenid(){
+        return xcxOpenid;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("phone", getPhone())
+            .append("wechar", getWechar())
+            .append("headImage", getHeadImage())
+            .append("nickName", getNickName())
+            .append("realName", getRealName())
+            .append("openid", getOpenid())
+            .append("createTime", getCreateTime())
+            .append("updateTime", getUpdateTime())
+            .append("status", getStatus())
+            .append("expireTime", getExpireTime())
+            .append("saleType", getSaleType())
+            .append("cityName", getCityName())
+            .append("areaName", getAreaName())
+            .append("schoolName", getSchoolName())
+            .append("profitPrice", getProfitPrice())
+            .append("achievement", getAchievement())
+            .append("achievementSettled", getAchievementSettled())
+            .append("unionId", getUnionId())
+            .append("xcxOpenid", getXcxOpenid())
+            .toString();
+    }
+}

+ 22 - 4
fx-common/src/main/java/com/miaxis/common/core/domain/model/LoginUser.java

@@ -2,6 +2,7 @@ package com.miaxis.common.core.domain.model;
 
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.miaxis.common.core.domain.entity.CoachInfo;
 import com.miaxis.common.core.domain.entity.SysUser;
 import com.miaxis.common.core.domain.entity.UserInfo;
 import io.swagger.annotations.ApiModel;
@@ -76,6 +77,12 @@ public class LoginUser implements UserDetails
     @ApiModelProperty(value = "用户信息")
     private SysUser user;
 
+    /**
+     * 教练信息
+     */
+    @ApiModelProperty(value = "教练信息")
+    private CoachInfo coach;
+
     /**
      * 学员信息
      */
@@ -85,6 +92,9 @@ public class LoginUser implements UserDetails
     public LoginUser(UserInfo student) {
         this.student = student;
     }
+    public LoginUser(CoachInfo coachInfo) {
+        this.coach = coachInfo;
+    }
 
     public String getToken()
     {
@@ -257,6 +267,10 @@ public class LoginUser implements UserDetails
     {
         return this.student;
     }
+    public CoachInfo getCoach()
+    {
+        return this.coach;
+    }
 
     public void setStudent(UserInfo student)
     {
@@ -269,10 +283,14 @@ public class LoginUser implements UserDetails
             List<SimpleGrantedAuthority> roleList = new ArrayList<SimpleGrantedAuthority>();
             roleList.add(new SimpleGrantedAuthority("ROLE_STUDENT"));
             //如果已激活,是vip的话
-            Date expireTime = this.getStudent().getExpireTime();
-            if (expireTime != null && expireTime.getTime() > System.currentTimeMillis()){
-                roleList.add(new SimpleGrantedAuthority("ROLE_VIP"));
-            }
+//            Date expireTime = this.getStudent().getExpireTime();
+//            if (expireTime != null && expireTime.getTime() > System.currentTimeMillis()){
+//                roleList.add(new SimpleGrantedAuthority("ROLE_VIP"));
+//            }
+            return roleList;
+        }else if (this.getCoach() != null){
+            List<SimpleGrantedAuthority> roleList = new ArrayList<SimpleGrantedAuthority>();
+            roleList.add(new SimpleGrantedAuthority("ROLE_COACH"));
             return roleList;
         }else {
             return null;

+ 1 - 1
fx-common/src/main/java/com/miaxis/common/enums/StudentLoginTypeEnum.java

@@ -7,7 +7,7 @@ package com.miaxis.common.enums;
  */
 public enum StudentLoginTypeEnum
 {
-    AUTHORIZATION_CODE_LOGIN("1", "公众号授权码登录"),
+    AUTHORIZATION_CODE_LOGIN("1", "h5授权码登录"),
     AUTHORIZATION_XCX_LOGIN("2", "小程序登录");
 
     private final String code;

+ 19 - 13
fx-framework/src/main/java/com/miaxis/framework/web/service/UserDetailsServiceImpl.java

@@ -1,5 +1,6 @@
 package com.miaxis.framework.web.service;
 
+import com.miaxis.common.core.domain.entity.CoachInfo;
 import com.miaxis.common.core.domain.entity.SysUser;
 import com.miaxis.common.core.domain.entity.UserInfo;
 import com.miaxis.common.core.domain.model.LoginUser;
@@ -63,21 +64,21 @@ public class UserDetailsServiceImpl implements UserDetailsService
             return createLoginUser(user);
         } else if (StudentLoginTypeEnum.AUTHORIZATION_CODE_LOGIN.getCode().equals(loginType)){
             {
-                UserInfo userInfo = userService.getStudentByUnionid(identification);
-                if (userInfo == null) {
-                    userInfo = new UserInfo();
-                    userInfo.setHeadImage((String) ServletUtils.getRequest().getAttribute("headImage"));
-                    userInfo.setNickName((String) ServletUtils.getRequest().getAttribute("nickName"));
-                    userInfo.setOpenid((String) ServletUtils.getRequest().getAttribute("openid"));
-                    userInfo.setUnionId(identification);
-                    userService.saveUserInfo(userInfo);
+                CoachInfo coachInfo = userService.getCoachByUnionid(identification);
+                if (coachInfo == null) {
+                    coachInfo = new CoachInfo();
+                    coachInfo.setHeadImage((String) ServletUtils.getRequest().getAttribute("headImage"));
+                    coachInfo.setNickName((String) ServletUtils.getRequest().getAttribute("nickName"));
+                    coachInfo.setOpenid((String) ServletUtils.getRequest().getAttribute("openid"));
+                    coachInfo.setUnionId(identification);
+                    userService.saveCoachInfo(coachInfo);
                 }else {
-                    userInfo.setHeadImage((String) ServletUtils.getRequest().getAttribute("headImage"));
-                    userInfo.setNickName((String) ServletUtils.getRequest().getAttribute("nickName"));
-                    userInfo.setOpenid((String) ServletUtils.getRequest().getAttribute("openid"));
-                    userService.updateStudent(userInfo);
+                    coachInfo.setHeadImage((String) ServletUtils.getRequest().getAttribute("headImage"));
+                    coachInfo.setNickName((String) ServletUtils.getRequest().getAttribute("nickName"));
+                    coachInfo.setOpenid((String) ServletUtils.getRequest().getAttribute("openid"));
+                    userService.updateCoach(coachInfo);
                 }
-                return createLoginUser(identification);
+                return createLoginUserAsCoach(identification);
             }
         }else if (StudentLoginTypeEnum.AUTHORIZATION_XCX_LOGIN.getCode().equals(loginType)){
             {
@@ -101,6 +102,11 @@ public class UserDetailsServiceImpl implements UserDetailsService
 
     }
 
+    private UserDetails createLoginUserAsCoach(String identification) {
+        CoachInfo coachInfo = userService.getCoachByUnionid(identification);
+        return new LoginUser(coachInfo);
+    }
+
     private UserDetails createLoginUser(String identification) {
         UserInfo userInfo = userService.getStudentByUnionid(identification);
         return new LoginUser(userInfo);

+ 22 - 0
fx-service/src/main/java/com/miaxis/coach/mapper/CoachInfoMapper.java

@@ -0,0 +1,22 @@
+package com.miaxis.coach.mapper;
+
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.miaxis.common.core.domain.entity.CoachInfo;
+
+/**
+ * 教练用户Mapper接口
+ *
+ * @author miaxis
+ * @date 2022-05-10
+ */
+public interface CoachInfoMapper extends BaseMapper<CoachInfo> {
+    /**
+     * 查询教练用户列表
+     *
+     * @param coachInfo 教练用户
+     * @return 教练用户集合
+     */
+    public List<CoachInfo> selectCoachInfoList(CoachInfo coachInfo);
+
+}

+ 21 - 0
fx-service/src/main/java/com/miaxis/coach/service/ICoachInfoService.java

@@ -0,0 +1,21 @@
+package com.miaxis.coach.service;
+
+import java.util.List;
+import com.miaxis.common.core.domain.entity.CoachInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 教练用户Service接口
+ *
+ * @author miaxis
+ * @date 2022-05-10
+ */
+public interface ICoachInfoService extends IService<CoachInfo>{
+    /**
+     * 查询教练用户列表
+     *
+     * @param coachInfo 教练用户
+     * @return 教练用户集合
+     */
+    public List<CoachInfo> selectCoachInfoList(CoachInfo coachInfo);
+}

+ 32 - 0
fx-service/src/main/java/com/miaxis/coach/service/impl/CoachInfoServiceImpl.java

@@ -0,0 +1,32 @@
+package com.miaxis.coach.service.impl;
+
+import java.util.List;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.miaxis.coach.mapper.CoachInfoMapper;
+import com.miaxis.common.core.domain.entity.CoachInfo;
+import com.miaxis.coach.service.ICoachInfoService;
+
+/**
+ * 教练用户Service业务层处理
+ *
+ * @author miaxis
+ * @date 2022-05-10
+ */
+@Service
+public class CoachInfoServiceImpl extends ServiceImpl<CoachInfoMapper, CoachInfo> implements ICoachInfoService {
+    @Autowired
+    private CoachInfoMapper coachInfoMapper;
+
+    /**
+     * 查询教练用户列表
+     *
+     * @param coachInfo 教练用户
+     * @return 教练用户
+     */
+    @Override
+    public List<CoachInfo> selectCoachInfoList(CoachInfo coachInfo){
+        return coachInfoMapper.selectCoachInfoList(coachInfo);
+    }
+}

+ 7 - 1
fx-service/src/main/java/com/miaxis/wx/domain/WxOrder.java

@@ -104,7 +104,7 @@ public class WxOrder extends BaseBusinessEntity {
     @ApiModelProperty(value = "用户在直连商户appid下的唯一标识")
     private String openid;
 
-    /** 驾校班型Id */
+
     @Excel(name = "联合id")
     @TableField("union_id")
     @ApiModelProperty(value = "联合id")
@@ -173,6 +173,12 @@ public class WxOrder extends BaseBusinessEntity {
     private String orderStatus;
 
 
+    /** 驾校班型Id */
+    @Excel(name = "订单分配的教练unionid")
+    @TableField("coach_union_id")
+    @ApiModelProperty(value = "订单分配的教练unionid")
+    private String coachUnionId;
+
 
 
 }

+ 57 - 0
fx-service/src/main/resources/mapper/coach/CoachInfoMapper.xml

@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.miaxis.coach.mapper.CoachInfoMapper">
+
+    <resultMap type="CoachInfo" id="CoachInfoResult">
+        <result property="id"    column="id"    />
+        <result property="phone"    column="phone"    />
+        <result property="wechar"    column="wechar"    />
+        <result property="headImage"    column="head_image"    />
+        <result property="nickName"    column="nick_name"    />
+        <result property="realName"    column="real_name"    />
+        <result property="openid"    column="openid"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="status"    column="status"    />
+        <result property="expireTime"    column="expire_time"    />
+        <result property="saleType"    column="sale_type"    />
+        <result property="cityName"    column="city_name"    />
+        <result property="areaName"    column="area_name"    />
+        <result property="schoolName"    column="school_name"    />
+        <result property="profitPrice"    column="profit_price"    />
+        <result property="achievement"    column="achievement"    />
+        <result property="achievementSettled"    column="achievement_settled"    />
+        <result property="unionId"    column="union_id"    />
+        <result property="xcxOpenid"    column="xcx_openid"    />
+    </resultMap>
+
+    <sql id="selectCoachInfoVo">
+        select * from coach_info
+    </sql>
+
+    <select id="selectCoachInfoList" parameterType="CoachInfo" resultMap="CoachInfoResult">
+        <include refid="selectCoachInfoVo"/>
+        <where>
+            <if test="phone != null  and phone != ''"> and phone = #{phone}</if>
+            <if test="wechar != null  and wechar != ''"> and wechar = #{wechar}</if>
+            <if test="headImage != null  and headImage != ''"> and head_image = #{headImage}</if>
+            <if test="nickName != null  and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
+            <if test="realName != null  and realName != ''"> and real_name like concat('%', #{realName}, '%')</if>
+            <if test="openid != null  and openid != ''"> and openid = #{openid}</if>
+            <if test="status != null "> and status = #{status}</if>
+            <if test="expireTime != null "> and expire_time = #{expireTime}</if>
+            <if test="saleType != null "> and sale_type = #{saleType}</if>
+            <if test="cityName != null  and cityName != ''"> and city_name like concat('%', #{cityName}, '%')</if>
+            <if test="areaName != null  and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if>
+            <if test="schoolName != null  and schoolName != ''"> and school_name like concat('%', #{schoolName}, '%')</if>
+            <if test="profitPrice != null "> and profit_price = #{profitPrice}</if>
+            <if test="achievement != null "> and achievement = #{achievement}</if>
+            <if test="achievementSettled != null "> and achievement_settled = #{achievementSettled}</if>
+            <if test="unionId != null  and unionId != ''"> and union_id = #{unionId}</if>
+            <if test="xcxOpenid != null  and xcxOpenid != ''"> and xcx_openid = #{xcxOpenid}</if>
+        </where>
+    </select>
+
+</mapper>

+ 7 - 0
fx-system/src/main/java/com/miaxis/system/mapper/SysUserMapper.java

@@ -1,5 +1,6 @@
 package com.miaxis.system.mapper;
 
+import com.miaxis.common.core.domain.entity.CoachInfo;
 import com.miaxis.common.core.domain.entity.SysUser;
 import com.miaxis.common.core.domain.entity.UserInfo;
 import com.miaxis.common.core.domain.vo.AgentVO;
@@ -127,4 +128,10 @@ public interface SysUserMapper
     UserInfo getStudentByUnionid(String identification);
 
     void updateXcxOpenid(UserInfo userInfo);
+
+    CoachInfo getCoachByUnionid(String identification);
+
+    void saveCoachInfo(CoachInfo coachInfo);
+
+    void updateCoach(CoachInfo coachInfo);
 }

+ 7 - 0
fx-system/src/main/java/com/miaxis/system/service/ISysUserService.java

@@ -1,5 +1,6 @@
 package com.miaxis.system.service;
 
+import com.miaxis.common.core.domain.entity.CoachInfo;
 import com.miaxis.common.core.domain.entity.SysUser;
 import com.miaxis.common.core.domain.entity.UserInfo;
 import com.miaxis.common.core.domain.vo.AgentVO;
@@ -188,4 +189,10 @@ public interface ISysUserService
     UserInfo getStudentByUnionid(String identification);
 
     void updateXcxOpenid(UserInfo userInfo);
+
+    CoachInfo getCoachByUnionid(String identification);
+
+    void saveCoachInfo(CoachInfo coachInfo);
+
+    void updateCoach(CoachInfo coachInfo);
 }

+ 15 - 0
fx-system/src/main/java/com/miaxis/system/service/impl/SysUserServiceImpl.java

@@ -2,6 +2,7 @@ package com.miaxis.system.service.impl;
 
 import com.miaxis.common.annotation.DataScope;
 import com.miaxis.common.constant.UserConstants;
+import com.miaxis.common.core.domain.entity.CoachInfo;
 import com.miaxis.common.core.domain.entity.SysRole;
 import com.miaxis.common.core.domain.entity.SysUser;
 import com.miaxis.common.core.domain.entity.UserInfo;
@@ -468,6 +469,10 @@ public class SysUserServiceImpl implements ISysUserService
     public void updateStudent(UserInfo userInfo) {
         userMapper.updateStudent(userInfo);
     }
+    @Override
+    public void updateCoach(CoachInfo coachInfo) {
+        userMapper.updateCoach(coachInfo);
+    }
 
     @Override
     public List<AgentVO> getAgentList(Long roleId, String agentName) {
@@ -488,4 +493,14 @@ public class SysUserServiceImpl implements ISysUserService
     public void updateXcxOpenid(UserInfo userInfo) {
         userMapper.updateXcxOpenid(userInfo);
     }
+
+    @Override
+    public CoachInfo getCoachByUnionid(String identification) {
+        return userMapper.getCoachByUnionid(identification);
+    }
+
+    @Override
+    public void saveCoachInfo(CoachInfo coachInfo) {
+        userMapper.saveCoachInfo(coachInfo);
+    }
 }

+ 15 - 0
fx-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -99,6 +99,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		select * from user_info
 		where union_id = #{unionId}
 	</select>
+	<select id="getCoachByUnionid" parameterType="String" resultType="com.miaxis.common.core.domain.entity.CoachInfo">
+		select * from coach_info
+		where union_id = #{unionId}
+	</select>
 	<select id="getStudentByName" parameterType="String" resultType="com.miaxis.common.core.domain.entity.UserInfo">
 		select * from user_info
 		where name = #{name}
@@ -107,6 +111,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		insert into user_info (head_image,nick_name,openid,xcx_openid,union_id)
 		 values (#{headImage},#{nickName},#{openid},#{xcxOpenid},#{unionId})
 	</insert>
+	<insert id="saveCoachInfo" parameterType="com.miaxis.common.core.domain.entity.CoachInfo" >
+		insert into coach_info (head_image,nick_name,openid,xcx_openid,union_id)
+		 values (#{headImage},#{nickName},#{openid},#{xcxOpenid},#{unionId})
+	</insert>
 	<insert id="updateStudent" parameterType="com.miaxis.common.core.domain.entity.UserInfo" >
 		update user_info set
 			head_image = #{headImage},
@@ -114,6 +122,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			openid = #{openid}
 		where union_id = #{unionId}
 	</insert>
+	<insert id="updateCoach" parameterType="com.miaxis.common.core.domain.entity.CoachInfo" >
+		update coach_info set
+			head_image = #{headImage},
+			nick_name = #{nickName},
+			openid = #{openid}
+		where union_id = #{unionId}
+	</insert>
 	<insert id="updateXcxOpenid" parameterType="com.miaxis.common.core.domain.entity.UserInfo" >
 		update user_info set
 			xcx_openid = #{xcxOpenid}