コード例 #1
0
 @Override
 public List<SystemUserDTO> getAccount() {
   MongoTemplate mongoTemplate = BaseMongoTemplate.getSysMongo();
   return ObjectUtils.convert(
       mongoTemplate.find(Query.query(Criteria.where("state").is(0)), getEntityClass()),
       getDTOClass());
 }
コード例 #2
0
 @Override
 public void uploadImg(byte[] bytes) {
   MongoTemplate mongoTemplate = BaseMongoTemplate.getSysMongo();
   mongoTemplate.updateFirst(
       Query.query(Criteria.where("userName").is(AppContext.getUser())),
       Update.update("img", bytes),
       getEntityClass());
 }
コード例 #3
0
 @Override
 public SystemUserDTO getCurrUserInfo() {
   MongoTemplate mongoTemplate = BaseMongoTemplate.getSysMongo();
   SystemUserEntity entity =
       mongoTemplate.findOne(
           Query.query(Criteria.where("userName").is(AppContext.getUser())), getEntityClass());
   return ObjectUtils.convert(entity, getDTOClass());
 }
コード例 #4
0
 @Override
 public List<SystemUserDTO> getAllSysUserAccount() {
   MongoTemplate mongoTemplate = BaseMongoTemplate.getSysMongo();
   List<SystemUserEntity> userEntityList =
       mongoTemplate.find(
           Query.query(Criteria.where("access").is(2).and("acstate").is(1).and("state").is(1)),
           getEntityClass());
   return ObjectUtils.convertToList(userEntityList, getDTOClass());
 }
コード例 #5
0
 @Override
 public boolean updateSysAccount(String userName, Long state) {
   MongoTemplate mongoTemplate = BaseMongoTemplate.getSysMongo();
   Update update = new Update();
   update.set("acstate", state);
   WriteResult writeResult =
       mongoTemplate.updateFirst(
           Query.query(Criteria.where("userName").is(userName)), update, "sys_user");
   return writeResult.isUpdateOfExisting();
 }
コード例 #6
0
 @Override
 public boolean updateBaiDuName(String name, Long baiduId) {
   MongoTemplate mongoTemplate = BaseMongoTemplate.getSysMongo();
   Update update = new Update();
   update.set("bdAccounts.$.baiduRemarkName", name);
   WriteResult writeResult =
       mongoTemplate.updateFirst(
           Query.query(Criteria.where("bdAccounts._id").is(baiduId)), update, "sys_user");
   return writeResult.isUpdateOfExisting();
 }
コード例 #7
0
 @Override
 public boolean updatePwd(String account, String pwd) {
   MongoTemplate mongoTemplate = BaseMongoTemplate.getSysMongo();
   WriteResult writeResult =
       mongoTemplate.updateFirst(
           Query.query(Criteria.where("userName").is(account)),
           Update.update("password", pwd),
           "sys_user");
   return writeResult.isUpdateOfExisting();
 }
コード例 #8
0
 @Override
 public int updateAccountStruts(String userName) {
   MongoTemplate mongoTemplate = BaseMongoTemplate.getSysMongo();
   WriteResult writeResult =
       mongoTemplate.updateFirst(
           Query.query(Criteria.where("userName").is(userName)),
           Update.update("state", 1),
           "sys_user");
   int i = 0;
   if (writeResult.isUpdateOfExisting()) i = 1;
   return i;
 }
コード例 #9
0
  @Override
  public void updateBaiduAccountInfo(BaiduAccountInfoDTO dto) {
    MongoTemplate mongoTemplate = BaseMongoTemplate.getSysMongo();
    String currUser = AppContext.getUser();
    Update update = new Update();
    if (dto.getBudget() != null) update.set("bdAccounts.$.bgt", dto.getBudget());

    if (dto.getIsDynamicCreative() != null)
      update.set("bdAccounts.$.dc", dto.getIsDynamicCreative());

    if (dto.getExcludeIp() != null) update.set("bdAccounts.$.exIp", dto.getExcludeIp());

    mongoTemplate.updateFirst(
        Query.query(Criteria.where("userName").is(currUser).and("bdAccounts._id").is(dto.getId())),
        update,
        getEntityClass());
  }
コード例 #10
0
 @Override
 public List<SystemUserDTO> getAccountAll() {
   MongoTemplate mongoTemplate = BaseMongoTemplate.getSysMongo();
   return ObjectUtils.convert(mongoTemplate.find(new Query(), getEntityClass()), getDTOClass());
 }