You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UserService.cs 25 KiB

4 jaren geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762
  1. using Learun.DataBase.Repository;
  2. using Learun.Util;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Runtime.CompilerServices;
  8. using System.Text;
  9. namespace Learun.Application.Organization
  10. {
  11. /// <summary>
  12. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  13. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  14. /// 创建人:陈彬彬
  15. /// 日 期:2017.03.04
  16. /// 描 述:用户模块数据操作服务类
  17. /// </summary>
  18. public class UserService : RepositoryFactory
  19. {
  20. #region 属性 构造函数
  21. private string fieldSql;
  22. public UserService()
  23. {
  24. fieldSql = "t.*";
  25. }
  26. #endregion
  27. #region 获取数据
  28. /// <summary>
  29. /// 获取实体,通过用户账号
  30. /// </summary>
  31. /// <param name="account">用户账号</param>
  32. /// <returns></returns>
  33. public UserEntity GetEntityByAccount(string account)
  34. {
  35. try
  36. {
  37. var strSql = new StringBuilder();
  38. strSql.Append("SELECT ");
  39. strSql.Append(fieldSql);
  40. strSql.Append(" FROM LR_Base_User t ");
  41. strSql.Append(" WHERE t.F_Account = @account AND t.F_DeleteMark = 0 ");
  42. return this.BaseRepository().FindEntity<UserEntity>(strSql.ToString(), new { account = account });
  43. }
  44. catch (Exception ex)
  45. {
  46. if (ex is ExceptionEx)
  47. {
  48. throw;
  49. }
  50. else
  51. {
  52. throw ExceptionEx.ThrowServiceException(ex);
  53. }
  54. }
  55. }
  56. /// <summary>
  57. /// 用户列表(根据公司主键)
  58. /// </summary>
  59. /// <param name="companyId">公司主键</param>
  60. /// <returns></returns>
  61. public IEnumerable<UserEntity> GetList(string companyId)
  62. {
  63. try
  64. {
  65. var strSql = new StringBuilder();
  66. strSql.Append("SELECT ");
  67. strSql.Append(fieldSql.Replace("t.F_Password,", "").Replace("t.F_Secretkey,", ""));
  68. strSql.Append(" FROM LR_Base_User t WHERE t.F_DeleteMark = 0 AND t.F_CompanyId = @companyId ORDER BY t.F_DepartmentId,t.F_RealName ");
  69. return this.BaseRepository().FindList<UserEntity>(strSql.ToString(), new { companyId = companyId });
  70. }
  71. catch (Exception ex)
  72. {
  73. if (ex is ExceptionEx)
  74. {
  75. throw;
  76. }
  77. else
  78. {
  79. throw ExceptionEx.ThrowServiceException(ex);
  80. }
  81. }
  82. }
  83. internal bool GetStuAny()
  84. {
  85. try
  86. {
  87. return this.BaseRepository().FindList<UserEntity>(a => a.F_Description == "学生").ToList().Count() > 0 ? true : false;
  88. }
  89. catch (Exception ex)
  90. {
  91. if (ex is ExceptionEx)
  92. {
  93. throw;
  94. }
  95. else
  96. {
  97. throw ExceptionEx.ThrowServiceException(ex);
  98. }
  99. }
  100. }
  101. internal bool GetAny()
  102. {
  103. try
  104. {
  105. return this.BaseRepository().FindList<UserEntity>(a => a.F_Description == "教师").ToList().Count() > 0 ? true : false;
  106. }
  107. catch (Exception ex)
  108. {
  109. if (ex is ExceptionEx)
  110. {
  111. throw;
  112. }
  113. else
  114. {
  115. throw ExceptionEx.ThrowServiceException(ex);
  116. }
  117. }
  118. }
  119. /// <summary>
  120. /// 用户列表(根据公司主键)(分页)
  121. /// </summary>
  122. /// <param name="companyId"></param>
  123. /// <param name="departmentId"></param>
  124. /// <param name="pagination"></param>
  125. /// <param name="keyword"></param>
  126. /// <param name="tp">类型 0学生 1 教师</param>
  127. /// <returns></returns>
  128. public IEnumerable<UserEntity> GetPageList(string companyId, string departmentId, Pagination pagination, string keyword, string tp)
  129. {
  130. try
  131. {
  132. var strSql = new StringBuilder();
  133. strSql.Append("SELECT ");
  134. strSql.Append(fieldSql.Replace("t.F_Password,", "").Replace("t.F_Secretkey,", ""));
  135. strSql.Append(",F_UserId as F_UserId_Log FROM LR_Base_User t WHERE t.F_DeleteMark = 0 AND t.F_CompanyId = @companyId ");
  136. if (!string.IsNullOrEmpty(departmentId))
  137. {
  138. strSql.Append(" AND t.F_DepartmentId = @departmentId ");
  139. }
  140. if (!string.IsNullOrEmpty(tp))
  141. {
  142. switch (tp)
  143. {
  144. case "0":
  145. strSql.Append(" AND t.F_Description='教师' ");
  146. break;
  147. case "1":
  148. strSql.Append(" AND t.F_Description='学生' ");
  149. break;
  150. }
  151. }
  152. if (!string.IsNullOrEmpty(keyword))
  153. {
  154. keyword = "%" + keyword + "%";
  155. strSql.Append(" AND( t.F_Account like @keyword or t.F_RealName like @keyword or t.F_Mobile like @keyword ) ");
  156. }
  157. return this.BaseRepository().FindList<UserEntity>(strSql.ToString(), new { companyId, departmentId, keyword }, pagination);
  158. }
  159. catch (Exception ex)
  160. {
  161. if (ex is ExceptionEx)
  162. {
  163. throw;
  164. }
  165. else
  166. {
  167. throw ExceptionEx.ThrowServiceException(ex);
  168. }
  169. }
  170. }
  171. /// <summary>
  172. /// 用户列表,全部
  173. /// </summary>
  174. /// <returns></returns>
  175. public IEnumerable<UserEntity> GetAllList()
  176. {
  177. try
  178. {
  179. var strSql = new StringBuilder();
  180. strSql.Append("SELECT ");
  181. strSql.Append(fieldSql.Replace("t.F_Password,", "").Replace("t.F_Secretkey,", ""));
  182. strSql.Append(" FROM LR_Base_User t WHERE t.F_DeleteMark = 0 ORDER BY t.F_CompanyId,t.F_DepartmentId,t.F_RealName ");
  183. return this.BaseRepository().FindList<UserEntity>(strSql.ToString());
  184. }
  185. catch (Exception ex)
  186. {
  187. if (ex is ExceptionEx)
  188. {
  189. throw;
  190. }
  191. else
  192. {
  193. throw ExceptionEx.ThrowServiceException(ex);
  194. }
  195. }
  196. }
  197. /// <summary>
  198. /// 用户列表(导出Excel)
  199. /// </summary>
  200. /// <returns></returns>
  201. public DataTable GetExportList()
  202. {
  203. try
  204. {
  205. var strSql = new StringBuilder();
  206. strSql.Append(@"SELECT u.F_Account
  207. ,u.F_RealName
  208. ,CASE WHEN u.F_Gender=1 THEN '男' ELSE '女' END AS F_Gender
  209. ,CASE WHEN u.F_EnabledMark=1 THEN '正常' ELSE '禁用' END AS F_EnabledMark
  210. ,u.F_Birthday
  211. ,u.F_Mobile
  212. ,u.F_Telephone
  213. ,u.F_WeChat
  214. ,o.F_FullName AS F_Company
  215. ,d.F_FullName AS F_Department
  216. ,u.F_Description
  217. ,u.F_CreateDate
  218. ,u.F_CreateUserName
  219. FROM LR_Base_User u
  220. INNER JOIN LR_Base_Department d ON u.F_DepartmentId=d.F_DepartmentId
  221. INNER JOIN LR_Base_Company o ON u.F_CompanyId=o.F_CompanyId
  222. WHERE u.F_DeleteMark = 0 and u.F_Description = '教师'");
  223. return this.BaseRepository().FindTable(strSql.ToString());
  224. }
  225. catch (Exception ex)
  226. {
  227. if (ex is ExceptionEx)
  228. {
  229. throw;
  230. }
  231. else
  232. {
  233. throw ExceptionEx.ThrowServiceException(ex);
  234. }
  235. }
  236. }
  237. /// <summary>
  238. /// 用户列表(导出Excel)【学生】
  239. /// </summary>
  240. /// <returns></returns>
  241. public DataTable GetExportListOfStudent()
  242. {
  243. try
  244. {
  245. var strSql = new StringBuilder();
  246. strSql.Append(@"SELECT u.F_Account
  247. ,u.F_RealName
  248. ,CASE WHEN u.F_Gender=1 THEN '男' ELSE '女' END AS F_Gender
  249. ,u.F_Birthday
  250. ,u.F_Mobile
  251. ,u.F_Telephone
  252. ,u.F_WeChat
  253. ,o.F_FullName AS F_Company
  254. ,u.F_DepartmentId AS F_Department
  255. ,u.F_Description
  256. ,u.F_CreateDate
  257. ,u.F_CreateUserName
  258. FROM LR_Base_User u
  259. INNER JOIN LR_Base_Company o ON u.F_CompanyId=o.F_CompanyId
  260. WHERE u.F_DeleteMark = 0 and u.F_Description = '学生'");
  261. return this.BaseRepository().FindTable(strSql.ToString());
  262. }
  263. catch (Exception ex)
  264. {
  265. if (ex is ExceptionEx)
  266. {
  267. throw;
  268. }
  269. else
  270. {
  271. throw ExceptionEx.ThrowServiceException(ex);
  272. }
  273. }
  274. }
  275. /// <summary>
  276. /// 用户实体
  277. /// </summary>
  278. /// <param name="keyValue">主键值</param>
  279. /// <returns></returns>
  280. public UserEntity GetEntity(string keyValue)
  281. {
  282. try
  283. {
  284. return this.BaseRepository().FindEntity<UserEntity>(t => t.F_UserId == keyValue && t.F_DeleteMark == 0);
  285. }
  286. catch (Exception ex)
  287. {
  288. if (ex is ExceptionEx)
  289. {
  290. throw;
  291. }
  292. else
  293. {
  294. throw ExceptionEx.ThrowServiceException(ex);
  295. }
  296. }
  297. }
  298. #endregion
  299. #region 验证数据
  300. /// <summary>
  301. /// 账户不能重复
  302. /// </summary>
  303. /// <param name="account">账户值</param>
  304. /// <param name="keyValue">主键</param>
  305. /// <returns></returns>
  306. public bool ExistAccount(string account, string keyValue)
  307. {
  308. try
  309. {
  310. var expression = LinqExtensions.True<UserEntity>();
  311. expression = expression.And(t => t.F_Account == account);
  312. if (!string.IsNullOrEmpty(keyValue))
  313. {
  314. expression = expression.And(t => t.F_UserId != keyValue);
  315. }
  316. return this.BaseRepository().IQueryable(expression).Count() == 0 ? true : false;
  317. }
  318. catch (Exception ex)
  319. {
  320. if (ex is ExceptionEx)
  321. {
  322. throw;
  323. }
  324. else
  325. {
  326. throw ExceptionEx.ThrowServiceException(ex);
  327. }
  328. }
  329. }
  330. #endregion
  331. #region 提交数据
  332. /// <summary>
  333. /// 虚拟删除
  334. /// </summary>
  335. /// <param name="keyValue">主键</param>
  336. public void VirtualDelete(string keyValue)
  337. {
  338. try
  339. {
  340. UserEntity entity = new UserEntity()
  341. {
  342. F_UserId = keyValue,
  343. F_DeleteMark = 1
  344. };
  345. this.BaseRepository().Update(entity);
  346. }
  347. catch (Exception ex)
  348. {
  349. if (ex is ExceptionEx)
  350. {
  351. throw;
  352. }
  353. else
  354. {
  355. throw ExceptionEx.ThrowServiceException(ex);
  356. }
  357. }
  358. }
  359. /// <summary>
  360. /// 虚拟删除(批量)
  361. /// </summary>
  362. /// <param name="keyValue">主键</param>
  363. public void VirtualDeleteBatch(string keyValue)
  364. {
  365. var db = this.BaseRepository().BeginTrans();
  366. try
  367. {
  368. foreach (var item in keyValue.Split(','))
  369. {
  370. UserEntity entity = new UserEntity()
  371. {
  372. F_UserId = item,
  373. F_DeleteMark = 1
  374. };
  375. db.Update(entity);
  376. db.ExecuteBySql("delete from LR_Base_UserRelation where F_UserId='" + keyValue + "'");
  377. }
  378. db.Commit();
  379. }
  380. catch (Exception ex)
  381. {
  382. db.Rollback();
  383. }
  384. }
  385. internal List<UserEntity> GetStudents()
  386. {
  387. try
  388. {
  389. return this.BaseRepository().FindList<UserEntity>(a => a.F_Description == "学生").ToList();
  390. }
  391. catch (Exception ex)
  392. {
  393. if (ex is ExceptionEx)
  394. {
  395. throw;
  396. }
  397. else
  398. {
  399. throw ExceptionEx.ThrowServiceException(ex);
  400. }
  401. }
  402. }
  403. /// <summary>
  404. /// 保存用户表单(新增、修改)
  405. /// </summary>
  406. /// <param name="keyValue">主键值</param>
  407. /// <param name="userEntity">用户实体</param>
  408. /// <returns></returns>
  409. public void SaveEntity(string keyValue, UserEntity userEntity)
  410. {
  411. try
  412. {
  413. if (string.IsNullOrEmpty(keyValue))
  414. {
  415. userEntity.Create();
  416. userEntity.F_Secretkey = Md5Helper.Encrypt(CommonHelper.CreateNo(), 16).ToLower();
  417. userEntity.F_Password = Md5Helper.Encrypt(DESEncrypt.Encrypt(userEntity.F_Password, userEntity.F_Secretkey).ToLower(), 32).ToLower();
  418. this.BaseRepository().Insert(userEntity);
  419. }
  420. else
  421. {
  422. userEntity.Modify(keyValue);
  423. userEntity.F_Secretkey = null;
  424. userEntity.F_Password = null;
  425. this.BaseRepository().Update(userEntity);
  426. }
  427. }
  428. catch (Exception ex)
  429. {
  430. if (ex is ExceptionEx)
  431. {
  432. throw;
  433. }
  434. else
  435. {
  436. throw ExceptionEx.ThrowServiceException(ex);
  437. }
  438. }
  439. }
  440. /// <summary>
  441. /// 修改用户登录密码
  442. /// </summary>
  443. /// <param name="keyValue">主键值</param>
  444. /// <param name="password">新密码(MD5 小写)</param>
  445. public void RevisePassword(string keyValue, string password)
  446. {
  447. try
  448. {
  449. UserEntity userEntity = new UserEntity();
  450. userEntity.Modify(keyValue);
  451. userEntity.F_Secretkey = Md5Helper.Encrypt(CommonHelper.CreateNo(), 16).ToLower();
  452. userEntity.F_Password = Md5Helper.Encrypt(DESEncrypt.Encrypt(password, userEntity.F_Secretkey).ToLower(), 32).ToLower();
  453. this.BaseRepository().Update(userEntity);
  454. }
  455. catch (Exception ex)
  456. {
  457. if (ex is ExceptionEx)
  458. {
  459. throw;
  460. }
  461. else
  462. {
  463. throw ExceptionEx.ThrowServiceException(ex);
  464. }
  465. }
  466. }
  467. /// <summary>
  468. /// 修改用户登录密码(批量)
  469. /// </summary>
  470. /// <param name="keyValue">主键值</param>
  471. /// <param name="password">新密码(MD5 小写)</param>
  472. public void RevisePasswordBatch(string keyValue, string password)
  473. {
  474. var db = this.BaseRepository().BeginTrans();
  475. try
  476. {
  477. foreach (var item in keyValue.Split(','))
  478. {
  479. UserEntity userEntity = new UserEntity();
  480. userEntity.Modify(item);
  481. userEntity.F_Secretkey = Md5Helper.Encrypt(CommonHelper.CreateNo(), 16).ToLower();
  482. userEntity.F_Password = Md5Helper.Encrypt(DESEncrypt.Encrypt(password, userEntity.F_Secretkey).ToLower(), 32).ToLower();
  483. db.Update(userEntity);
  484. }
  485. db.Commit();
  486. }
  487. catch (Exception ex)
  488. {
  489. db.Rollback();
  490. }
  491. }
  492. /// <summary>
  493. /// 修改用户状态
  494. /// </summary>
  495. /// <param name="keyValue">主键值</param>
  496. /// <param name="state">状态:1-启动;0-禁用</param>
  497. public void UpdateState(string keyValue, int state)
  498. {
  499. try
  500. {
  501. UserEntity userEntity = new UserEntity();
  502. userEntity.Modify(keyValue);
  503. userEntity.F_EnabledMark = state;
  504. this.BaseRepository().Update(userEntity);
  505. }
  506. catch (Exception ex)
  507. {
  508. if (ex is ExceptionEx)
  509. {
  510. throw;
  511. }
  512. else
  513. {
  514. throw ExceptionEx.ThrowServiceException(ex);
  515. }
  516. }
  517. }
  518. /// <summary>
  519. /// 修改用户信息
  520. /// </summary>
  521. /// <param name="userEntity">实体对象</param>
  522. public void UpdateEntity(UserEntity userEntity)
  523. {
  524. try
  525. {
  526. this.BaseRepository().Update(userEntity);
  527. }
  528. catch (Exception ex)
  529. {
  530. if (ex is ExceptionEx)
  531. {
  532. throw;
  533. }
  534. else
  535. {
  536. throw ExceptionEx.ThrowServiceException(ex);
  537. }
  538. }
  539. }
  540. public List<UserEntity> GetUserByDepartmentId(string departmentId)
  541. {
  542. try
  543. {
  544. return this.BaseRepository().FindList<UserEntity>(a=>a.F_DepartmentId==departmentId).ToList();
  545. }
  546. catch (Exception ex)
  547. {
  548. if (ex is ExceptionEx)
  549. {
  550. throw;
  551. }
  552. else
  553. {
  554. throw ExceptionEx.ThrowServiceException(ex);
  555. }
  556. }
  557. }
  558. /// <summary>
  559. /// 保存用户的设备号
  560. /// </summary>
  561. /// <param name="keyValue">主键</param>
  562. /// <param name="deviceId">设备号</param>
  563. public void UpdateDeviceId(string keyValue, string deviceId)
  564. {
  565. try
  566. {
  567. var userEntity = this.BaseRepository().FindEntity<UserEntity>(keyValue);
  568. if (userEntity != null)
  569. {
  570. userEntity.F_DeviceId = deviceId;
  571. userEntity.Modify(keyValue);
  572. this.BaseRepository().Update(userEntity);
  573. }
  574. }
  575. catch (Exception ex)
  576. {
  577. if (ex is ExceptionEx)
  578. {
  579. throw;
  580. }
  581. else
  582. {
  583. throw ExceptionEx.ThrowServiceException(ex);
  584. }
  585. }
  586. }
  587. #endregion
  588. public UserEntity GetEntityByWeixinOpenId(string openid)
  589. {
  590. try
  591. {
  592. var strSql = new StringBuilder();
  593. strSql.Append("SELECT ");
  594. strSql.Append(fieldSql);
  595. strSql.Append(" FROM LR_Base_User t ");
  596. strSql.Append(" WHERE t.OpenIdForWeixin = @openid AND t.F_DeleteMark = 0 ");
  597. return this.BaseRepository().FindEntity<UserEntity>(strSql.ToString(), new { openid = openid });
  598. }
  599. catch (Exception ex)
  600. {
  601. if (ex is ExceptionEx)
  602. {
  603. throw;
  604. }
  605. else
  606. {
  607. throw ExceptionEx.ThrowServiceException(ex);
  608. }
  609. }
  610. }
  611. public void UpdateWeixinOpenId(string keyValue, string openid)
  612. {
  613. try
  614. {
  615. var userEntity = this.BaseRepository().FindEntity<UserEntity>(keyValue);
  616. if (userEntity != null)
  617. {
  618. userEntity.OpenIdForWeixin = openid;
  619. userEntity.Modify(keyValue);
  620. this.BaseRepository().Update(userEntity);
  621. }
  622. }
  623. catch (Exception ex)
  624. {
  625. if (ex is ExceptionEx)
  626. {
  627. throw;
  628. }
  629. else
  630. {
  631. throw ExceptionEx.ThrowServiceException(ex);
  632. }
  633. }
  634. }
  635. /// <summary>
  636. /// 获取超级管理员用户列表
  637. /// </summary>
  638. /// <returns></returns>
  639. public IEnumerable<UserEntity> GetAdminList()
  640. {
  641. try
  642. {
  643. return this.BaseRepository().FindList<UserEntity>(t => t.F_SecurityLevel == 1);
  644. }
  645. catch (Exception ex)
  646. {
  647. if (ex is ExceptionEx)
  648. {
  649. throw;
  650. }
  651. else
  652. {
  653. throw ExceptionEx.ThrowServiceException(ex);
  654. }
  655. }
  656. }
  657. /// <summary>
  658. /// 解绑微信
  659. /// </summary>
  660. public void DoUnbundWeiXin(string keyValue)
  661. {
  662. try
  663. {
  664. this.BaseRepository().ExecuteBySql("update LR_Base_User set OpenIdForWeixin=null where F_UserId='" + keyValue + "' ");
  665. }
  666. catch (Exception ex)
  667. {
  668. if (ex is ExceptionEx)
  669. {
  670. throw;
  671. }
  672. else
  673. {
  674. throw ExceptionEx.ThrowServiceException(ex);
  675. }
  676. }
  677. }
  678. public void UpdateIp(string ip, string id)
  679. {
  680. try
  681. {
  682. this.BaseRepository().ExecuteBySql("update LR_Base_User set LastIp='" + ip + "' where F_UserId='" + id + "' ");
  683. }
  684. catch (Exception ex)
  685. {
  686. if (ex is ExceptionEx)
  687. {
  688. throw;
  689. }
  690. else
  691. {
  692. throw ExceptionEx.ThrowServiceException(ex);
  693. }
  694. }
  695. }
  696. /// <summary>
  697. /// 获取用户头像,取empinfo照片
  698. /// </summary>
  699. /// <param name="userid"></param>
  700. /// <returns></returns>
  701. public string GetEmpPhotoPath(string userid)
  702. {
  703. string path = "";
  704. try
  705. {
  706. var userentity=BaseRepository().FindEntity<UserEntity>("select a.*,b.Photo from LR_Base_User a " +
  707. "left join "+BaseRepository("CollegeMIS").getDbConnection().Database+
  708. ".dbo.empinfo b on a.F_Account=b.empno where a.F_UserId='"+userid+"'", null);
  709. if (userentity!=null&&!string.IsNullOrEmpty(userentity.Photo))
  710. {
  711. //获取图片
  712. var LR_Base_AnnexesFile = BaseRepository().FindEntity<dynamic>("select * from LR_Base_AnnexesFile where F_FolderId='"+ userentity.Photo + "'", null);
  713. if (LR_Base_AnnexesFile!=null)
  714. {
  715. path = LR_Base_AnnexesFile.F_FilePath;
  716. }
  717. }
  718. return path;
  719. }
  720. catch (Exception ex)
  721. {
  722. if (ex is ExceptionEx)
  723. {
  724. throw;
  725. }
  726. else
  727. {
  728. throw ExceptionEx.ThrowServiceException(ex);
  729. }
  730. }
  731. }
  732. }
  733. }