更改查询规则的问题
parent
74204db9fb
commit
51a027a180
|
@ -639,7 +639,7 @@ DROP TABLE IF EXISTS `wt_rules`;
|
|||
CREATE TABLE `wt_rules` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`user_id` bigint(20) NOT NULL COMMENT '用户id',
|
||||
`reporters` varchar(500) COLLATE utf8_bin DEFAULT NULL COMMENT '需要提交报告的用户名ID',
|
||||
`reporters` varchar(5000) COLLATE utf8_bin DEFAULT NULL COMMENT '需要提交报告的用户名ID',
|
||||
`start_week` int(10) DEFAULT NULL COMMENT '提交报告的开始在周几',
|
||||
`start_hour` int(10) DEFAULT NULL COMMENT '提交周报的开始时间小时',
|
||||
`end_week` int(10) DEFAULT NULL COMMENT '提交报告的结束在周几',
|
||||
|
|
|
@ -28,8 +28,8 @@ func (wtRuleApi *WtOutputApi) GetStatResult(c *gin.Context) {
|
|||
c.ShouldBindQuery(&idInfo)
|
||||
|
||||
if err, rewtOutput := wtOutputService.GetStatResult(idInfo); err != nil {
|
||||
global.GLOBAL_LOG.Error("查询失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("查询失败", c)
|
||||
global.GLOBAL_LOG.Error("统计失败,可能需要先创建统计规则!", zap.Any("err", err))
|
||||
response.FailWithMessage("统计失败,可能需要先创建统计规则!", c)
|
||||
} else {
|
||||
response.OkWithData(gin.H{"rewtOutput": rewtOutput}, c)
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -1 +1 @@
|
|||
log/2021-11-16.log
|
||||
log/2021-11-17.log
|
|
@ -22,3 +22,4 @@
|
|||
[goweb-demo]2021/11/16 - 06:39:03.560 [31merror[0m /usr/local/weekly_report/api/system/sys_user.go:36 登陆失败! 用户名不存在或者密码错误! {"err": "record not found"}
|
||||
[goweb-demo]2021/11/16 - 07:16:08.828 [34minfo[0m /usr/local/weekly_report/initialize/router.go:49 router register success
|
||||
[goweb-demo]2021/11/16 - 07:16:08.838 [34minfo[0m /usr/local/weekly_report/core/server.go:31 server run success on {"address": ":8981"}
|
||||
[goweb-demo]2021/11/16 - 12:44:19.513 [31merror[0m /usr/local/weekly_report/core/server.go:38 accept tcp [::]:8981: use of closed network connection
|
||||
|
|
|
@ -27,8 +27,9 @@ func (wtRuleService *WtRuleService) DeleteWtRuleByIds(ids request.IdsReq) (err e
|
|||
|
||||
// UpdateWtRule 更新WtRule记录
|
||||
func (wtRuleService *WtRuleService) UpdateWtRule(ruleRes wtReq.WtRuleRes) (err error) {
|
||||
ruleRes.ID = 7
|
||||
rule := voToRule(ruleRes)
|
||||
err = global.GLOBAL_DB.Updates(&rule).Error
|
||||
err = global.GLOBAL_DB.Omit("created_at").Save(&rule).Error
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -62,7 +63,12 @@ func (wtRuleService *WtRuleService) GetWtRuleInfoList(info wtReq.WtRuleSearch) (
|
|||
limit = int(total)
|
||||
}
|
||||
|
||||
err = db.Limit(limit).Offset(offset).Find(&wtRules).Error
|
||||
if info.UserId == 0 {
|
||||
err = db.Limit(limit).Offset(offset).Find(&wtRules).Error
|
||||
} else {
|
||||
err = db.Where("user_id = ?", info.UserId).Count(&total).Error
|
||||
err = db.Where("user_id = ?", info.UserId).Limit(limit).Offset(offset).Find(&wtRules).Error
|
||||
}
|
||||
|
||||
ruleResults := rulesToVOs(wtRules)
|
||||
|
||||
|
|
Loading…
Reference in New Issue