| @@ -0,0 +1,198 @@ | |||||
| package com.iformall.controller; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.IdWorker; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.dto.WxCUserFromBDto; | |||||
| import com.iformall.domain.po.WxCUser; | |||||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||||
| import com.iformall.domain.po.WxCUserFromB; | |||||
| import com.iformall.domain.po.WxMerchantBUser; | |||||
| import com.iformall.enums.EnumAssignTagsTrigger; | |||||
| import com.iformall.enums.EnumScoreType; | |||||
| import com.iformall.service.*; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.PostMapping; | |||||
| import org.springframework.web.bind.annotation.RequestBody; | |||||
| import org.springframework.web.bind.annotation.RequestMapping; | |||||
| import org.springframework.web.bind.annotation.RestController; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| @RestController | |||||
| @RequestMapping("/api/cuser") | |||||
| @Api(description = "B端来源用户") | |||||
| public class WxCUserController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||||
| @Autowired | |||||
| private WxScoreRulesService wxScoreRulesService; | |||||
| @Autowired | |||||
| private WxCUserTagsService wxCUserTagsService; | |||||
| @Autowired | |||||
| private WxMerchantBUserService wxMerchantBUserService; | |||||
| @Autowired | |||||
| private WxCUserFromBService wxCUserFromBService; | |||||
| @Autowired | |||||
| private WxCUserService wxCUserService; | |||||
| /** | |||||
| * 会员更新信息 | |||||
| * @return | |||||
| */ | |||||
| @PostMapping("/updateUserInfo") | |||||
| @ApiOperation(value = "用户更新信息", notes="") | |||||
| public ResultData updateUserInfo(@RequestBody WxCUserFromBDto wxCUserFromBDto) { | |||||
| logger.info("WxCUserController::updateUserInfo"); | |||||
| if (wxCUserFromBDto == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"没有传入用户信息"); | |||||
| } | |||||
| if (StringUtils.isEmpty(wxCUserFromBDto.getOpenid())){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"C端openid不能为空"); | |||||
| } | |||||
| if (wxCUserFromBDto.getbUserId()==null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"bUserId不能为空"); | |||||
| } | |||||
| //根据bUserId查询B端用户是否存在 | |||||
| WxMerchantBUser bUser = wxMerchantBUserService.getById(wxCUserFromBDto.getbUserId()); | |||||
| if(bUser==null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"B端用户不存在"); | |||||
| } | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| WxCUserFromB wxCUserFromB = wxCUserFromBService.getByOpenid(wxCUserFromBDto.getOpenid()); | |||||
| if(wxCUserFromB==null){ | |||||
| //查询C端微信信息 | |||||
| WxCUser wxCUser = new WxCUser(); | |||||
| wxCUser.setOpenId(wxCUserFromBDto.getOpenid()); | |||||
| wxCUser = wxCUserService.getByOpenId(wxCUser); | |||||
| //不存在时 | |||||
| if(wxCUser==null){ | |||||
| //新增来自B端的会员 | |||||
| long cUserId = idWorker.nextId(); | |||||
| WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo(); | |||||
| wxCUserBasicInfo.setId(cUserId); | |||||
| wxCUserBasicInfo.setName(wxCUserFromBDto.getName()); | |||||
| wxCUserBasicInfo.setBirthdate(wxCUserFromBDto.getBirthdate()); | |||||
| wxCUserBasicInfo.setSex(wxCUserFromBDto.getSex() ); | |||||
| wxCUserBasicInfo.setAddress(wxCUserFromBDto.getAddress()); | |||||
| wxCUserBasicInfo.setPhone(wxCUserFromBDto.getPhone()); | |||||
| wxCUserBasicInfo.setUpdateDate(new Date()); | |||||
| wxCUserBasicInfoService.save(wxCUserBasicInfo); | |||||
| //新增来自B端的会员关联数据 | |||||
| WxCUserFromB record = new WxCUserFromB(); | |||||
| record.setbUserId(wxCUserFromBDto.getbUserId()); | |||||
| record.setcUserId(cUserId); | |||||
| record.setOpenid(wxCUserFromBDto.getOpenid()); | |||||
| record.setMerchantId(bUser.getMerchantId()); | |||||
| record.setTenantId(bUser.getTenantId()); | |||||
| record.setInfo(JSONObject.toJSONString(wxCUserBasicInfo)); | |||||
| wxCUserFromBService.saveOrUpdate(record); | |||||
| }else{ | |||||
| String phone = wxCUser.getPhone(); | |||||
| String tenantId = wxCUser.getTenantId(); | |||||
| //查询会员信息 | |||||
| List<WxCUserBasicInfo> byPhone = wxCUserBasicInfoService.findByPhone(tenantId, phone); | |||||
| //存在会员信息 | |||||
| if(!byPhone.isEmpty()){ | |||||
| //更新会员信息 | |||||
| WxCUserBasicInfo wxCUserBasicInfo = byPhone.get(0); | |||||
| wxCUserBasicInfo.setName(wxCUserFromBDto.getName()); | |||||
| wxCUserBasicInfo.setBirthdate(wxCUserFromBDto.getBirthdate()); | |||||
| wxCUserBasicInfo.setSex(wxCUserFromBDto.getSex() ); | |||||
| wxCUserBasicInfo.setAddress(wxCUserFromBDto.getAddress()); | |||||
| wxCUserBasicInfo.setPhone(wxCUserFromBDto.getPhone()); | |||||
| wxCUserBasicInfo.setUpdateDate(new Date()); | |||||
| wxCUserBasicInfoService.update(wxCUserBasicInfo); | |||||
| wxScoreRulesService.addScore(EnumScoreType.COMPLETE_INFO, wxCUserBasicInfo); | |||||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, wxCUserBasicInfo); | |||||
| //新增来自B端的会员关联数据 | |||||
| wxCUserFromB = new WxCUserFromB(); | |||||
| wxCUserFromB.setbUserId(wxCUserFromBDto.getbUserId()); | |||||
| wxCUserFromB.setcUserId(wxCUserBasicInfo.getId()); | |||||
| wxCUserFromB.setOpenid(wxCUserFromBDto.getOpenid()); | |||||
| wxCUserFromB.setMerchantId(bUser.getMerchantId()); | |||||
| wxCUserFromB.setTenantId(bUser.getTenantId()); | |||||
| wxCUserFromB.setInfo(JSONObject.toJSONString(wxCUserBasicInfo)); | |||||
| wxCUserFromBService.saveOrUpdate(wxCUserFromB); | |||||
| }else{ | |||||
| //新增来自B端的会员 | |||||
| long cUserId = idWorker.nextId(); | |||||
| WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo(); | |||||
| wxCUserBasicInfo.setId(cUserId); | |||||
| wxCUserBasicInfo.setName(wxCUserFromBDto.getName()); | |||||
| wxCUserBasicInfo.setBirthdate(wxCUserFromBDto.getBirthdate()); | |||||
| wxCUserBasicInfo.setSex(wxCUserFromBDto.getSex() ); | |||||
| wxCUserBasicInfo.setAddress(wxCUserFromBDto.getAddress()); | |||||
| wxCUserBasicInfo.setPhone(wxCUserFromBDto.getPhone()); | |||||
| wxCUserBasicInfo.setUpdateDate(new Date()); | |||||
| wxCUserBasicInfoService.save(wxCUserBasicInfo); | |||||
| //新增来自B端的会员关联数据 | |||||
| WxCUserFromB record = new WxCUserFromB(); | |||||
| record.setbUserId(wxCUserFromBDto.getbUserId()); | |||||
| record.setcUserId(cUserId); | |||||
| record.setOpenid(wxCUserFromBDto.getOpenid()); | |||||
| record.setMerchantId(bUser.getMerchantId()); | |||||
| record.setTenantId(bUser.getTenantId()); | |||||
| record.setInfo(JSONObject.toJSONString(wxCUserBasicInfo)); | |||||
| wxCUserFromBService.saveOrUpdate(record); | |||||
| } | |||||
| } | |||||
| }else{ | |||||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(wxCUserFromB.getcUserId()); | |||||
| wxCUserBasicInfo.setName(wxCUserFromBDto.getName()); | |||||
| wxCUserBasicInfo.setBirthdate(wxCUserFromBDto.getBirthdate()); | |||||
| wxCUserBasicInfo.setSex(wxCUserFromBDto.getSex() ); | |||||
| wxCUserBasicInfo.setAddress(wxCUserFromBDto.getAddress()); | |||||
| wxCUserBasicInfo.setPhone(wxCUserFromBDto.getPhone()); | |||||
| wxCUserBasicInfoService.update(wxCUserBasicInfo); | |||||
| wxScoreRulesService.addScore(EnumScoreType.COMPLETE_INFO, wxCUserBasicInfo); | |||||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, wxCUserBasicInfo); | |||||
| //更新B端来源会员 | |||||
| wxCUserFromB.setInfo(JSONObject.toJSONString(wxCUserBasicInfo)); | |||||
| wxCUserFromBService.saveOrUpdate(wxCUserFromB); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| /** | |||||
| * 会员信息 | |||||
| * @return | |||||
| */ | |||||
| @PostMapping("/findUserInfo") | |||||
| @ApiOperation(value = "获取会员信息", notes="") | |||||
| public ResultData findUserInfo(@RequestBody WxCUserFromBDto wxCUserFromBDto) { | |||||
| logger.info("WxCUserController::updateUserInfo"); | |||||
| if (wxCUserFromBDto == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"没有传入用户信息"); | |||||
| } | |||||
| if (StringUtils.isEmpty(wxCUserFromBDto.getOpenid())){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"C端openid不能为空"); | |||||
| } | |||||
| WxCUserFromB wxCUserFromB = wxCUserFromBService.getByOpenid(wxCUserFromBDto.getOpenid()); | |||||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(wxCUserFromB.getcUserId()); | |||||
| return new ResultData(wxCUserBasicInfo); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,80 @@ | |||||
| package com.iformall.domain.dto; | |||||
| import java.io.Serializable; | |||||
| import java.util.Date; | |||||
| public class WxCUserFromBDto implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| @io.swagger.annotations.ApiModelProperty(value="B端登录者ID",name="bUserId") | |||||
| private Long bUserId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="C端openid",name="openid") | |||||
| private String openid; | |||||
| @io.swagger.annotations.ApiModelProperty(value="C端会员姓名",name="name") | |||||
| private String name; | |||||
| @io.swagger.annotations.ApiModelProperty(value="C端会员性别",name="sex") | |||||
| private Integer sex; | |||||
| @io.swagger.annotations.ApiModelProperty(value="C端会员生日",name="birthdate") | |||||
| private Date birthdate; | |||||
| @io.swagger.annotations.ApiModelProperty(value="C端会员地址",name="address") | |||||
| private String address; | |||||
| @io.swagger.annotations.ApiModelProperty(value="C端会员手机号",name="phone") | |||||
| private String phone; | |||||
| public Long getbUserId() { | |||||
| return bUserId; | |||||
| } | |||||
| public void setbUserId(Long bUserId) { | |||||
| this.bUserId = bUserId; | |||||
| } | |||||
| public String getOpenid() { | |||||
| return openid; | |||||
| } | |||||
| public void setOpenid(String openid) { | |||||
| this.openid = openid; | |||||
| } | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| public void setName(String name) { | |||||
| this.name = name; | |||||
| } | |||||
| public Integer getSex() { | |||||
| return sex; | |||||
| } | |||||
| public void setSex(Integer sex) { | |||||
| this.sex = sex; | |||||
| } | |||||
| public Date getBirthdate() { | |||||
| return birthdate; | |||||
| } | |||||
| public void setBirthdate(Date birthdate) { | |||||
| this.birthdate = birthdate; | |||||
| } | |||||
| public String getAddress() { | |||||
| return address; | |||||
| } | |||||
| public void setAddress(String address) { | |||||
| this.address = address; | |||||
| } | |||||
| public String getPhone() { | |||||
| return phone; | |||||
| } | |||||
| public void setPhone(String phone) { | |||||
| this.phone = phone; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,184 @@ | |||||
| package com.iformall.domain.po; | |||||
| import javax.persistence.Id; | |||||
| import javax.persistence.Table; | |||||
| import javax.persistence.Transient; | |||||
| import java.io.Serializable; | |||||
| import java.util.ArrayList; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @Table(name = "wx_c_user_from_b") | |||||
| public class WxCUserFromB implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| @Id | |||||
| protected Long id; | |||||
| @Transient | |||||
| protected List<Long> ids; | |||||
| @Transient | |||||
| protected String sortColumns; | |||||
| public Long getId() { | |||||
| return id; | |||||
| } | |||||
| public void setId(Long id) { | |||||
| this.id = id; | |||||
| } | |||||
| public String getSortColumns() { | |||||
| return sortColumns; | |||||
| } | |||||
| public List<Long> getIds() { | |||||
| return ids; | |||||
| } | |||||
| public void setIds(List<Long> ids) { | |||||
| this.ids = ids; | |||||
| } | |||||
| /***/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="tenantId") | |||||
| private String tenantId; | |||||
| /*商户ID**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId") | |||||
| private Long merchantId; | |||||
| /*b_user_id**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="b_user_id",name="bUserId") | |||||
| private Long bUserId; | |||||
| /*c_user_id**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="c_user_id",name="cUserId") | |||||
| private Long cUserId; | |||||
| /*会员信息**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="会员信息",name="info") | |||||
| private String info; | |||||
| /***/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="createTime") | |||||
| private Date createTime; | |||||
| /***/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="updateTime") | |||||
| private Date updateTime; | |||||
| /*openid**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="openid",name="openid") | |||||
| private String openid; | |||||
| public String getTenantId() { | |||||
| return tenantId; | |||||
| } | |||||
| public void setTenantId(String _tenantId) { | |||||
| tenantId = _tenantId; | |||||
| } | |||||
| public Long getMerchantId() { | |||||
| return merchantId; | |||||
| } | |||||
| public void setMerchantId(Long _merchantId) { | |||||
| merchantId = _merchantId; | |||||
| } | |||||
| public Long getbUserId() { | |||||
| return bUserId; | |||||
| } | |||||
| public void setbUserId(Long bUserId) { | |||||
| this.bUserId = bUserId; | |||||
| } | |||||
| public Long getcUserId() { | |||||
| return cUserId; | |||||
| } | |||||
| public void setcUserId(Long cUserId) { | |||||
| this.cUserId = cUserId; | |||||
| } | |||||
| public String getInfo() { | |||||
| return info; | |||||
| } | |||||
| public void setInfo(String _info) { | |||||
| info = _info; | |||||
| } | |||||
| public Date getCreateTime() { | |||||
| return createTime; | |||||
| } | |||||
| public void setCreateTime(Date _createTime) { | |||||
| createTime = _createTime; | |||||
| } | |||||
| public Date getUpdateTime() { | |||||
| return updateTime; | |||||
| } | |||||
| public void setUpdateTime(Date _updateTime) { | |||||
| updateTime = _updateTime; | |||||
| } | |||||
| public String getOpenid() { | |||||
| return openid; | |||||
| } | |||||
| public void setOpenid(String _openid) { | |||||
| openid = _openid; | |||||
| } | |||||
| public static enum Field | |||||
| { | |||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||||
| ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") | |||||
| ,BUserId_ASC("`bUserId` ASC"),BUserId_DESC("`bUserId` DESC") | |||||
| ,CUserId_ASC("`cUserId` ASC"),CUserId_DESC("`cUserId` DESC") | |||||
| ,Info_ASC("`info` ASC"),Info_DESC("`info` DESC") | |||||
| ,CreateTime_ASC("`createTime` ASC"),CreateTime_DESC("`createTime` DESC") | |||||
| ,UpdateTime_ASC("`updateTime` ASC"),UpdateTime_DESC("`updateTime` DESC") | |||||
| ,Openid_ASC("`openid` ASC"),Openid_DESC("`openid` DESC") | |||||
| ; | |||||
| private String value; | |||||
| Field(String value){ | |||||
| this.value = value; | |||||
| } | |||||
| public String getValue() { | |||||
| return value; | |||||
| } | |||||
| public void setCol(String value) { | |||||
| this.value = value; | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return this.getValue(); | |||||
| } | |||||
| } | |||||
| public void setSortColumns(Field... fields) | |||||
| { | |||||
| if (fields == null || fields.length == 0) { | |||||
| return; | |||||
| } | |||||
| for (int k = 0; k < fields.length; k++) { | |||||
| if (fields[k] == null) { | |||||
| return; | |||||
| } | |||||
| } | |||||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||||
| for (int k = 1; k < fields.length; k++) { | |||||
| sb.append(","); | |||||
| sb.append(fields[k].toString()); | |||||
| } | |||||
| } | |||||
| public void setSortColumns(String sortColumns) | |||||
| { | |||||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||||
| return; | |||||
| } | |||||
| if (sortColumns.contains(",")) { | |||||
| String[] cols = sortColumns.split(","); | |||||
| List<Field> fList = new ArrayList(); | |||||
| for (int k = 0; k < cols.length; k++) { | |||||
| fList.add(Field.valueOf(cols[k])); | |||||
| } | |||||
| this.setSortColumns(fList.toArray(new Field[fList.size()])); | |||||
| } else { | |||||
| this.setSortColumns(Field.valueOf(sortColumns)); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,18 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxCUserFromB; | |||||
| import org.apache.ibatis.annotations.Select; | |||||
| import java.util.List; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public interface WxCUserFromBMapper extends CommonMapper<WxCUserFromB, Long> { | |||||
| List<WxCUserFromB> findList(WxCUserFromB wxCUserFromB); | |||||
| @Select("select * from wx_c_user_from_b where openid=#{openid}") | |||||
| WxCUserFromB getByOpenid(String openid); | |||||
| } | |||||
| @@ -0,0 +1,46 @@ | |||||
| package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.WxCUserFromB; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public interface WxCUserFromBService { | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param offset | |||||
| * @param limit | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxCUserFromB> listAsPage(WxCUserFromB record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 根据Id获得实体 | |||||
| * | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| WxCUserFromB getById(Long id); | |||||
| /** | |||||
| * 保存或更新实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void saveOrUpdate(WxCUserFromB record); | |||||
| /** | |||||
| * 根据Id删除实体 | |||||
| * | |||||
| * @param id | |||||
| */ | |||||
| void deleteById(Long id); | |||||
| WxCUserFromB getByOpenid(String openid); | |||||
| } | |||||
| @@ -0,0 +1,58 @@ | |||||
| package com.iformall.service.impl; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.WxCUserFromB; | |||||
| import com.iformall.mapper.WxCUserFromBMapper; | |||||
| import com.iformall.service.WxCUserFromBService; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import java.util.Date; | |||||
| import java.util.UUID; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| @Service | |||||
| public class WxCUserFromBServiceImpl implements WxCUserFromBService { | |||||
| @Autowired | |||||
| WxCUserFromBMapper wxCUserFromBMapper; | |||||
| @Override | |||||
| public PageInfo<WxCUserFromB> listAsPage(WxCUserFromB record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserFromBMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public WxCUserFromB getById(Long id) { | |||||
| return wxCUserFromBMapper.selectByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdate(WxCUserFromB record) { | |||||
| if (record.getId() == null) { | |||||
| Date date = new Date(); | |||||
| record.setCreateTime(date); | |||||
| record.setUpdateTime(date); | |||||
| wxCUserFromBMapper.insertSelective(record); | |||||
| } else { | |||||
| record.setUpdateTime(new Date()); | |||||
| wxCUserFromBMapper.updateByPrimaryKeySelective(record); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| wxCUserFromBMapper.deleteByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public WxCUserFromB getByOpenid(String openid) { | |||||
| return wxCUserFromBMapper.getByOpenid(openid); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,50 @@ | |||||
| <?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.iformall.mapper.WxCUserFromBMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCUserFromB"> | |||||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||||
| <result column="merchant_id" jdbcType="INTEGER" property="merchantId" /> | |||||
| <result column="b_user_id" jdbcType="BIGINT" property="bUserId" /> | |||||
| <result column="c_user_id" jdbcType="BIGINT" property="cUserId" /> | |||||
| <result column="info" jdbcType="VARCHAR" property="info" /> | |||||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |||||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | |||||
| <result column="openid" jdbcType="VARCHAR" property="openid" /> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`merchant_id`,`b_user_id`,`c_user_id`,`info`,`create_time`,`update_time`,`openid` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> and `id` = #{id} </if> | |||||
| <if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if> | |||||
| <if test=" null != merchantId "> and `merchant_id` = #{merchantId} </if> | |||||
| <if test=" null != bUserId "> and `b_user_id` = #{bUserId} </if> | |||||
| <if test=" null != cUserId "> and `c_user_id` = #{cUserId} </if> | |||||
| <if test=" null != info "> and `info` = #{info} </if> | |||||
| <if test=" null != createTime "> and `create_time` = #{createTime} </if> | |||||
| <if test=" null != updateTime "> and `update_time` = #{updateTime} </if> | |||||
| <if test=" null != openid "> and `openid` = #{openid} </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxCUserFromB" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_c_user_from_b | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| </mapper> | |||||