parent
6a48f99f03
commit
0cb323c876
11 changed files with 574 additions and 12 deletions
@ -0,0 +1,96 @@ |
||||
package com.daqing.financial.crms.controller; |
||||
|
||||
import com.daqing.financial.crms.model.request.CompanyCustomerRequest; |
||||
import com.daqing.financial.crms.model.request.PersonalCustomerRequest; |
||||
import com.daqing.financial.crms.service.CustomerAppletService; |
||||
import com.daqing.framework.domain.crms.ext.CustomerPersonalTOI; |
||||
import com.daqing.framework.model.response.ResponseResult; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.validation.Valid; |
||||
|
||||
/** |
||||
* 小程序客户模块数据录入(认证) |
||||
* |
||||
* @auther River |
||||
* @date 2021/1/28 14:08 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/customer/applet") |
||||
@Api(value = "客户数据录入(认证)", tags = "小程序客户数据录入(认证)") |
||||
public class CustomerAppletController { |
||||
|
||||
@Autowired |
||||
private CustomerAppletService customerAppletService; |
||||
|
||||
/** |
||||
* 个人类型客户数据录入(认证) |
||||
*/ |
||||
@PostMapping("/save/personal") |
||||
@ApiOperation(value = "个人类型客户数据录入(认证)") |
||||
public ResponseResult savePersonal(@RequestBody @Valid CustomerPersonalTOI customerPersonalTOI) { |
||||
|
||||
Boolean result = customerAppletService.savePersonal(customerPersonalTOI); |
||||
|
||||
return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL(); |
||||
} |
||||
|
||||
/** |
||||
* 企业类型客户数据录入(认证) |
||||
*/ |
||||
@PostMapping("/save/company") |
||||
@ApiOperation(value = "企业类型客户数据录入(认证)") |
||||
public ResponseResult saveCompany(@RequestBody @Valid CompanyCustomerRequest companyCustomerRequest) { |
||||
|
||||
Boolean result = customerAppletService.saveCompany(companyCustomerRequest); |
||||
|
||||
return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL(); |
||||
} |
||||
|
||||
/** |
||||
* 获取当前客户认证状态 |
||||
*/ |
||||
@GetMapping("/get/status") |
||||
@ApiOperation(value = "获取当前客户认证状态") |
||||
public ResponseResult getCustomerStatus() { |
||||
|
||||
return ResponseResult.SUCCESS(customerAppletService.getCustomerStatus()); |
||||
} |
||||
|
||||
/** |
||||
* 获取已认证的客户信息 |
||||
*/ |
||||
@GetMapping("/get/customer") |
||||
@ApiOperation(value = "获取已认证的客户信息") |
||||
public ResponseResult getCustomer(@RequestParam("type") Integer type) { |
||||
|
||||
return customerAppletService.getCustomer(type); |
||||
} |
||||
|
||||
/** |
||||
* 更新个人类型客户信息 |
||||
*/ |
||||
@ApiOperation(value = "更新个人类型的客户信息") |
||||
@PostMapping("/update/personal") |
||||
public ResponseResult updatePersonal(@RequestBody @Valid PersonalCustomerRequest personalCustomerRequest) { |
||||
|
||||
Boolean result = customerAppletService.updatePersonal(personalCustomerRequest); |
||||
|
||||
return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL(); |
||||
} |
||||
|
||||
/** |
||||
* 更新企业类型的客户信息 |
||||
*/ |
||||
@PostMapping("/update/company") |
||||
@ApiOperation(value = "更新企业类型的客户信息") |
||||
public ResponseResult updateCompany(@RequestBody @Valid CompanyCustomerRequest companyCustomerRequest) { |
||||
|
||||
Boolean result = customerAppletService.updateCompany(companyCustomerRequest); |
||||
|
||||
return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL(); |
||||
} |
||||
} |
@ -0,0 +1,24 @@ |
||||
package com.daqing.financial.crms.dao; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.daqing.framework.domain.crms.CustomerEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
/** |
||||
* 客户小程序认证(录入) |
||||
* |
||||
* @auther River |
||||
* @date 2021/1/27 15:54 |
||||
*/ |
||||
@Mapper |
||||
public interface CustomerAppletDao extends BaseMapper<CustomerEntity> { |
||||
|
||||
Boolean saveCustomerIdAndUserId(@Param("customerId") Integer customerId, @Param("userId") Integer userId, |
||||
@Param("type") Integer type); |
||||
|
||||
Integer getCustomerStatus(@Param("userId") Integer userId, @Param("type") Integer type); |
||||
|
||||
Integer getCustomerId(@Param("userId") Integer userId, @Param("type") Integer type); |
||||
|
||||
} |
@ -0,0 +1,163 @@ |
||||
package com.daqing.financial.crms.model.request; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import lombok.ToString; |
||||
|
||||
import javax.validation.constraints.Max; |
||||
import javax.validation.constraints.Min; |
||||
import javax.validation.constraints.NotNull; |
||||
import javax.validation.constraints.Pattern; |
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* 小程序客户模块个人类型数据录入(认证) |
||||
* |
||||
* @auther River |
||||
* @date 2021/1/28 11:44 |
||||
*/ |
||||
@Data |
||||
@ToString |
||||
public class PersonalCustomerRequest implements Serializable { |
||||
|
||||
/** |
||||
* 主键 |
||||
*/ |
||||
@ApiModelProperty(value = "id") |
||||
@TableId(value = "id", type = IdType.INPUT) |
||||
private Long id; |
||||
/** |
||||
* 客户编号 |
||||
*/ |
||||
@NotNull(message = "客户编号不能为空") |
||||
@ApiModelProperty(value = "客户编号") |
||||
private String code; |
||||
/** |
||||
* 客户类型:1、企业类型,0:个人类型 |
||||
*/ |
||||
@ApiModelProperty(value = "客户类型") |
||||
private Integer type; |
||||
/** |
||||
* 客户的经理人id |
||||
*/ |
||||
@ApiModelProperty(value = "客户经理人id") |
||||
private Long manager; |
||||
/** |
||||
* 客户名称 |
||||
*/ |
||||
@NotNull(message = "客户名称不能为空") |
||||
@ApiModelProperty(value = "客户名称") |
||||
private String name; |
||||
/** |
||||
* 联系地址 |
||||
*/ |
||||
@NotNull(message = "联系地址不能为空") |
||||
@ApiModelProperty(value = "联系地址") |
||||
private String addr; |
||||
/** |
||||
* 联系电话 |
||||
*/ |
||||
@Pattern(regexp = "^[0-9]*$",message = "联系电话格式错误") |
||||
@NotNull(message = "联系电话不能为空") |
||||
@ApiModelProperty(value = "联系电话") |
||||
private String phone; |
||||
/** |
||||
* 身份证号 |
||||
*/ |
||||
@NotNull(message = "身份证号不能为空") |
||||
@ApiModelProperty(value = "身份证号") |
||||
private String idCard; |
||||
/** |
||||
* 年龄 |
||||
*/ |
||||
@NotNull(message = "年龄不能为空") |
||||
@ApiModelProperty(value = "年龄") |
||||
private Integer age; |
||||
/** |
||||
* 性别:1、男,0、女 |
||||
*/ |
||||
@Min(value = 0,message = "性别格式有误") |
||||
@Max(value = 1,message = "性别格式有误") |
||||
@NotNull(message = "性别不能为空") |
||||
@ApiModelProperty(value = "性别") |
||||
private Integer gender; |
||||
/** |
||||
* 婚姻状况,0:未婚,1:已婚,2:离异,3:再婚 |
||||
*/ |
||||
@Min(value = 0,message = "婚姻状况格式有误") |
||||
@Max(value = 3,message = "婚姻状况格式有误") |
||||
@NotNull(message = "婚姻状况不能为空") |
||||
@ApiModelProperty(value = "婚姻状况") |
||||
private Integer maritalStatus; |
||||
/** |
||||
* 学历,0:本科,1:大专,2:高职,3:中专,4:其他 |
||||
*/ |
||||
@Min(value = 0,message = "学历格式有误") |
||||
@Max(value = 4,message = "学历格式有误") |
||||
@NotNull(message = "学历不能为空") |
||||
@ApiModelProperty(value = "学历") |
||||
private Integer education; |
||||
/** |
||||
* 工作单位 |
||||
*/ |
||||
@NotNull(message = "工作单位不能为空") |
||||
@ApiModelProperty(value = "工作单位") |
||||
private String employer; |
||||
/** |
||||
* 职务 |
||||
*/ |
||||
@NotNull(message = "职务不能为空") |
||||
@ApiModelProperty(value = "职务") |
||||
private String position; |
||||
/** |
||||
* 工作年限 |
||||
*/ |
||||
@NotNull(message = "工作年限不能为空") |
||||
@ApiModelProperty(value = "工作年限") |
||||
private Integer workingYears; |
||||
/** |
||||
* 社保账号 |
||||
*/ |
||||
@NotNull(message = "社保账号不能为空") |
||||
@ApiModelProperty(value = "社保账号") |
||||
private String socialSecurityNum; |
||||
/** |
||||
* 居住情况 |
||||
*/ |
||||
@NotNull(message = "居住情况不能为空") |
||||
@ApiModelProperty(value = "居住情况") |
||||
private String livingSituation; |
||||
/** |
||||
* 户籍地址 |
||||
*/ |
||||
@NotNull(message = "户籍地址不能为空") |
||||
@ApiModelProperty(value = "户籍地址") |
||||
private String residenceAddr; |
||||
/** |
||||
* 业务来源 |
||||
*/ |
||||
@NotNull(message = "业务来源不能为空") |
||||
@ApiModelProperty(value = "业务来源") |
||||
private String businessSource; |
||||
/** |
||||
* 紧急联系人 |
||||
*/ |
||||
@NotNull(message = "紧急联系人不能为空") |
||||
@ApiModelProperty(value = "紧急联系人") |
||||
private String emergencyLinkman; |
||||
/** |
||||
* 紧急联系人关系 |
||||
*/ |
||||
@NotNull(message = "紧急联系人关系不能为空") |
||||
@ApiModelProperty(value = "紧急联系人关系") |
||||
private String emergencyLinkmanRelationship; |
||||
/** |
||||
* 紧急联系人电话 |
||||
*/ |
||||
@Pattern(regexp = "^[0-9]*$",message = "紧急联系人电话格式错误") |
||||
@NotNull(message = "紧急联系人电话不能为空") |
||||
@ApiModelProperty(value = "紧急联系人电话") |
||||
private String emergencyLinkmanPhone; |
||||
} |
@ -0,0 +1,31 @@ |
||||
package com.daqing.financial.crms.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.daqing.financial.crms.model.request.CompanyCustomerRequest; |
||||
import com.daqing.financial.crms.model.request.PersonalCustomerRequest; |
||||
import com.daqing.framework.domain.crms.CustomerEntity; |
||||
import com.daqing.framework.domain.crms.ext.CustomerPersonalTOI; |
||||
import com.daqing.framework.model.response.ResponseResult; |
||||
|
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 客户小程序认证(数据录入) |
||||
* |
||||
* @auther River |
||||
* @date 2021/1/27 15:51 |
||||
*/ |
||||
public interface CustomerAppletService extends IService<CustomerEntity> { |
||||
|
||||
Boolean savePersonal(CustomerPersonalTOI customerPersonalTOI); |
||||
|
||||
Boolean saveCompany(CompanyCustomerRequest companyCustomerRequest); |
||||
|
||||
Map getCustomerStatus(); |
||||
|
||||
ResponseResult getCustomer(Integer type); |
||||
|
||||
Boolean updatePersonal(PersonalCustomerRequest personalCustomerRequest); |
||||
|
||||
Boolean updateCompany(CompanyCustomerRequest companyCustomerRequest); |
||||
} |
@ -0,0 +1,235 @@ |
||||
package com.daqing.financial.crms.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.daqing.financial.crms.dao.CompanyCustomerDao; |
||||
import com.daqing.financial.crms.dao.CustomerAppletDao; |
||||
import com.daqing.financial.crms.dao.CustomerDao; |
||||
import com.daqing.financial.crms.dao.PersonalCustomerDao; |
||||
import com.daqing.financial.crms.model.request.CompanyCustomerRequest; |
||||
import com.daqing.financial.crms.model.request.PersonalCustomerRequest; |
||||
import com.daqing.financial.crms.service.CustomerAppletService; |
||||
import com.daqing.financial.crms.service.CustomerService; |
||||
import com.daqing.financial.crms.service.ICrmsCustomerRelatedService; |
||||
import com.daqing.framework.domain.crms.CompanyCustomerEntity; |
||||
import com.daqing.framework.domain.crms.CrmsCustomerRelated; |
||||
import com.daqing.framework.domain.crms.CustomerEntity; |
||||
import com.daqing.framework.domain.crms.PersonalCustomerEntity; |
||||
import com.daqing.framework.domain.crms.ext.CrmsConstant; |
||||
import com.daqing.framework.domain.crms.ext.CustomerPersonalTOI; |
||||
import com.daqing.framework.domain.crms.ext.CustomerPersonalTOU; |
||||
import com.daqing.framework.domain.crms.response.CrmsCode; |
||||
import com.daqing.framework.exception.ExceptionCast; |
||||
import com.daqing.framework.model.response.CommonCode; |
||||
import com.daqing.framework.model.response.PromptSuccess; |
||||
import com.daqing.framework.model.response.ResponseResult; |
||||
import com.daqing.framework.util.RedisUtil; |
||||
import org.springframework.beans.BeanUtils; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
import org.springframework.web.context.request.RequestContextHolder; |
||||
import org.springframework.web.context.request.ServletRequestAttributes; |
||||
|
||||
import javax.servlet.http.HttpServletRequest; |
||||
import java.util.*; |
||||
|
||||
/** |
||||
* 客户小程序认证(录入) |
||||
* |
||||
* @auther River |
||||
* @date 2021/1/27 15:53 |
||||
*/ |
||||
@Service |
||||
public class CustomerAppletServiceImpl extends ServiceImpl<CustomerAppletDao, CustomerEntity> implements CustomerAppletService { |
||||
|
||||
|
||||
@Autowired |
||||
private CustomerDao customerDao; |
||||
|
||||
@Autowired |
||||
private PersonalCustomerDao personalCustomerDao; |
||||
|
||||
@Autowired |
||||
private CustomerService customerService; |
||||
|
||||
@Autowired |
||||
private CompanyCustomerDao companyCustomerDao; |
||||
|
||||
@Autowired |
||||
private ICrmsCustomerRelatedService crmsCustomerRelatedService; |
||||
|
||||
/** |
||||
* 录入(认证)个人类型客户数据 |
||||
*/ |
||||
@Transactional |
||||
@Override |
||||
public Boolean savePersonal(CustomerPersonalTOI customerPersonalTOI) { |
||||
if (customerPersonalTOI.getName() != null && customerPersonalTOI.getName().length() != 0) { |
||||
// 客户姓名判重
|
||||
List<String> names = customerDao.listCustomerName(0); // 个人类型客户名称
|
||||
for (String name : names) { |
||||
if (customerPersonalTOI.getName().equals(name)) { |
||||
ExceptionCast.cast(CrmsCode.CUSTOMER_NAME_REPETITION); |
||||
} |
||||
} |
||||
} |
||||
CustomerEntity customerEntity = new CustomerEntity(); |
||||
PersonalCustomerEntity personalCustomerEntity = new PersonalCustomerEntity(); |
||||
BeanUtils.copyProperties(customerPersonalTOI, customerEntity); |
||||
BeanUtils.copyProperties(customerPersonalTOI, personalCustomerEntity); |
||||
// 设置客户编号
|
||||
String code = customerDao.getCodeByType(CrmsConstant.CustomerType.PERSONAL_CUSTOMER.getType()); |
||||
if (code == null || code.length() == 0) { |
||||
code = PromptSuccess.PERSONAL_START_CODE; |
||||
} |
||||
int codeNumber = Integer.parseInt(code.substring(code.length() - 4)); |
||||
customerEntity.setCode(PromptSuccess.PERSONAL_CODE + String.format("%04d", (codeNumber + 1))); |
||||
customerEntity.setCreateTime(new Date()); |
||||
customerEntity.setMotifyTime(new Date()); |
||||
customerEntity.setType(CrmsConstant.CustomerType.PERSONAL_CUSTOMER.getType()); |
||||
boolean customer = customerDao.saveCustomer(customerEntity); |
||||
personalCustomerEntity.setCustomerId(customerEntity.getId()); |
||||
// 将自增的客户id返回给工作台
|
||||
customerPersonalTOI.setManager(customerEntity.getId()); |
||||
boolean personal = personalCustomerDao.savePersonalCustomer(personalCustomerEntity); |
||||
Boolean user = this.getBaseMapper().saveCustomerIdAndUserId(customerEntity.getId().intValue(), Integer.parseInt(this.getUserId()), 0); |
||||
return customer && personal && user; |
||||
} |
||||
|
||||
/** |
||||
* 录入(认证)企业类型的客户数据 |
||||
*/ |
||||
@Transactional |
||||
@Override |
||||
public Boolean saveCompany(CompanyCustomerRequest companyCustomerReq) { |
||||
// 客户名称判重
|
||||
if (companyCustomerReq.getName() != null && companyCustomerReq.getName().length() != 0) { |
||||
List<String> names = customerDao.listCustomerName(1); // 企业类型客户名称
|
||||
for (String name : names) { |
||||
if (companyCustomerReq.getName().equals(name)) { |
||||
ExceptionCast.cast(CrmsCode.CUSTOMER_NAME_REPETITION); |
||||
} |
||||
} |
||||
} |
||||
CustomerEntity customerEntity = new CustomerEntity(); |
||||
CompanyCustomerEntity companyCustomerEntity = new CompanyCustomerEntity(); |
||||
BeanUtils.copyProperties(companyCustomerReq, customerEntity); |
||||
BeanUtils.copyProperties(companyCustomerReq, companyCustomerEntity); |
||||
// 设置客户编号
|
||||
String code = customerDao.getCodeByType(CrmsConstant.CustomerType.COMPANY_CUSTOMER.getType()); |
||||
if (code == null || code.length() == 0) { |
||||
code = PromptSuccess.COMPANY_START_CODE; |
||||
} |
||||
int codeNumber = Integer.parseInt(code.substring(code.length() - 4)); |
||||
customerEntity.setCode(PromptSuccess.COMPANY_CODE + String.format("%04d", (codeNumber + 1))); |
||||
customerEntity.setMotifyTime(new Date()); |
||||
customerEntity.setCreateTime(new Date()); |
||||
customerEntity.setManager(companyCustomerReq.getManager()); |
||||
customerEntity.setType(CrmsConstant.CustomerType.COMPANY_CUSTOMER.getType()); |
||||
boolean customer = customerDao.saveCustomer(customerEntity); |
||||
companyCustomerEntity.setCustomerId(customerEntity.getId()); |
||||
int company = companyCustomerDao.insert(companyCustomerEntity); |
||||
// 绑定客户信息和客户的用户信息
|
||||
Boolean user = this.getBaseMapper().saveCustomerIdAndUserId(customerEntity.getId().intValue(), Integer.parseInt(this.getUserId()), 1); |
||||
if (companyCustomerReq.getIsExistRelated() == 1) {//有关联人的情况下才绑定关联关系
|
||||
//绑定关联关系
|
||||
List<CrmsCustomerRelated> relatedList = new ArrayList<>(); |
||||
List<Integer> intList = companyCustomerReq.getRelatedId(); |
||||
|
||||
for (int i = 0; i < intList.size(); i++) { |
||||
CrmsCustomerRelated crmsCustomerRelated = new CrmsCustomerRelated(); |
||||
Integer integer = intList.get(i); |
||||
crmsCustomerRelated.setCustomerId(companyCustomerEntity.getId().intValue());//企业id
|
||||
crmsCustomerRelated.setRelatedId(integer);//关联人/企业id
|
||||
relatedList.add(crmsCustomerRelated); |
||||
} |
||||
crmsCustomerRelatedService.insertCustomerRelated(relatedList); |
||||
} |
||||
if (customer && company > 0 && user) { |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
/** |
||||
* 获取当前客户的认证状态 |
||||
* |
||||
* @return |
||||
*/ |
||||
@Transactional |
||||
@Override |
||||
public Map getCustomerStatus() { |
||||
Map<String, Boolean> map = new HashMap<>(); |
||||
Integer personalCount = this.getBaseMapper().getCustomerStatus(Integer.parseInt(this.getUserId()), 0); |
||||
Integer companyCount = this.getBaseMapper().getCustomerStatus(Integer.parseInt(this.getUserId()), 1); |
||||
if (personalCount > 0) { |
||||
map.put("personal", true); |
||||
} else { |
||||
map.put("personal", false); |
||||
} |
||||
if (companyCount > 0) { |
||||
map.put("company", true); |
||||
} else { |
||||
map.put("company", false); |
||||
} |
||||
return map; |
||||
} |
||||
|
||||
/** |
||||
* 查看认证的详情 |
||||
*/ |
||||
@Override |
||||
public ResponseResult getCustomer(Integer type) { |
||||
|
||||
String userId = this.getUserId(); |
||||
Integer customerId = this.getBaseMapper().getCustomerId(Integer.parseInt(userId), type); |
||||
|
||||
return customerService.queryCustomerById((long) customerId); |
||||
} |
||||
|
||||
/** |
||||
* 修改个人类型的认证信息 |
||||
*/ |
||||
@Override |
||||
public Boolean updatePersonal(PersonalCustomerRequest personalCustomerRequest) { |
||||
Integer customerId = this.getBaseMapper().getCustomerId(Integer.parseInt(this.getUserId()), 0); |
||||
if (customerId == null) { |
||||
ExceptionCast.cast(CrmsCode.CUSTOMER_APPLET_IS_NULL); |
||||
} |
||||
personalCustomerRequest.setId((long) customerId); |
||||
personalCustomerRequest.setType(0); |
||||
CustomerPersonalTOU customerPersonalTOU = new CustomerPersonalTOU(); |
||||
BeanUtils.copyProperties(personalCustomerRequest, customerPersonalTOU); |
||||
return customerService.updateCustomerPersonal(customerPersonalTOU); |
||||
} |
||||
|
||||
/** |
||||
* 修改企业类型的认证信息 |
||||
*/ |
||||
@Override |
||||
public Boolean updateCompany(CompanyCustomerRequest companyCustomerRequest) { |
||||
Integer customerId = this.getBaseMapper().getCustomerId(Integer.parseInt(this.getUserId()), 1); |
||||
if (customerId == null) { |
||||
ExceptionCast.cast(CrmsCode.CUSTOMER_APPLET_IS_NULL); |
||||
} |
||||
companyCustomerRequest.setId((long) customerId); |
||||
companyCustomerRequest.setType(1); |
||||
|
||||
return customerService.updateCompanyNew(companyCustomerRequest); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 获取当前登录用户信息 |
||||
*/ |
||||
private String getUserId() { |
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
||||
String token = request.getHeader("token"); |
||||
String userId = RedisUtil.get("dq:token:" + token); |
||||
if (userId == null || userId.length() == 0) { |
||||
ExceptionCast.cast(CommonCode.GET_LOGIN_USER_FAIL); |
||||
} |
||||
return userId; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,18 @@ |
||||
<?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.daqing.financial.crms.dao.CustomerAppletDao"> |
||||
|
||||
<insert id="saveCustomerIdAndUserId"> |
||||
INSERT INTO crms_customer_user (customer_id, user_id, type) VALUES (#{customerId}, #{userId}, #{type}) |
||||
</insert> |
||||
|
||||
<select id="getCustomerStatus" resultType="integer"> |
||||
SELECT COUNT(id) FROM crms_customer_user WHERE user_id = #{userId} AND type = #{type} |
||||
</select> |
||||
|
||||
<select id="getCustomerId" resultType="integer"> |
||||
SELECT customer_id FROM crms_customer_user WHERE user_id = #{userId} AND type = #{type} |
||||
</select> |
||||
|
||||
</mapper> |
Loading…
Reference in new issue