BaseService.java 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. /**
  2. * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
  3. */
  4. package com.jeeplus.common.service;
  5. import com.alibaba.fastjson.JSON;
  6. import com.google.common.collect.Lists;
  7. import com.jeeplus.common.persistence.BaseEntity;
  8. import com.jeeplus.common.utils.JedisUtils;
  9. import com.jeeplus.common.utils.StringUtils;
  10. import com.jeeplus.modules.sys.dao.OfficeDao;
  11. import com.jeeplus.modules.sys.entity.Office;
  12. import com.jeeplus.modules.sys.entity.Role;
  13. import com.jeeplus.modules.sys.entity.User;
  14. import com.jeeplus.modules.sys.service.OfficeService;
  15. import com.jeeplus.modules.sys.utils.UserUtils;
  16. import org.slf4j.Logger;
  17. import org.slf4j.LoggerFactory;
  18. import org.springframework.beans.factory.annotation.Autowired;
  19. import org.springframework.transaction.annotation.Transactional;
  20. import redis.clients.jedis.Jedis;
  21. import java.util.ArrayList;
  22. import java.util.HashSet;
  23. import java.util.List;
  24. import java.util.Set;
  25. /**
  26. * Service基类
  27. *
  28. * @author jeeplus
  29. * @version 2014-05-16
  30. */
  31. @Transactional(readOnly = true)
  32. public abstract class BaseService {
  33. public static final String BRANCH_OFFICE_PREFIX = "BRANCH_OFFICE_";
  34. public static final String CHILD_OFFICE_PREFIX = "CHILD_OFFICE_";
  35. /**
  36. * 日志对象
  37. */
  38. protected Logger logger = LoggerFactory.getLogger(getClass());
  39. /**
  40. * 数据范围过滤
  41. *
  42. * @param user 当前用户对象,通过“entity.getCurrentUser()”获取
  43. * @param officeAlias 机构表别名,多个用“,”逗号隔开。
  44. * @param userAlias 用户表别名,多个用“,”逗号隔开,传递空,忽略此参数
  45. * @return 标准连接条件对象
  46. */
  47. public static String dataScopeFilter(User user, String officeAlias, String userAlias, String sAlias, String menuId) {
  48. return genSqlString("menu1_",user, menuId,sAlias, "and");
  49. }
  50. public static String genSqlString(String prefix, User user, String menuId,String sAlias, String logic) {
  51. if (user.isAdmin()) {
  52. return "";
  53. }
  54. Jedis jedis = null;
  55. try {
  56. jedis = JedisUtils.getResource();
  57. StringBuilder sqlString = new StringBuilder();
  58. String sql = jedis.hget( prefix+ user.getCompany().getId() + "_" + user.getId(), menuId);
  59. if (StringUtils.isNotBlank(sql)) {
  60. //return sql;
  61. }
  62. // 进行权限过滤,多个岗位权限范围之间为或者关系。
  63. List<Role> fnlRoleList = new ArrayList<>();
  64. List<Role> selfRoleList = new ArrayList<>();
  65. List<Role> roleList = UserUtils.getRolesByMenu(user, menuId);
  66. if (roleList != null && roleList.size() > 0) {
  67. for (Role role : roleList) {
  68. if (Role.DATA_SCOPE_COMPANY_AND_CHILD.equals(role.getDataScope())) {
  69. fnlRoleList.clear();
  70. fnlRoleList.add(role);
  71. break;
  72. } else if (!Role.DATA_SCOPE_SELF.equals(role.getDataScope())) {
  73. fnlRoleList.add(role);
  74. } else {
  75. selfRoleList.add(role);
  76. }
  77. }
  78. }
  79. Set<String> officeSet = new HashSet<>();
  80. for (Role r : fnlRoleList) {
  81. if (Role.DATA_SCOPE_COMPANY_AND_CHILD.equals(r.getDataScope())) {
  82. if(StringUtils.isBlank(sAlias)){
  83. return logic + "1=1";
  84. }
  85. sqlString.append(logic + " a.company_id = '" + r.getCompany().getId() + "'");
  86. return sqlString.toString();
  87. }
  88. if (Role.DATA_SCOPE_COMPANY.equals(r.getDataScope())) {
  89. //查询分公司的所有部门
  90. String key = BRANCH_OFFICE_PREFIX + r.getBranchCompany().getId();
  91. String s = jedis.get(key);
  92. List<String> officeIds = null;
  93. if (StringUtils.isBlank(s)) {
  94. officeIds = UserUtils.findBranchOfficeId(r.getBranchCompany());
  95. } else {
  96. officeIds = JSON.parseArray(s, String.class);
  97. }
  98. if (officeIds != null && officeIds.size() > 0) {
  99. jedis.set(key, JSON.toJSONString(officeIds));
  100. jedis.expire(key, 60 * 60 * 8);
  101. officeSet.addAll(officeIds);
  102. }
  103. continue;
  104. }
  105. if (Role.DATA_SCOPE_OFFICE_AND_CHILD.equals(r.getDataScope())) {
  106. //查询当前部门的所有子部门
  107. String key = CHILD_OFFICE_PREFIX + r.getOffice().getId();
  108. String s = jedis.get(key);
  109. List<String> officeIds = new ArrayList<>();
  110. if (StringUtils.isBlank(s)) {
  111. officeIds = UserUtils.findChildOfficeId(r.getOffice());
  112. } else {
  113. officeIds = JSON.parseArray(s, String.class);
  114. }
  115. officeIds.add(r.getOffice().getId());
  116. jedis.set(key, JSON.toJSONString(officeIds));
  117. jedis.expire(key, 60 * 60 * 8);
  118. officeSet.addAll(officeIds);
  119. continue;
  120. }
  121. if (Role.DATA_SCOPE_OFFICE.equals(r.getDataScope())) {
  122. officeSet.add(r.getOffice().getId());
  123. continue;
  124. }
  125. }
  126. //所有部门权限
  127. if (officeSet != null) {
  128. if (officeSet.size() > 1) {
  129. sqlString.append("a.office_id in (");
  130. for (String s : officeSet) {
  131. sqlString.append("'" + s + "',");
  132. }
  133. sqlString.deleteCharAt(sqlString.length() - 1);
  134. sqlString.append(")");
  135. } else if (officeSet.size() == 1) {
  136. for (String s : officeSet) {
  137. sqlString.append("a.office_id ='" + s + "'");
  138. }
  139. }
  140. }
  141. //所有个人权限
  142. for (int i = 0; i < selfRoleList.size(); i++) {
  143. Role role = selfRoleList.get(i);
  144. if (officeSet.contains(role.getOffice().getId())) {
  145. continue;
  146. }
  147. if (i > 0 || sqlString.length() > 0) {
  148. sqlString.append("or ");
  149. }
  150. sqlString.append("(a.office_id='" + role.getOffice().getId() + "' and a.create_by='" + user.getId() + "')");
  151. }
  152. if (StringUtils.isNotBlank(sqlString.toString())) {
  153. sql = logic+" (" + sqlString.toString() + ")";
  154. jedis.hset(prefix + user.getCompany().getId() + "_" + user.getId(), menuId, sql);
  155. }
  156. return sql;
  157. } catch (Exception e) {
  158. return "and a.company_id='" + user.getCompany().getId() + "' and a.create_by='" + user.getId() + "'";
  159. } finally {
  160. JedisUtils.returnResource(jedis);
  161. }
  162. }
  163. /**
  164. * 数据范围过滤
  165. *
  166. * @param user 当前用户对象,通过“entity.getCurrentUser()”获取
  167. * @param officeAlias 机构表别名,多个用“,”逗号隔开。
  168. * @param userAlias 用户表别名,多个用“,”逗号隔开,传递空,忽略此参数
  169. * @return 标准连接条件对象
  170. */
  171. public static String dataScopeFilterOR(User user, String officeAlias, String userAlias, String sAlias, String menuId) {
  172. return genSqlString("menu2_",user, menuId, sAlias,"or");
  173. }
  174. /**
  175. * 数据范围过滤 只显示当前企业下数据
  176. *
  177. * @param user 当前用户对象,通过“entity.getCurrentUser()”获取
  178. * @param officeAlias 机构表别名,多个用“,”逗号隔开。
  179. * @param userAlias 用户表别名,多个用“,”逗号隔开,传递空,忽略此参数
  180. * @return 标准连接条件对象
  181. */
  182. public static String dataScopeFilter2(User user, String officeAlias, String userAlias) {
  183. StringBuilder sqlString = new StringBuilder();
  184. // 进行权限过滤,多个岗位权限范围之间为或者关系。
  185. List<String> dataScope = Lists.newArrayList();
  186. // 超级管理员,跳过权限过滤
  187. if (!user.isAdmin()) {
  188. boolean isDataScopeAll = false;
  189. Role r = UserUtils.getSelectRole().get(0);
  190. //for (Role r : user.getRoleList()){
  191. user.setCompany(UserUtils.getSelectCompany());
  192. user.setOffice(UserUtils.getSelectOffice());
  193. for (String oa : StringUtils.split(officeAlias, ",")) {
  194. if (!dataScope.contains(r.getDataScope()) && StringUtils.isNotBlank(oa)) {
  195. if (Role.DATA_SCOPE_ALL.equals(r.getDataScope())) {
  196. isDataScopeAll = true;
  197. } else if (Role.DATA_SCOPE_COMPANY_AND_CHILD.equals(r.getDataScope())) {
  198. sqlString.append(" OR " + oa + ".id = '" + user.getCompany().getId() + "'");
  199. sqlString.append(" OR find_in_set( '" + user.getCompany().getId() + "'," + oa + ".parent_ids)");
  200. } else if (Role.DATA_SCOPE_COMPANY.equals(r.getDataScope())) {
  201. sqlString.append(" OR " + oa + ".id = '" + user.getCompany().getId() + "'");
  202. // 包括本公司下的部门 (type=1:公司;type=2:部门)
  203. sqlString.append(" OR (" + oa + ".parent_id = '" + user.getCompany().getId() + "' AND " + oa + ".type = '2')");
  204. } else if (Role.DATA_SCOPE_OFFICE_AND_CHILD.equals(r.getDataScope())) {
  205. sqlString.append(" OR " + oa + ".id = '" + user.getOffice().getId() + "'");
  206. sqlString.append(" OR find_in_set( '" + user.getOffice().getId() + "'," + oa + ".parent_ids)");
  207. } else if (Role.DATA_SCOPE_OFFICE.equals(r.getDataScope())) {
  208. //查看分公司数据
  209. sqlString.append(" OR " + oa + ".id = '" + user.getBranchOffice().getId() + "'");
  210. sqlString.append(" OR find_in_set( '" + user.getBranchOffice().getId() + "'," + oa + ".parent_ids)");
  211. /*sqlString.append(" OR " + oa + ".id = '" + user.getOffice().getId() + "'");*/
  212. } else if (Role.DATA_SCOPE_CUSTOM.equals(r.getDataScope())) {
  213. // String officeIds = StringUtils.join(r.getOfficeIdList(), "','");
  214. // if (StringUtils.isNotEmpty(officeIds)){
  215. // sqlString.append(" OR " + oa + ".id IN ('" + officeIds + "')");
  216. // }
  217. sqlString.append(" OR EXISTS (SELECT 1 FROM sys_role_office WHERE role_id = '" + r.getId() + "'");
  218. sqlString.append(" AND office_id = " + oa + ".id)");
  219. }
  220. //else if (Role.DATA_SCOPE_SELF.equals(r.getDataScope())){
  221. dataScope.add(r.getDataScope());
  222. }
  223. }
  224. //}
  225. // 如果没有全部数据权限,并设置了用户别名,则当前权限为本人;如果未设置别名,当前无权限为已植入权限
  226. if (!isDataScopeAll) {
  227. if (StringUtils.isNotBlank(userAlias)) {
  228. for (String ua : StringUtils.split(userAlias, ",")) {
  229. sqlString.append(" OR " + ua + ".id = '" + user.getId() + "'");
  230. }
  231. } else {
  232. for (String oa : StringUtils.split(officeAlias, ",")) {
  233. //sqlString.append(" OR " + oa + ".id = " + user.getOffice().getId());
  234. sqlString.append(" OR " + oa + ".id IS NULL");
  235. }
  236. }
  237. } else {
  238. // 如果包含全部权限,则去掉之前添加的所有条件,并跳出循环。
  239. sqlString = new StringBuilder();
  240. }
  241. }
  242. if (StringUtils.isNotBlank(sqlString.toString())) {
  243. return " AND (" + sqlString.substring(4) + ")";
  244. }
  245. return "";
  246. }
  247. /**
  248. * 数据范围过滤(符合业务表字段不同的时候使用,采用exists方法)
  249. *
  250. * @param entity 当前过滤的实体类
  251. * @param sqlMapKey sqlMap的键值,例如设置“dsf”时,调用方法:${sqlMap.sdf}
  252. * @param officeWheres office表条件,组成:部门表字段=业务表的部门字段
  253. * @param userWheres user表条件,组成:用户表字段=业务表的用户字段
  254. * @example dataScopeFilter(user, " dsf ", " id = a.office_id ", " id = a.create_by ");
  255. * dataScopeFilter(entity, "dsf", "code=a.jgdm", "no=a.cjr"); // 适应于业务表关联不同字段时使用,如果关联的不是机构id是code。
  256. */
  257. public static void dataScopeFilter(BaseEntity<?> entity, String sqlMapKey, String officeWheres, String userWheres) {
  258. User user = entity.getCurrentUser();
  259. // 如果是超级管理员,则不过滤数据
  260. if (user.isAdmin()) {
  261. return;
  262. }
  263. // 数据范围(1:所有数据;2:所在公司及以下数据;3:所在公司数据;4:所在部门及以下数据;5:所在部门数据;8:仅本人数据;9:按明细设置)
  264. StringBuilder sqlString = new StringBuilder();
  265. // 获取到最大的数据权限范围
  266. String roleId = "";
  267. int dataScopeInteger = 8;
  268. //for (Role r : user.getRoleList()){
  269. Role r = UserUtils.getSelectRole().get(0);
  270. //for (Role r : user.getRoleList()){
  271. user.setCompany(UserUtils.getSelectCompany());
  272. user.setOffice(UserUtils.getSelectOffice());
  273. int ds = Integer.valueOf(r.getDataScope());
  274. if (ds == 9) {
  275. roleId = r.getId();
  276. dataScopeInteger = ds;
  277. //break;
  278. } else if (ds < dataScopeInteger) {
  279. roleId = r.getId();
  280. dataScopeInteger = ds;
  281. }
  282. //}
  283. String dataScopeString = String.valueOf(dataScopeInteger);
  284. // 生成部门权限SQL语句
  285. for (String where : StringUtils.split(officeWheres, ",")) {
  286. if (Role.DATA_SCOPE_COMPANY_AND_CHILD.equals(dataScopeString)) {
  287. // 包括本公司下的部门 (type=1:公司;type=2:部门)
  288. sqlString.append(" AND EXISTS (SELECT 1 FROM SYS_OFFICE");
  289. sqlString.append(" WHERE type='2'");
  290. sqlString.append(" AND (id = '" + user.getCompany().getId() + "'");
  291. sqlString.append(" OR parent_ids LIKE '" + user.getCompany().getParentIds() + user.getCompany().getId() + ",%')");
  292. sqlString.append(" AND " + where + ")");
  293. } else if (Role.DATA_SCOPE_COMPANY.equals(dataScopeString)) {
  294. sqlString.append(" AND EXISTS (SELECT 1 FROM SYS_OFFICE");
  295. sqlString.append(" WHERE type='2'");
  296. sqlString.append(" AND id = '" + user.getCompany().getId() + "'");
  297. sqlString.append(" AND " + where + ")");
  298. } else if (Role.DATA_SCOPE_OFFICE_AND_CHILD.equals(dataScopeString)) {
  299. sqlString.append(" AND EXISTS (SELECT 1 FROM SYS_OFFICE");
  300. sqlString.append(" WHERE (id = '" + user.getOffice().getId() + "'");
  301. sqlString.append(" OR parent_ids LIKE '" + user.getOffice().getParentIds() + user.getOffice().getId() + ",%')");
  302. sqlString.append(" AND " + where + ")");
  303. } else if (Role.DATA_SCOPE_OFFICE.equals(dataScopeString)) {
  304. sqlString.append(" AND EXISTS (SELECT 1 FROM SYS_OFFICE");
  305. sqlString.append(" WHERE id = '" + user.getOffice().getId() + "'");
  306. sqlString.append(" AND " + where + ")");
  307. } else if (Role.DATA_SCOPE_CUSTOM.equals(dataScopeString)) {
  308. sqlString.append(" AND EXISTS (SELECT 1 FROM sys_role_office ro123456, sys_office o123456");
  309. sqlString.append(" WHERE ro123456.office_id = o123456.id");
  310. sqlString.append(" AND ro123456.role_id = '" + roleId + "'");
  311. sqlString.append(" AND o123456." + where + ")");
  312. }
  313. }
  314. // 生成个人权限SQL语句
  315. for (String where : StringUtils.split(userWheres, ",")) {
  316. if (Role.DATA_SCOPE_SELF.equals(dataScopeString)) {
  317. sqlString.append(" AND EXISTS (SELECT 1 FROM sys_user");
  318. sqlString.append(" WHERE id='" + user.getId() + "'");
  319. sqlString.append(" AND " + where + ")");
  320. }
  321. }
  322. // System.out.println("dataScopeFilter: " + sqlString.toString());
  323. // 设置到自定义SQL对象
  324. entity.getSqlMap().put(sqlMapKey, sqlString.toString());
  325. }
  326. /**
  327. * @param user
  328. * @param sAlias 分公司表别名
  329. * @return
  330. */
  331. public static String dataScopeBranchOfficeFilter(User user, String sAlias) {
  332. if (user.isAdmin()) {
  333. return "";
  334. }
  335. if (StringUtils.isBlank(sAlias)) {
  336. return "";
  337. }
  338. List<Role> selectRoles = UserUtils.getSelectRole();
  339. if (selectRoles == null || selectRoles.isEmpty()) {
  340. return "";
  341. }
  342. Set<String> branchIds = new HashSet<>();
  343. for (Role role : selectRoles) {
  344. branchIds.add(role.getBranchCompany() == null ? null : role.getBranchCompany().getId());
  345. }
  346. StringBuilder sql = new StringBuilder("and " + sAlias + ".id in (");
  347. for (String branchId : branchIds) {
  348. if (StringUtils.isBlank(branchId)) {
  349. sql.append("'" + user.getComId() + "',");
  350. } else {
  351. sql.append("'" + branchId + "',");
  352. }
  353. }
  354. sql.deleteCharAt(sql.length() - 1);
  355. sql.append(")");
  356. return sql.toString();
  357. }
  358. public static String dataScopeFilterOR(User user, String officeAlias,String menuId) {
  359. Jedis jedis = null;
  360. try {
  361. jedis = JedisUtils.getResource();
  362. StringBuilder sqlString = new StringBuilder();
  363. String sql = jedis.hget("menu2_"+user.getCompany().getId()+"_"+user.getId(), menuId);
  364. if (StringUtils.isNotBlank(sql)) {
  365. return sql;
  366. } else {
  367. List<Role> roleList = UserUtils.getRolesByMenu(user, menuId);
  368. // 超级管理员,跳过权限过滤
  369. if (!user.isAdmin()) {
  370. boolean isDataScopeAll = false;
  371. if (UserUtils.getSelectRole() != null && UserUtils.getSelectRole().size() > 0) {
  372. for (Role role : UserUtils.getSelectRole()) {
  373. if (Role.DATA_SCOPE_COMPANY_AND_CHILD.equals(role.getDataScope())) {
  374. roleList.clear();
  375. roleList.add(role);
  376. break;
  377. } else if (!Role.DATA_SCOPE_SELF.equals(role.getDataScope()) || UserUtils.getSelectRole().size() == 1) {
  378. roleList.add(role);
  379. }
  380. }
  381. }
  382. for (Role r : roleList) {
  383. int count = 0;
  384. sqlString.append(" ( (");
  385. for (String oa : StringUtils.split(officeAlias, ",")) {
  386. if (StringUtils.isNotBlank(oa)) {
  387. if (Role.DATA_SCOPE_ALL.equals(r.getDataScope())) {
  388. isDataScopeAll = true;
  389. } else if (Role.DATA_SCOPE_COMPANY_AND_CHILD.equals(r.getDataScope())) {
  390. sqlString.append(oa + ".id = '" + user.getCompany().getId() + "'");
  391. sqlString.append(" OR " + oa + ".parent_ids LIKE '" + user.getCompany().getParentIds() + user.getCompany().getId() + ",%'");
  392. } else if (Role.DATA_SCOPE_COMPANY.equals(r.getDataScope())) {
  393. if (user.getBranchOffice() != null && StringUtils.isNotBlank(user.getBranchOffice().getId())) {
  394. sqlString.append(oa + ".branch_office = '" + user.getBranchOffice().getId() + "'");
  395. } else {
  396. sqlString.append(oa + ".branch_office is null ");
  397. }
  398. sqlString.append("and (" + oa + ".id = '" + user.getCompany().getId() + "'");
  399. sqlString.append(" OR " + oa + ".parent_ids LIKE '" + user.getCompany().getParentIds() + user.getCompany().getId() + ",%')");
  400. /*sqlString.append(oa + ".id = '" + user.getCompany().getId() + "'");
  401. // 包括本公司下的部门 (type=1:公司;type=2:部门)
  402. sqlString.append(" OR (" + oa + ".parent_id = '" + user.getCompany().getId() + "' AND " + oa + ".type = '2')");
  403. */
  404. } else if (Role.DATA_SCOPE_OFFICE_AND_CHILD.equals(r.getDataScope())) {
  405. sqlString.append(oa + ".id = '" + user.getOffice().getId() + "'");
  406. sqlString.append(" OR " + oa + ".parent_ids LIKE '" + user.getOffice().getParentIds() + user.getOffice().getId() + ",%'");
  407. } else if (Role.DATA_SCOPE_OFFICE.equals(r.getDataScope())) {
  408. /*sqlString.append(" OR " + oa + ".id = '" + user.getOffice().getId() + "'");*/
  409. //查看分公司数据
  410. sqlString.append(oa + ".id = '" + user.getBranchOffice().getId() + "'");
  411. sqlString.append(" OR " + oa + ".parent_ids LIKE '" + user.getBranchOffice().getParentIds() + user.getBranchOffice().getId() + ",%'");
  412. } else {
  413. count = 1;
  414. }
  415. }
  416. }
  417. //}
  418. // 如果没有全部数据权限,并设置了用户别名,则当前权限为本人;如果未设置别名,当前无权限为已植入权限
  419. if (!isDataScopeAll) {
  420. if (count == 1) {
  421. sqlString.append("a.create_by IS NULL");
  422. } else {
  423. sqlString.append(" OR " + "a.create_by IS NULL");
  424. }
  425. } else {
  426. // 如果包含全部权限,则去掉之前添加的所有条件,并跳出循环。
  427. sqlString = new StringBuilder();
  428. }
  429. sqlString.append(") ) OR");
  430. }
  431. }
  432. if (StringUtils.isNotBlank(sqlString.toString())) {
  433. if (roleList.size() > 1) {
  434. sql = "OR(" + sqlString.substring(0, sqlString.length() - 3) + ")";
  435. } else {
  436. sql = "OR" + sqlString.substring(0, sqlString.length() - 3);
  437. }
  438. jedis.hset("menu2_"+user.getCompany().getId()+"_"+user.getId(), menuId, sql);
  439. return sql;
  440. }
  441. }
  442. }catch (Exception e){
  443. System.out.println("------------------dataScopeFilterOR Exception e:"+e);
  444. }finally {
  445. JedisUtils.returnResource(jedis);
  446. }
  447. //return "OR (s.id = '"+user.getCompany().getId()+"' AND a.create_by = '" + user.getId()+"')";
  448. return "OR 1=1";
  449. }
  450. }