@@ -139,7 +139,7 @@ func (d *userExampleDao) updateDataByID(ctx context.Context, collection *mongo.C
139139 return err
140140}
141141
142- // GetByID get userExample details by id
142+ // GetByID get a userExample by id
143143func (d *userExampleDao) GetByID(ctx context.Context, id string) (*model.UserExample, error) {
144144 oid := database.ToObjectID(id)
145145 if oid.IsZero() {
@@ -198,15 +198,17 @@ func (d *userExampleDao) GetByID(ctx context.Context, id string) (*model.UserExa
198198 return nil, err
199199}
200200
201- // GetByColumns get a list of userExample by custom conditions.
201+ // GetByColumns get a paginated list of userExamples by custom conditions.
202202// For more details, please refer to https://go-sponge.com/component/custom-page-query.html
203203func (d *userExampleDao) GetByColumns(ctx context.Context, params *query.Params) ([]*model.UserExample, int64, error) {
204204 filter, err := params.ConvertToMongoFilter(query.WithWhitelistNames(model.UserExampleColumnNames))
205205 if err != nil {
206206 return nil, 0, errors.New("query params error: " + err.Error())
207207 }
208+ filter = mgo.ExcludeDeleted(filter)
209+ logger.Info("query filter", logger.Any("filter", filter))
208210
209- total, err := d.collection.CountDocuments(ctx, mgo.ExcludeDeleted( filter) )
211+ total, err := d.collection.CountDocuments(ctx, filter)
210212 if err != nil {
211213 return nil, 0, err
212214 }
@@ -220,7 +222,7 @@ func (d *userExampleDao) GetByColumns(ctx context.Context, params *query.Params)
220222 findOpts.SetLimit(int64(limit)).SetSkip(int64(skip))
221223 findOpts.Sort = sort
222224
223- cursor, err := d.collection.Find(ctx, mgo.ExcludeDeleted( filter) , findOpts)
225+ cursor, err := d.collection.Find(ctx, filter, findOpts)
224226 if err != nil {
225227 return nil, 0, err
226228 }
@@ -232,7 +234,7 @@ func (d *userExampleDao) GetByColumns(ctx context.Context, params *query.Params)
232234 return records, total, err
233235}
234236
235- // DeleteByIDs delete userExample by batch id
237+ // DeleteByIDs batch delete userExample by ids
236238func (d *userExampleDao) DeleteByIDs(ctx context.Context, ids []string) error {
237239 oids := mgo.ConvertToObjectIDs(ids)
238240 filter := bson.M{"_id": bson.M{"$in": oids}}
@@ -249,24 +251,26 @@ func (d *userExampleDao) DeleteByIDs(ctx context.Context, ids []string) error {
249251 return nil
250252}
251253
252- // GetByCondition get userExample details by custom condition.
254+ // GetByCondition get a userExample by custom condition.
253255// For more details, please refer to https://go-sponge.com/component/custom-page-query.html#_2-condition-parameters-optional
254256func (d *userExampleDao) GetByCondition(ctx context.Context, c *query.Conditions) (*model.UserExample, error) {
255257 filter, err := c.ConvertToMongo(query.WithWhitelistNames(model.UserExampleColumnNames))
256258 if err != nil {
257259 return nil, err
258260 }
261+ filter = mgo.ExcludeDeleted(filter)
262+ logger.Info("query filter", logger.Any("filter", filter))
259263
260264 record := &model.UserExample{}
261- err = d.collection.FindOne(ctx, mgo.ExcludeDeleted( filter) ).Decode(record)
265+ err = d.collection.FindOne(ctx, filter).Decode(record)
262266 if err != nil {
263267 return nil, err
264268 }
265269
266270 return record, nil
267271}
268272
269- // GetByIDs get a list of userExample by batch id
273+ // GetByIDs Batch get userExample by ids
270274func (d *userExampleDao) GetByIDs(ctx context.Context, ids []string) (map[string]*model.UserExample, error) {
271275 // no cache
272276 if d.cache == nil {
@@ -352,7 +356,7 @@ func (d *userExampleDao) GetByIDs(ctx context.Context, ids []string) (map[string
352356 return itemMap, nil
353357}
354358
355- // GetByLastID get a list of userExample by last id
359+ // GetByLastID Get a paginated list of userExamples by last id
356360func (d *userExampleDao) GetByLastID(ctx context.Context, lastID string, limit int, sort string) ([]*model.UserExample, error) {
357361 page := query.NewPage(0, limit, sort)
358362
0 commit comments