微信后端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
962 B

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 gmcUniqueId) {
String sql = "insert into gmc_user(updateTime, wxOpenId, gmcOpenId, gmcUnionId, gmcUniqueId) values (now(),?,?,?,?)";
return DataBase.insert(sql, ps -> {
ps.setString(1, wxOpenId);
ps.setString(2, gmcOpenId);
ps.setString(3, gmcUnionId);
ps.setString(4, gmcUniqueId);
}) > 0;
}
}