|
|
|
|
package com.ynxbd.common.dao;
|
|
|
|
|
|
|
|
|
|
import com.ynxbd.common.bean.GMCUser;
|
|
|
|
|
import com.ynxbd.common.config.db.DataBase;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class GMCUserDao {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询用户关联关系
|
|
|
|
|
*/
|
|
|
|
|
public GMCUser selectByOpenId(String wxOpenId) {
|
|
|
|
|
String sql = "select * from gmc_user where wxOpenId=?";
|
|
|
|
|
return DataBase.selectOne(sql, GMCUser.class, ps -> {
|
|
|
|
|
ps.setString(1, wxOpenId);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加关系
|
|
|
|
|
*/
|
|
|
|
|
public boolean insert(String wxOpenId, String gmcOpenId, String gmcUnionId, String gmcUUId) {
|
|
|
|
|
String sql = "insert into gmc_user(updateTime, wxOpenId, gmcOpenId, gmcUnionId, gmcUUId, childAppId) values (now(),?,?,?,?)";
|
|
|
|
|
return DataBase.insert(sql, ps -> {
|
|
|
|
|
ps.setString(1, wxOpenId);
|
|
|
|
|
ps.setString(2, gmcOpenId);
|
|
|
|
|
ps.setString(3, gmcUnionId);
|
|
|
|
|
ps.setString(4, gmcUUId);
|
|
|
|
|
}) > 0;
|
|
|
|
|
}
|
|
|
|
|
}
|