• 省市县,区的查询(通过区开始)(导出的接口实现)


    1.三张表的关系

    2.接口的实现

    public byte[] SCCToXlsx(IEnumerable<County> StateProvinceCC)
            {
                var properties = new[]
                  {
                       new PropertyByName<County>("区/县", p => p.Name),
                       new PropertyByName<County>("城市", p =>GetCity(p.CityId)),
                       new PropertyByName<County>("省份", p =>GetStateProvinceName(GetStateProvince(p.CityId)))
                };
                return ExportToXlsx(properties, StateProvinceCC);
            }
            //通过区县id获取城市名称
            public string GetCity(int id)
            {
                return _cityService.GetCityById(id).Name;
            }
    
            /// <summary>
            /// 得到省的id
            /// </summary>
            /// <param name="id"></param>
            /// <returns></returns>
            public int GetStateProvince(int id)
            {
                return _cityService.GetCityById(id).StateProvinceId;//省的id
            }
            /// <summary>
            /// 通过id获取到省名称
            /// </summary>
            /// <param name="id"></param>
            /// <returns></returns>
            public string GetStateProvinceName(int id)
            {
                return _stateProvinceService.GetStateProvinceById(id).Name; ;
            }
  • 相关阅读:
    pagehide、beforeunload、unload
    script error
    fingerprintjs
    nodejs 加解密
    http
    stack
    csp
    btoa
    nginx文件上传模块 nginx_upload_module
    keepalived检测UDP端口
  • 原文地址:https://www.cnblogs.com/wfaceboss/p/6289401.html
Copyright © 2020-2023  润新知