Beispiel #1
0
        /// <summary>
        /// 查询需要我审批的项目
        /// </summary>
        /// <param name="data">data.value,data.userInfo</param>
        /// <param name="state">审批状态</param>
        /// <param name="page"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public HttpResponseMessage QueryUp(dynamic data, int state, int page, int count)
        {
            int     p     = (page - 1) * count + 1;
            int     c     = page * count;
            JObject array = data.userInfo;

            string where = SQLWhere.UserSql(array);
            string sql = "select * from ( " +
                         "select b.*,a.yh_state,a.yh_downid,a.yh_time, " +
                         "row_number() over(order by a.yh_upid desc) as row from yinhuan_up a " +
                         "left join yinhuan b on a.yh_no = b.yh_no " +
                         "where a.yh_to_userup in (" + where + ") and a.yh_state=" + state + " " +
                         ")temp " +
                         "where row between " + p + " and " + c + "";
            DataTable dt = help.Totable(sql);

            if (dt.Rows.Count > 0)
            {
                obj = new
                {
                    code = 0,
                    msg  = "",
                    data = ConvertToEntity <Entity.yinhuan_down> .Convert(dt)
                };
            }
            else
            {
                obj = new
                {
                    code = 1,
                    msg  = "没有查询到待审核数据信息"
                };
            }
            return(Zh.Tool.Json.GetJson(obj));
        }
Beispiel #2
0
        /// <summary>
        /// 查询相关数据的数量
        /// </summary>
        /// <param name="data">两个值 value 搜索关键词  userInfo 登录用户的信息 {}</param>
        /// <param name="types">标识  1为只查询个人的 否则查询下属的</param>
        /// <param name="yh_send_state">隐患处理的状态</param>
        /// <returns></returns>
        public int QueryCount(dynamic data, int types, int yh_send_state)
        {
            JObject array = data.userInfo;
            string  value = data.value;

            string usersql = SQLWhere.UserSql(array);
            int    us_id   = Convert.ToInt32(array["us_id"]);


            string where = "where a.yh_id>0 ";
            if (value != "" && value != null)
            {
                where += " and a.yh_applicationName like '%" + value + "%' ";
            }
            if (types == 1)
            {//只查询我个人的信息
                where += " and a.yh_user_from=" + us_id + " ";
            }
            else  //查询我下属发布的信息
            {
                where += " and (a.yh_user_from in (" + usersql + ") or a.yh_queren_user in (" + usersql + ") ) ";
            }
            where += " and a.yh_send_state=" + yh_send_state + " ";

            string sql = "select count(a.yh_id) from yinhuan a " + where + " ";

            return(Convert.ToInt32(help.FirstRow(sql)));
        }
Beispiel #3
0
        /// <summary>
        /// 查询隐患信息 只限于查询已发布的和已完成的 也就是说send_state==1 或者==3
        /// </summary>
        /// <param name="data">data里携带一个值value为用户检索的数据信息,userinfo用户的信息,是一个{}object类型</param>
        /// <returns></returns>
        public HttpResponseMessage QuerySend(dynamic data, int page, int count, int yh_send_state)
        {
            if (yh_send_state != 1 && yh_send_state != 3)
            {
                obj = new {
                    code = 1,
                    msg  = "该接口只限于查询已发布和已完成的信息,对应值应该为1或3。"
                };
                return(Zh.Tool.Json.GetJson(obj));
            }

            int     p     = (page - 1) * count + 1;
            int     c     = page * count;
            JObject array = data.userInfo;

            string where = "where a.yh_id>0 ";
            //where +=" and"= SQLWhere.UserSql(array);
            string usersql = SQLWhere.UserSql(array);

            string value = data.value;

            if (value != "" && value != null)
            {
                where += " and a.yh_applicationName like '%" + value + "%' ";
            }
            where += " and (a.yh_user_from in (" + usersql + ") or a.yh_queren_user in (" + usersql + ") ) ";
            where += " and a.yh_send_state=" + yh_send_state + " ";

            string sql = "select * from( " +
                         "select a.*,b.yh_to_userup,b.yh_state as state_up,b.yh_time as time_up, " +
                         "c.yh_state as state_down,c.yh_time as time_down,c.yh_to_userdown, " +
                         "row_number() over(order by yh_id desc) as row from yinhuan a " +
                         "left join yinhuan_up b on a.yh_no = b.yh_no " +
                         "left join yinhuan_down c on a.yh_no = c.yh_no " +
                         "" + where + ") temp " +
                         "where row between " + p + " and " + c + " ";
            DataTable dt = help.Totable(sql);

            if (dt.Rows.Count > 0)
            {
                obj = new
                {
                    code  = 0,
                    msg   = "成功读取数据",
                    count = QueryCount(data, 2, yh_send_state),
                    data  = ConvertToEntity <Entity.yinhuan_down> .Convert(dt)
                };
            }
            else
            {
                obj = new
                {
                    code = 1,
                    msg  = "没有查询到相关数据信息"
                };
            }

            return(Zh.Tool.Json.GetJson(obj));
        }