|
@@ -78,25 +78,34 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
if (!SharingStaticData.PortTypes.Contains(portType)) return new JsonView() { Code = StatusCodes.Status400BadRequest, Msg = "端口类型错误!" };
|
|
|
if (groupId < 1) return new JsonView() { Code = StatusCodes.Status400BadRequest, Msg = MsgTips.DiId };
|
|
|
|
|
|
- var infos = await _sqlSugar
|
|
|
- .Queryable<Grp_RestaurantInfo, Sys_Users>((pi, u) => new JoinQueryInfos(JoinType.Left, pi.CreateUserId == u.Id))
|
|
|
- .Where((pi, u) => pi.IsDel == 0 && pi.GroupId == groupId)
|
|
|
-
|
|
|
- .Select((pi, u) => new
|
|
|
- {
|
|
|
- pi.Id,
|
|
|
- //pi.GroupId,
|
|
|
- pi.Date,
|
|
|
- pi.StartTime,
|
|
|
- pi.EndTime,
|
|
|
- Type = pi.Type == 1 ? "早餐" : pi.Type == 2 ? "午餐" : pi.Type == 3 ? "晚餐" : "其他",
|
|
|
- pi.Name,
|
|
|
- pi.Address,
|
|
|
- pi.Tel,
|
|
|
- pi.Remark
|
|
|
- })
|
|
|
- .OrderBy(pi => pi.Date)
|
|
|
- .ToListAsync();
|
|
|
+
|
|
|
+ var sql = string.Format(@" SELECT
|
|
|
+ ri.Id,
|
|
|
+ ri.GroupId,
|
|
|
+ ri.Date,
|
|
|
+ ri.StartTime,
|
|
|
+ ri.EndTime,
|
|
|
+ CASE WHEN ri.Type = 1 THEN '早餐'
|
|
|
+ WHEN ri.Type = 2 THEN '午餐'
|
|
|
+ WHEN ri.Type = 3 THEN '晚餐'
|
|
|
+ ELSE '其他'
|
|
|
+ END AS 'Type',
|
|
|
+ ri.Name,
|
|
|
+ ri.Address,
|
|
|
+ ri.Tel,
|
|
|
+ ri.Remark,
|
|
|
+ ri.CreateTime,
|
|
|
+ u.CnName AS CreateUserName
|
|
|
+FROM
|
|
|
+ Grp_RestaurantInfo ri
|
|
|
+ LEFT JOIN Sys_Users u ON ri.CreateUserId = u.Id
|
|
|
+WHERE
|
|
|
+ ri.IsDel = 0
|
|
|
+ AND ri.GroupId = {0}
|
|
|
+", groupId);
|
|
|
+
|
|
|
+ var infos = await _sqlSugar.SqlQueryable<RestaurantItemView>(sql).ToListAsync();
|
|
|
+
|
|
|
if (!infos.Any()) return new JsonView() { Code = StatusCodes.Status400BadRequest, Msg = "数据未填写!",Data = Array.Empty<dynamic>() };
|
|
|
|
|
|
return new JsonView() { Code = StatusCodes.Status200OK, Msg = "操作成功!", Data = infos };
|