예제 #1
0
        /// <summary>
        /// 获取操作model
        /// </summary>
        /// <returns></returns>
        public async Task <UserActionCharacteristics> GetOperateModel(UserType userType, ActionEnum operateType, ActionCharacteristicsEnum actionCharacteristics = ActionCharacteristicsEnum.Action)
        {
            string sqlstring = $@"select 
                                    ua.user_action_guid,
                                    ua.user_type_guid,
                                    ua.action_guid,
                                    ac.action_characteristics_code,
                                    ac.action_characteristics_name,
                                    ua.enable,
                                    ua.created_by,
                                    ua.creation_date,
                                    ua.last_updated_by,
                                    ua.last_updated_date
                                from t_utility_user_action as ua  
                                     left join t_utility_action_characteristics as ac on ac.action_characteristics_guid=ua.action_guid
                                where ac.action_characteristics_guid=@action_characteristics_guid 
                                      and ac.action_characteristics_type=@action_characteristics_type 
                                      and ua.user_type_guid=@user_type_guid";

            DynamicParameters parameters = new DynamicParameters();

            parameters.Add("action_characteristics_guid", operateType.GetDescription(), System.Data.DbType.String);
            parameters.Add("action_characteristics_type", actionCharacteristics.ToString(), System.Data.DbType.String);
            parameters.Add("user_type_guid", userType.ToString(), System.Data.DbType.String);

            using (MySql.Data.MySqlClient.MySqlConnection conn = MySqlHelper.GetConnection())
            {
                return(await conn.QueryFirstAsync <UserActionCharacteristics>(sqlstring, parameters));
            }
        }
예제 #2
0
        /// <summary>
        /// 收入总积分
        /// </summary>
        /// <param name="userGuid">用户GUID</param>
        /// <param name="requestDto">查询Dto</param>
        /// <param name="userType">用户类型</param>
        /// <returns></returns>
        private async Task <int?> GetOutlayVariationAll(string userGuid, GetDoctorScoreAllInfoRequestDto requestDto, UserType userType)
        {
            StringBuilder     sb         = new StringBuilder("select sum(variation) from t_utility_score where variation<0 and user_guid=@user_guid and user_type_guid=@userType");
            DynamicParameters parameters = new DynamicParameters();

            parameters.Add("user_guid", userGuid, System.Data.DbType.String);
            parameters.Add("userType", userType.ToString(), System.Data.DbType.String);

            if (requestDto.startTime != null)
            {
                sb.Append(" and creation_date>@startTime ");
                parameters.Add("startTime", requestDto.startTime, System.Data.DbType.DateTime);
            }
            if (requestDto.endTime != null)
            {
                sb.Append(" and creation_date<@endTime ");
                parameters.Add("endTime", requestDto.endTime, System.Data.DbType.DateTime);
            }
            using (MySql.Data.MySqlClient.MySqlConnection conn = MySqlHelper.GetConnection())
            {
                return(await conn.QueryFirstAsync <int?>(sb.ToString(), parameters));
            }
        }