/// <summary> /// 计算用户点赞数 /// </summary> /// <param name="targetGuid">=</param> /// <param name="enable">=</param> /// <returns></returns> public int GetLikeNumByTargetGuid(string targetGuid, bool enable = true) { var strWhere = " where target_guid=@targetGuid and enable=@enable "; var likerNum = MySqlHelper.Count <LikeModel>(strWhere, new { targetGuid, enable }); return(likerNum); }
/// <summary> /// 计算用户浏览数 /// </summary> /// <param name="targetGuid">=</param> /// <param name="enable">=</param> /// <returns></returns> public int GetViewNumByTargetGuid(string targetGuid, bool enable = true) { var strWhere = " where target_guid=@targetGuid and enable=@enable"; var behaviorNum = MySqlHelper.Count <BehaviorModel>(strWhere, new { targetGuid, enable }); return(behaviorNum); }
/// <summary> /// 判断医院是否有某项资质 /// </summary> /// <param name="hospitalGuid">医院guid</param> /// <param name="ualificationDic">资质配置项guid</param> /// <param name="enable">可选参数,标示位</param> /// <returns>是否有资质</returns> public bool CheckHospitalQualification(string hospitalGuid, string ualificationDic, bool enable = true) { var sql = "where hospital_guid=@hospitalGuid and conf_guid=@ualificationDic and conf_value='1' and enable=@enable"; var characterModels = MySqlHelper.Select <QualificationModel>(sql, new { hospitalGuid, ualificationDic, enable }); return(MySqlHelper.Count <QualificationModel>(sql, new { hospitalGuid, ualificationDic, enable }) > 0); }
/// <summary> /// 检查服务人员手机号码是否已注册 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool IsTherapistPhoneExist(string phone, bool enable = true, string therapistGuid = null) { var sql = "where therapist_phone = @phone and enable = @enable"; if (!string.IsNullOrEmpty(therapistGuid)) { sql += " and therapist_guid<> @therapistGuid"; } return(MySqlHelper.Count <TherapistModel>(sql, new { phone, enable, therapistGuid }) > 0); }
/// <summary> /// 判断用户是否点赞该目标 /// </summary> /// <param name="userGuid">用户Guid</param> /// <param name="targetGuid">目标Guid</param> /// <returns>是否点赞</returns> public bool GetLikeState(string userGuid, string targetGuid, bool enable = true) { return(MySqlHelper.Count <LikeModel>("where target_guid=@targetGuid and created_by=@userGuid and enable=@enable", new { userGuid, targetGuid, enable }) > 0); }
/// <summary> /// 检查特征是否存在 /// </summary> /// <param name="configGuid"></param> /// <param name="userId"></param> /// <param name="enable"></param> /// <returns></returns> public bool IsExistConfig(string configGuid, string userId, bool enable = true) { //可用 return(MySqlHelper.Count <CharacterModel>("where conf_guid=@configGuid and user_guid=@userId and enable=@enable", new { configGuid, userId, enable }) > 0);; }
/// <summary> /// 今日是否收藏或收藏已取消 /// </summary> /// <returns></returns> public bool IsCollectTheTarget(string userID, string targetGuid, bool enable = true) { const string sqlWhere = "where user_guid=@userID and target_guid=@targetGuid and enable=@enable and to_days( creation_date ) = to_days( now( ) ) "; return(MySqlHelper.Count <CollectionModel>(sqlWhere, new { userID, targetGuid, enable }) > 0); }