添加耗材
This commit is contained in:
@@ -32,5 +32,7 @@ public interface TbUserShopMsgMapper {
|
||||
|
||||
@Select("select * from tb_user_shop_msg where shop_id=#{shopId}")
|
||||
TbUserShopMsg selectByShopId(@Param("shopId") String shopId);
|
||||
|
||||
TbUserShopMsg selectByShopIdAndOpenId(@Param("shopId") Integer shopId,@Param("openId") String openId);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class TbUserShopMsg implements Serializable {
|
||||
private Integer id;
|
||||
|
||||
private Integer shopId;
|
||||
|
||||
private String openId;
|
||||
@@ -18,6 +20,14 @@ public class TbUserShopMsg implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getShopId() {
|
||||
return shopId;
|
||||
}
|
||||
@@ -65,4 +75,4 @@ public class TbUserShopMsg implements Serializable {
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,22 +65,16 @@ public class LoginService {
|
||||
|
||||
|
||||
public Result wxBusinessLogin(String openId,String shopId){
|
||||
TbUserShopMsg shopMsg= tbUserShopMsgMapper.selectByPrimaryKey(Integer.valueOf(shopId));
|
||||
TbUserShopMsg shopMsg= tbUserShopMsgMapper.selectByShopIdAndOpenId(Integer.valueOf(shopId),openId);
|
||||
if(Objects.isNull(shopMsg)){
|
||||
shopMsg=new TbUserShopMsg();
|
||||
|
||||
shopMsg.setShopId(Integer.valueOf(shopId));
|
||||
shopMsg.setOpenId(openId);
|
||||
shopMsg.setCreateTime(new Date());
|
||||
shopMsg.setStatus("1");
|
||||
|
||||
|
||||
tbUserShopMsgMapper.insert(shopMsg);
|
||||
}else {
|
||||
shopMsg.setOpenId(openId);
|
||||
shopMsg.setUpdateTime(new Date());
|
||||
tbUserShopMsgMapper.updateByPrimaryKey(shopMsg);
|
||||
}
|
||||
|
||||
// 为商家绑定openid
|
||||
if (shopOpenIdMapper.countByOpenId(openId) == null) {
|
||||
TbShopOpenId shopOpenId = new TbShopOpenId();
|
||||
|
||||
Reference in New Issue
Block a user